Repository navigation
fix(gateway): preserve node invoke dispatch provenance - #117139
omarshahine merged 5 commits into
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 3:36 PM ET / 19:36 UTC. ClawSweeper reviewWhat this changesThe PR records whether a Gateway request crossed its socket send and whether a paired-node command was accepted for transport, then returns that provenance with timeout and unavailable outcomes. Merge readinessKeep open. Current Likely related people: Priority: P1 Review scores
Verification
How this fits togetherGateway clients send protocol requests over a socket, while Gateway server methods dispatch command frames through the node registry to paired nodes. The resulting timeout or disconnect outcome informs exec and plugin-policy callers whether retrying could duplicate a command. flowchart LR
A[Gateway caller] --> B[Protocol socket request]
B --> C[Gateway server method]
C --> D[Node registry]
D --> E[Paired node transport]
E --> F[Result, timeout, or disconnect]
F --> G[Retry-safety response]
Decision needed
Why: The implementation is mechanically coherent, but the permanent meaning of consumer-visible retry metadata is a Gateway contract choice that automated review cannot safely make. Before merge
Agent review detailsSecurityNone. PR surfaceSource +81, Tests +281. Total +362 across 16 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the deadline parent first, rebase this layer onto current Do we have a high-confidence way to reproduce the issue? Yes, from source. Current Is this the best way to solve the issue? Yes. Recording the fact at the socket-send and node-registry send boundaries is the narrowest maintainable solution because those owners, rather than downstream callers, know whether dispatch was proven. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 7c9794b5c65c. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (10 earlier review cycles; latest 8 shown)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 6381c461-11aa-4700-8648-4da1393e1c59
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 6381c461-11aa-4700-8648-4da1393e1c59
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 6381c461-11aa-4700-8648-4da1393e1c59
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 6381c461-11aa-4700-8648-4da1393e1c59
a51db74 to
bb83607
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 6381c461-11aa-4700-8648-4da1393e1c59
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Maintainer decision: accepted. This is Layer 2 of the native stack and must land bottom-to-top, only after #116591 lands. Do not merge this layer independently. |
* fix(gateway): preserve node invoke dispatch provenance Co-authored-by: Copilot App <[email protected]> Copilot-Session: 6381c461-11aa-4700-8648-4da1393e1c59 * fix(gateway): preserve timeout precedence Co-authored-by: Copilot App <[email protected]> Copilot-Session: 6381c461-11aa-4700-8648-4da1393e1c59 * fix(gateway): mark wake-path disconnect as not dispatched Co-authored-by: Copilot App <[email protected]> Copilot-Session: 6381c461-11aa-4700-8648-4da1393e1c59 * fix(gateway): mark plugin dispatch after send Co-authored-by: Copilot App <[email protected]> Copilot-Session: 6381c461-11aa-4700-8648-4da1393e1c59 * build(browser): regenerate Copilot runtime Co-authored-by: Copilot App <[email protected]> Copilot-Session: 6381c461-11aa-4700-8648-4da1393e1c59 --------- Co-authored-by: Omar Shahine <[email protected]> Co-authored-by: Copilot App <[email protected]> Copilot-Session: 6381c461-11aa-4700-8648-4da1393e1c59
Stacked on #116591 at
809a73433fbd7acf4da437e69f1c6aeb9f04a9a0.Additional instructions
MUST: Keep Allow edits from maintainers enabled for this PR so maintainers
can help update the branch when needed.
What Problem This Solves
Node invocation timeouts and disconnects did not preserve enough boundary provenance to distinguish a proven pre-dispatch failure from an ambiguous outcome after a command may already have reached the node. Callers therefore could not determine whether retrying was safe or could duplicate a command.
Why This Change Was Made
This restacked Layer 2 records whether Gateway request bytes crossed
socket.send, marks node command dispatch only after the node transport send succeeds, and settles node invocation exactly once across result, timer, abort, idle timeout, disconnect, and late duplicate races.Hard deadline precedence is preserved when disconnect or abort arrives after the deadline but before the timer callback. Wake-path
NOT_CONNECTEDremains proven pre-dispatch, while plugin-policy results only mark dispatch through the authoritative post-sendonDispatchReadyboundary.Current ownership is preserved:
GatewayProtocolRequestErrorandGatewayProtocolRequestOptionsremain canonical inpackages/gateway-client/src/protocol-request.ts. This layer ports only request-sent timeout metadata and exact-once timeout handling into the current structure.User Impact
Gateway consumers can distinguish failures that are safe to retry from timeouts or disconnects where the node command may already have run. Results immediately before the deadline remain accepted; results at or after the deadline consistently time out; late and duplicate results cannot change the recorded terminal outcome.
Evidence
Restack identity:
a51db74d4f0c134176e9863485944f03e5d4fa90809a73433fbd7acf4da437e69f1c6aeb9f04a9a0bb83607cc7f7c10fe78e870a8bf740b0d29ce9c58fbbb9cbe13d08894794712455a45e1aca553c9cWORKLOG.mdorpending-request.tsownership move.Focused behavior proof:
Result: 239 tests passed. A deterministic deadline/abort/disconnect precedence filter passed 9 tests.
Static and package proof:
extensions/browser/chrome-extension/modules/copilot-runtime.jsfrom SHA-256f6ff276e6d0eabbdcca7aee7efba585a48644a0b923cf0d172dd54159e73975fto69c798555bcec32de36904321e74f2c33ab592789e4faa19706371bae3dd6e83. The required generated output is committed at the exact head, and the repository's bundled plugin asset check reports that generated assets match the committed bytes.Remote proof runs:
run_47f374209567: core and core-test tsgo passed.run_53696cf5ff1c: full production/test tsgo and dependency deadcode passed.run_d4510ba3bb64: Plugin SDK API/export/surface and deadcode gates passed.run_ff19fda253cf: exact-head isolated paired-node proof passed.The paired-node proof used the bundled Canvas plugin through
canvas.snapshotover real isolated Gateway and paired-node WebSockets. It covered:nodeCommandDispatched: false;nodeCommandDispatched: true;GatewayClientRequestTimeoutErrormetadata formethod,timeoutMs, andrequestSent: true.Final structured Codex autoreview used
gpt-5.6-solwith high reasoning and reported no accepted or actionable findings for the source restack (confidence 0.94). A fresh local review of the generated-only addition was also clean (confidence 0.99).