Skip to content

Add embedded controlled-session broker - #49

Open
omry wants to merge 1 commit into
pr48from
pr49
Open

Add embedded controlled-session broker#49
omry wants to merge 1 commit into
pr48from
pr49

Conversation

@omry

@omry omry commented Aug 12, 2026

Copy link
Copy Markdown
Owner

Add the controller-side controlled-session client command to the monolithic Reploy binary. Translate the private host protocol into a strict versioned JSON Lines stream and a same-identity, single-use terminal socket with bounded attachment and backpressure behavior.

Validate public requests against granted operations and lifecycle state, keep the broker alive through output finalization and terminal-result acknowledgement, and fail gracefully on unsupported platforms. Cover protocol rejection, ordering, timeouts, socket loss, cleanup, and platform behavior.


Stack created with Sapling. Best reviewed with ReviewStack.

@omry
omry changed the base branch from main to pr48 August 12, 2026 12:06
@omry
omry marked this pull request as ready for review August 12, 2026 12:10
Copilot AI lite review requested due to automatic review settings August 12, 2026 12:10

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 224b1b84dd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/controlledsession/controller_broker.go Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a controller-side “controlled-session client” broker to the monolithic reploy binary, exposing a strict versioned JSON Lines public stream and a private, same-identity, single-use terminal socket for controlled workload interaction.

Changes:

  • Introduces a dedicated terminal framing protocol (binary frames + JSON for terminal-end status) and a private Unix-socket terminal listener/connection with identity checks and cleanup.
  • Adds a strict JSON Lines controller stream (reader/writer) and the controller broker that bridges public requests + terminal input to the host session protocol while enforcing lifecycle/authorization rules.
  • Wires a new reploy controlled-session client CLI subcommand and adds a changelog fragment.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
internal/controlledsession/terminal_protocol.go Defines the terminal binary framing and event/request encoding/decoding.
internal/controlledsession/terminal_protocol_test.go Adds round-trip and malformed/wrong-direction coverage for the terminal protocol.
internal/controlledsession/controller_terminal.go Implements controller-side terminal listener/connection abstractions with deadlines and single-accept behavior.
internal/controlledsession/controller_terminal_linux.go Provides the Linux AF_UNIX implementation with path/permission/identity validation and cleanup.
internal/controlledsession/controller_terminal_linux_test.go Verifies privacy, single-use semantics, cleanup, and backpressure on Linux.
internal/controlledsession/controller_terminal_unsupported.go Fails gracefully on non-Linux platforms.
internal/controlledsession/controller_terminal_unsupported_test.go Tests non-Linux graceful failure behavior.
internal/controlledsession/controller_stream.go Implements strict JSON Lines public controller stream request parsing and event emission.
internal/controlledsession/controller_stream_test.go Tests strict parsing rules and exact JSON lines output shape.
internal/controlledsession/controller_broker.go Adds the broker that translates between public stream + terminal socket and the host session protocol with lifecycle gating.
internal/controlledsession/controller_broker_linux_test.go Exercises end-to-end broker behavior, timeouts, socket loss, and request validation.
internal/cli/cli.go Wires the controlled-session client command and help/usage into the CLI.
internal/cli/controlled_session_test.go Adds CLI dispatch and stderr-only failure reporting coverage.
.changes/unreleased/+controlled-session-controller-broker.yaml Adds a release-note fragment for the new embedded broker command.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread internal/controlledsession/controller_broker.go
@omry
omry force-pushed the pr49 branch 2 times, most recently from aebb54c to 0a939b9 Compare August 12, 2026 12:26
@omry

omry commented Aug 12, 2026

Copy link
Copy Markdown
Owner Author

@codex review

Current head: 0a939b9

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0a939b9c6a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/controlledsession/controller_broker.go
Comment thread internal/controlledsession/controller_broker.go Outdated
Comment thread internal/controlledsession/controller_broker.go Outdated
@omry

omry commented Aug 12, 2026

Copy link
Copy Markdown
Owner Author

@codex review

Current head: 7cbcb58

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7cbcb58b46

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/controlledsession/controller_broker.go
@omry

omry commented Aug 12, 2026

Copy link
Copy Markdown
Owner Author

@codex review

Current head: 6393d6f

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6393d6f3d2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/controlledsession/controller_broker.go Outdated
@omry

omry commented Aug 12, 2026

Copy link
Copy Markdown
Owner Author

@codex review

Current head: d4db26b

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d4db26b7df

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/controlledsession/controller_broker.go
@omry

omry commented Aug 12, 2026

Copy link
Copy Markdown
Owner Author

@codex review

Current head: 9d116c1

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9d116c1289

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/controlledsession/controller_broker.go Outdated
@omry

omry commented Aug 12, 2026

Copy link
Copy Markdown
Owner Author

@codex review

Current head: 6d6bc4a

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6d6bc4af43

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/cli/cli.go
@omry

omry commented Aug 12, 2026

Copy link
Copy Markdown
Owner Author

@codex review

Current head: 05ac57d

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 05ac57df5b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/controlledsession/controller_broker.go
@omry

omry commented Aug 12, 2026

Copy link
Copy Markdown
Owner Author

@codex review

Current head: a8a5a4f

@omry

omry commented Aug 12, 2026

Copy link
Copy Markdown
Owner Author

@codex review

Current head: f19d7af

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f19d7afffb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/controlledsession/controller_broker.go
@omry

omry commented Aug 12, 2026

Copy link
Copy Markdown
Owner Author

@codex review

Current head: 85bc42a

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 85bc42a92f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/dockerdeploy/controlled_session_supervisor.go Outdated
@omry

omry commented Aug 12, 2026

Copy link
Copy Markdown
Owner Author

@codex review

Current head: d65603d

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: d65603d45c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@omry

omry commented Aug 12, 2026

Copy link
Copy Markdown
Owner Author

@codex review

Current head: a57680d

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a57680d4ea

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/controlledsession/controller_broker.go
Add the controller-side controlled-session client command to the monolithic Reploy binary. Translate the private host protocol into a strict versioned JSON Lines stream and a same-identity, single-use terminal socket with bounded attachment and backpressure behavior.

Validate public requests against granted operations and lifecycle state, keep the broker alive through output finalization and terminal-result acknowledgement, and fail gracefully on unsupported platforms. Start terminal request and disconnect monitoring at attachment acceptance, preserving bounded pre-open input and the latest resize until host authorization arrives. Bound broker-to-host request writes so PTY backpressure cannot hold the control loop indefinitely, atomically discard in-flight PTY traffic once host termination latches, and preserve the acknowledgement write across clean post-result EOF. Stabilize watchdog-exit coverage by driving test input only after readiness. Cover protocol rejection, ordering, timeouts, socket loss, cleanup, and platform behavior.
@omry

omry commented Aug 12, 2026

Copy link
Copy Markdown
Owner Author

@codex review

Head: 64aa36cb01e3d942f2e7e263cbb2620dc8825ac8

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: 64aa36cb01

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved PR reviewed and approved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants