Repository navigation
fix: worker input waits safely during setup and workspace sync - #137576
Conversation
2512f27 to
1ac0bad
Compare
|
🦞👀 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 maintainer review before merge. Reviewed September 9, 2026, 1:14 AM ET / 05:14 UTC (Revision 11). ClawSweeper reviewWhat this changesThe PR retains accepted messages during worker setup and workspace synchronization, resumes them after admission checks, and shows waiting receipts in chat. Merge readiness✅ Ready for maintainer review Keep open: the reported failure remains on current main and in v2026.9.3. The latest changes address the previous authority finding, and the supplied final-effect evidence supports that repair. No remaining blocking correctness finding was identified. Priority: P1 Review scores
Verification
How this fits togetherThe Gateway holds accepted chat and inter-session messages before assigning execution to a worker. Placement admission coordinates setup, workspace synchronization, and live authority; the Control UI displays the resulting waiting or execution state. flowchart LR
A[Chat or session message] --> B[Durable input custody]
B --> C[Worker placement admission]
C --> D[Wait for setup or workspace sync]
D --> E[Recheck destination and authority]
E --> F[Execute accepted input]
E --> G[Reject cancelled or replaced work]
B --> H[Chat waiting receipt]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +463, Tests +1642, Docs +4, Config +1, Other +8. Total +2118 across 50 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep accepted input under the existing custody and placement owners, with automatic continuation only while destination and execution authority remain current. Do we have a high-confidence way to reproduce the issue? Yes: current-main admission source directly establishes the bounded reconciliation wait followed by terminal rejection. This review did not execute the reproduction. Is this the best way to solve the issue? Yes: the patch repairs existing custody and placement admission rather than adding another retry queue, and the latest changes preserve live authority through final dispatch. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ec7464766fab. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (10 earlier review cycles; latest 8 shown)
|
|
Addressed the review findings in
Local verification:
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Exact-head review requested for |
|
@codex review\n\nPlease review exact head |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 25497bcb65
ℹ️ 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".
…d-reconciliation-ux # Conflicts: # docs/gateway/cloud-workers.md # src/gateway/worker-environments/placement-projector.ts # src/gateway/worker-environments/worker-turn-launcher.ts # ui/src/i18n/locales/en.ts # ui/src/pages/chat/chat-pane-placement-composer.test.ts # ui/src/pages/chat/chat-pending-inputs.ts # ui/src/pages/chat/chat-thread-build.ts
…law#137576) * fix: preserve cloud follow-ups during workspace sync * fix(ui): scope reconciliation follow-ups * fix: project cloud follow-up admission state * fix: repair reconciliation CI coverage * fix: preserve recovery fences and lifecycle send barriers Address cloudrec-26c: return actionable recovery outcomes for claimless retained results and keep Stop, Restart, and Move from reopening composer admission. * test: avoid returning the recovery responsiveness timer * test: correlate cloud-sync proof with the submitted run Ref: cloudrec-f32. Match the browser idempotency key, complete the mocked lifecycle, and assert one user bubble in waiting and resumed states. * fix: hold worker input through initial setup Keep accepted browser and inter-session input in custody until its exact live setup owner publishes an authoritative placement. Revalidate session, writer, runtime and execution authority before workspace IO; preserve cancellation and lifecycle replacement fences. Refs: cloudrec-db3.8, cloudrec-db3.9, cloudrec-db3.11 * fix: recheck run authority after worker reconciliation * fix: fence remote input dispatch with live run authority
Fixes #137539
What Problem This Solves
Fixes an issue where a follow-up submitted during healthy cloud workspace reconciliation could wait 15 seconds, appear interrupted, and show a red error even though reconciliation was still progressing. Users then had to copy and resend the message. The same input loss also affected initial worker setup: a message could be accepted while the workspace was syncing, then become interrupted instead of starting when setup completed.
Why This Change Was Made
The gateway now keeps the durable pending input admitted while the prior workspace-result claim settles, then re-reads the authoritative placement and continues the same run through the existing local, worker, or redispatch path. Initial setup now joins only the exact live dispatch or recovery producer and revalidates session incarnation, writer, runtime, and intended placement before admission. Browser input remains in durable custody until that writer is ready; neither local restart-admission path consumes it early. The Control UI presents setup and reconciliation as busy cloud lifecycles, shows durable receipt custody for the submitted follow-up, and reserves red errors for failed placement states.
User Impact
Users can submit input while an existing worker session is initially provisioning/preparing its workspace or completing normal workspace sync. Initial setup shows
Received · waiting for worker setup; each input starts once after the intended placement becomes ready. Failed, abandoned, superseded, or orphan setup does not silently run on a different worker or locally. Unsent New Session drafts retain their separate startup flow. Stop, Move, and Restart keep the composer blocked until their lifecycle operation completes. The UI immediately showsCloud · syncing files, explains that cloud edits are being applied safely, and displaysReceived · waiting for workspace syncfor the held message. The exact submitted message starts automatically when reconciliation releases the claim, including after a placement reclaim or reconnect, without a parallel retry path or copy/resend step. If a Gateway restart leaves a durable result without a live turn claim, admission reports pending workspace recovery without spinning or discarding the result fence.Evidence
CI repair follow-up
The original CI run 34286832067 tested this branch merged with upstream
a5c83952639827a2694c17f57ceeb9dde9cdbeac. The branch now incorporates that exact tested baseline.Commands:
Initial worker setup extension
Published extension:
a9ba4d2602449f7332431558bd6c0c5b332ac96a.sessions_sendtool; verify two queued inputs; activate; verify two distinct run IDs launch once, custody empties, and both replies display.Reproduce the isolated proof with:
Inspected Chromium captures from the final authority-safe source, using the isolated synthetic-worker fixture:
Earlier post-turn reconciliation evidence
Review follow-up: 40 focused Gateway admission and Control UI composer/status tests passed, including new-run and same-run retries after restart clears claims with retained results and overlapping Stop, Move, and Restart. The new regression assertions failed on the pre-fix code. Fresh independent P0–P2 autoreview of the repair was clean.
Gateway admission and pending-input suites: 57 focused tests passed across placement storage, claim admission, claim closure, and durable browser input custody.
Control UI placement and pending-input suites: 56 focused tests passed.
Browser E2E: slow reconciliation receipt and elapsed status, automatic exact-message resume, receipt removal, and true failure rendering passed in Chromium after rebasing onto upstream
main.pnpm ui:build: passed within the enforced startup JavaScript budget.pnpm check: preflight guards, production/test typechecks, lint, and policy guards passed after rebasing. The repository-wide format step reports 424 unchanged files already present on upstreammain; all 17 files changed by this PR passoxfmt --checkandgit diff --check.Repository autoreview against rebased upstream
main(P0/P1): no accepted or actionable findings after adding claim cleanup for workspace-path resolution failure and immediate handling for already-aborted unbounded waits.Observed slow-sync state: enabled composer,
Cloud · syncing files,Safely applying cloud edits · 2m 21s, andReceived · waiting for workspace sync.Observed resumed state: placement returns active, the custody receipt disappears, and the queued follow-up appears once with an automatic-start response.
Observed true-failure state: red reconciliation failure plus the existing restart action.
Inspected visual evidence
Captured from
bd03e3cc226f794452488bce5396ab772914c3cfin Chromium with synthetic Gateway responses and public GPT-4o fixture metadata. These unaltered, inspected images verify Control UI presentation; they are not live cloud-execution proof. The browser test now correlates custody with the submitted idempotency key, emits the terminal lifecycle event, and asserts that the submitted message appears exactly once in both states.True failure and restart capture · Reproduction command, scope, and image hashes
The capture-enabled browser test passed, as did scoped lint and fresh independent P0–P2 review of the fixture correction. The prior code repair passed all changed-file validation gates (the combined command reached its time limit after typechecks; the remaining policy checks were run separately and all passed).
View the OpenClaw team session
Reconciliation authority follow-up
The late review finding was reproduced: a queued remote-exec input could lose prepared-source or admitted-run authority without an aborted signal, then transfer attachment bytes and invoke execution after workspace reconciliation. Admission now rechecks the existing live run authority after waits and before/after workspace preparation, releasing any acquired claim on rejection.
Regression evidence uses the real placement store, run-authority lifecycle, managed media, and attachment staging commands against an isolated workspace; only the worker transport is synthetic. Revoked cases must leave no attachment files, perform no tunnel or workspace command, and retain an active placement with no claim. The authorized sibling transfers and reads the exact original bytes. This is final-effect boundary proof, not authenticated cloud-provider execution.
node scripts/run-vitest.mjs src/gateway/worker-environments/worker-turn-launcher-reconciliation-authority.test.ts src/gateway/worker-environments/worker-turn-launcher-initial-setup.test.ts src/gateway/worker-environments/worker-turn-launcher-claim-admission.test.ts— 37 tests passed.Final dispatch authority repair
The captured prepared-source/admitted-run assertion now reaches attachment, skill-resource, and node dispatch. New reads/writes require both live run authority and the exact placement claim; cleanup retains placement authority after run revocation. Attachment initialization retains its returned directory identity before observing revocation, so failure cleanup can remove only the created directory.
Final-effect regression coverage uses real admission/placement state, managed media, attachment commands, and isolated filesystem writes; only transport is synthetic. It is not authenticated cloud-provider proof.
The four late-dispatch cases failed on the previous published head. Eight cleanup cases failed before separating cleanup authority. After repair, 141 tests across nine files passed and independent P0–P2 review was clean. The lifecycle CI regression now checks the canonical stale-lifecycle rejection while retaining no-I/O and replacement-run preservation assertions.
Reproduction:
The unrelated browser geometry failure was reproduced on unchanged CI base. Current main has been incorporated, including #142728 (settle geometry before comparison) and #142708 (shipped SDK alias removal policy), resolving the two previously documented baseline blockers without local policy or assertion changes.
Integrated candidate validation: all 141 Gateway tests and 9 browser tests passed after incorporating current main. The formerly failing document-card geometry test and plugin-boundary deadline guard both pass.
Fresh independent review of the complete integrated PR against current main found no actionable P0–P2 defects.
Integration lint exposed a one-line file-length overflow in the transcript projection. Compacting an existing translation call into the formatter-accepted inline layout resolved it without changing runtime behavior. Targeted lint, UI types, and the reconciliation browser regression pass.
Published head:
7879b592599cd212040da9d81e1dfd24a5ae0c60. Required local validation completed: formatting, all selected typecheck lanes, unused-export scans, lint (the sole max-lines finding fixed and targeted rerun passed), style/script lint, platform-helper tests, and remaining repository guards. SwiftLint is delegated to macOS CI on this Linux host. Exact-head hosted CI and review are pending.