Conversation
There was a problem hiding this comment.
Pull request overview
Adds the controlled-session V1 wire protocol layer for host↔controller communication, including shared lifecycle/result models, a versioned framed codec, and strict JSON validation to prevent malformed or ambiguous payloads.
Changes:
- Introduces V1 lifecycle/result/status model types and validation helpers.
- Implements a versioned framed transport with magic/version/kind/length header, bounded payloads, and strict decoding (including duplicate-field rejection).
- Adds unit tests for round-trips and malformed frames plus fuzz coverage for request/event decoding.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| internal/controlledsession/protocol.go | Defines the V1 framing format, request/event encoding/decoding, and strict JSON validation. |
| internal/controlledsession/protocol_test.go | Adds round-trip, malformed-frame, duplicate-field, and fuzz-seed coverage for the protocol codec. |
| internal/controlledsession/model.go | Introduces V1 termination/result/status types and validates cross-field semantics. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| case wireRequestOpenEndpointV1: | ||
| return RequestV1{Kind: RequestOpenEndpointV1, EndpointID: string(payload)}, nil |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 970425ae12
ℹ️ 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".
| if err := validateTerminalControllerStatusV1(result.ControllerStatus); err != nil { | ||
| return err | ||
| } | ||
| return validateCleanupResultV1(result.CleanupStatus, result.RecoveryAction) |
There was a problem hiding this comment.
Reject contradictory terminal results
When a malformed peer or state-machine bug produces a result such as cause: controller-complete with controller_status: lost, or cause: application-exit with an unknown application status, this validator accepts it because it checks each field independently. Since the cause is the authoritative latched outcome, accepting causally contradictory combinations can make downstream code interpret a failed or incomplete session as successful; validate the cause/status relationships before accepting or emitting the terminal event.
Useful? React with 👍 / 👎.
67fe9ac to
ee3eba3
Compare
0d3bf7f to
b055070
Compare
5210a3a to
faaa087
Compare
35386b8 to
d2fa5ba
Compare
Define the versioned typed frame codec and shared lifecycle result types used between the host supervisor and controller. Give every V1 frame and event an explicit stable wire assignment while preserving terminal bytes exactly and validating structured payloads, direction, dimensions, endpoint identifiers, protocol version, duplicate JSON fields, and bounded payload length. Treat controller completion as finalization rather than a termination cause, and model bounded workload-output finalization explicitly in the opened contract, events, and final result. Align the controlled-session design and follow-up networking backlog with the temporary coarse lease-network grant and the planned gateway-based direct path. Add stable-wire, round-trip, malformed-frame, direction-confusion, duplicate-field, binary-data, output-finalization, and fuzz-seed coverage.
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Define shared lifecycle result and status types, then add the versioned typed frame codec used between the host supervisor and controller. Preserve terminal bytes exactly while validating structured event payloads, frame direction, dimensions, endpoint identifiers, result semantics, duplicate JSON fields, protocol version, and bounded payload length.
Add round-trip, malformed-frame, direction-confusion, duplicate-field, binary-data, and fuzz-seed coverage.
Stack created with Sapling. Best reviewed with ReviewStack.