Repository navigation
fix(gateway): restore missing-admission refusal and update 3 gateway tests broken on main - #196702
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs real behavior proof before merge. What this changesThis PR rejects already-persisted worker input without a canonical admission receipt, updates stale Gateway expectations, and adds paired-node QA coverage. Example: A worker turn carries the persisted message "current request" but no canonical admission receipt.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 1 item remains Keep this PR open: it repairs concrete Gateway test regressions and restores a focused admission invariant without undoing intended policy ordering. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherThe Gateway worker-input owner combines a turn's recorder and transcript admission into model history and a launch base; worker execution then acquires credentials, opens a tunnel, and dispatches the turn. flowchart TD
A[Chat or channel input] --> B[Transcript recorder]
B --> C[Worker input context]
C --> D[Credentials and tunnel]
D --> E[Paired node supervisor]
E --> F[Worker admission and model]
F --> G[Transcript and reply]
Technical reviewBest possible solution: Keep the refusal in the existing worker-input owner and retain the test updates that follow the merged sharing, worktree, and policy contracts. Do we have a high-confidence way to reproduce the issue? Current-main source lacks the refusal exercised by the existing missing-admission regression; the PR reports bisected test failures, but this read-only review ran no target code and establishes no reachable user-path bypass. Is this the best way to solve the issue? The four-line guard is the smallest production repair using the existing owner, and the expectation changes preserve the intended contracts of the merged changes. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 109b0cc2e9b5. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +4, Tests +555, Other +29. Total +588 across 6 files. Added test files: 1. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label changes. Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (3 earlier review cycles)
Reviewed November 10, 2026, 12:25 PM ET / 17:25 UTC (Revision 4). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
9dcd1ba to
3fa0518
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Since d53921a (#194129), a broad sessions catalog notification no longer invalidates retained sharing facts; the commit guard rereads membership and refuses the fork with SESSION_PARTICIPATION_REQUIRED, matching the writer-fault variant. The fork still fails with SessionMutationAuthorizationChangedError and leaves storage unchanged. Co-authored-by: obviyus <[email protected]>
d7aaafe (#196337) deferred legacy worker input persistence until after the policy gate and dropped the missing-admission check with the early persistence path. Input that the runtime already persisted without a readable canonical anchor then acquired credentials, started a tunnel and launched from the stale leaf. Restore the fail-closed check before credentials for already-persisted input; unpersisted input is still admitted after the gate. Update the detached-context fixtures for the intended ordering: unpersisted input reads its prefix through the transcript open, so the authority-change probes hook that read. Co-authored-by: obviyus <[email protected]>
…e path Add a QA script scenario that dispatches a managed-worktree session to a proof-owned paired-node worker through an isolated Gateway and exercises the production credential, transport and launch path: - chat.send and qa-channel turns with a readable admission launch once, reach the mock model once and commit their reply; - cancelling the run or reclaiming the placement while the launch frame is held on the node makes the Gateway cancel the launch before the node handles it: no worker process starts, the model sees no request and no worker transcript or live event is acknowledged. Co-authored-by: obviyus <[email protected]>
3fa0518 to
ecf9170
Compare
…tests broken on main (openclaw#196702) * test(gateway): expect participation refusal after retained sharing facts Since 4d6df47 (openclaw#194129), a broad sessions catalog notification no longer invalidates retained sharing facts; the commit guard rereads membership and refuses the fork with SESSION_PARTICIPATION_REQUIRED, matching the writer-fault variant. The fork still fails with SessionMutationAuthorizationChangedError and leaves storage unchanged. Co-authored-by: obviyus <[email protected]> * fix(gateway): reject worker turns with persisted input but no admission 1acafee (openclaw#196337) deferred legacy worker input persistence until after the policy gate and dropped the missing-admission check with the early persistence path. Input that the runtime already persisted without a readable canonical anchor then acquired credentials, started a tunnel and launched from the stale leaf. Restore the fail-closed check before credentials for already-persisted input; unpersisted input is still admitted after the gate. Update the detached-context fixtures for the intended ordering: unpersisted input reads its prefix through the transcript open, so the authority-change probes hook that read. Co-authored-by: obviyus <[email protected]> * test(qa): prove worker turn admission and authority on the paired-node path Add a QA script scenario that dispatches a managed-worktree session to a proof-owned paired-node worker through an isolated Gateway and exercises the production credential, transport and launch path: - chat.send and qa-channel turns with a readable admission launch once, reach the mock model once and commit their reply; - cancelling the run or reclaiming the placement while the launch frame is held on the node makes the Gateway cancel the launch before the node handles it: no worker process starts, the model sees no request and no worker transcript or live event is acknowledged. Co-authored-by: obviyus <[email protected]> --------- Co-authored-by: obviyus <[email protected]>
Adopt the original repair from #196487 while preserving its branch history. Carry forward the independently validated context reader, focused regression proof, documentation, and synthetic timing/allocation measurements. The final tree matches 68aac2c exactly. Keep the current admission and unrelated Gateway test repairs already landed through #196702 and #196889. No runtime source change was added in adoption. Co-authored-by: RomneyDa <[email protected]>
Expose the exact prepared image snapshot to input policy hooks across embedded, CLI, and Gateway worker runners. Reuse CLI prepared input across retries and isolate hook mutations from submitted input. Release adaptation: retain the existing hook type owner and runtime generation scope. Include the required missing-admission refusal from #196702, selected-branch recorder hydration from #196487, and deferred context-admission assertions from #197210. Do not import unrelated session rewind, prompt continuity, or cold-start owners. Selected source commits: (cherry picked from commit d7aaafe) (partial companion from commit e212ede) (partial companion from commit ebf6c06) (partial companion from commit eafa247) Co-authored-by: obviyus <[email protected]> Co-authored-by: Peter Steinberger <[email protected]> Co-authored-by: RomneyDa <[email protected]>
What Problem This Solves
Fixes: 8 gateway tests in two files fail on main (a ninth, in
server.sessions.create-worktree-spawn.test.ts, was since fixed on main by #196889). Main CI only runs tests affected by each change, so they went red unnoticed and now block unrelated PRs (seen on #196480). One of them covers a fail-closed check that #196337 removed.User Impact
User impact: none visible today. The restored check refuses a cloud worker turn whose input is already persisted but has no readable canonical admission, before credentials, tunnel or launch. Real-path testing (below) shows current input paths never reach that state, so this restores defense in depth rather than closing a reachable hole. The other changes update tests to intended behavior.
Why This Change Was Made
Each failure was bisected between
802ddc7(all pass) and main (all fail); each culprit passes on its parent and fails on the commit.worker-turn-detached-context.test.ts, first badd7aaafe(fix: let input policy hooks inspect prepared images #196337): production fix. Removing the early legacy-worker persistence path also dropped theno readable canonical user admissioncheck. Restored for already-persisted input, before credentials (worker-turn-user-message.ts, +4 lines). Unpersisted input is still admitted after the policy gate, as fix: let input policy hooks inspect prepared images #196337 intends. The other 6 tests in that file encoded the old ordering: the gate now needs prepared images, so credentials and tunnel come first. Their authority-change probes now hook the transcript open that unpersisted input uses; all still refuse credentials, tunnel and launch.sessions-rewind.storage.test.ts, first badd53921a(fix(gateway): shared-session runs lose access after session list updates #194129): test update. Retained sharing facts now survive the broad sessions notification, so the commit guard refuses with the more specificSESSION_PARTICIPATION_REQUIRED(still aSessionMutationAuthorizationChangedError, storage unchanged).Evidence
Unit and integration:
server.sessions.create-worktree-spawn,worker-turn-admissionandworker-turn-execution: 137/137 pass (clean env, rebased on240d0ac). Before: 8 failures on current main.tsgo:core,tsgo:core:testand the test-lines ratchet pass.Real paired-node path (new
qa/scenarios/runtime/cloud-worker-admission-authority.yaml): isolated QA Gateway, mock-openai provider, a real paired node, real worker bundle install, supervisor and worker process, managed-worktree session. Credentials, tunnel, dispatch and launch are production code; the proof only holds frames and calls public RPCs. Modeworker-turn-admission-v1:Revocation is applied while the node holds the turn's
worker.launch.v1frame (chat.abortfor the run, orsessions.reclaim); the Gateway sends its ownworker.cancel.v1, and the stale launch then reaches the real node handler without starting a process or a model request.Not reachable on the real path, without adding production test seams:
chat.sendand qa-channel input are staged, not written, for a session placed on a worker (reply-input-placement.tssetsstagedWorkerInput;chat.historyread while the launch frame is held shows no user row in every case).recorder.hasPersisted()is therefore false whenreadWorkerTurnInputContextruns. The state only arises from a user row that commits off the active path between commit and anchor read (resolveCommittedUserTurnTranscript), a window inside the Gateway that no RPC can pause. That is why this PR describes the check as defense in depth.worker-turn-admission-v1(WORKER_PROTOCOL_FEATURESinserver-worker-environment-startup.ts), andadmission.tsrejects any worker whose features differ, so no accepted worker runs the!workerAdmissionbranch.For the #196337 author: the restored check also applies to modern worker-admission turns, which previously skipped it, so a persisted modern turn without a receipt now fails closed. Separately,
persistWorkerTurnInputstill falls back to?? baseLeafIdwhen post-gate persistence yields no receipt; the old legacy path rejected there. Left unchanged here.