Repository navigation
fix: restore steering across queued and active turns - #158699
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: blocked before merge. Reviewed September 26, 2026, 4:18 PM ET / 20:18 UTC (Revision 8). ClawSweeper reviewWhat this changesThe branch lets eligible corrections reach an active turn despite older queued followups, preserves input identity and authority through fallback and queued execution, and removes consumed messages from the Control UI queue. Merge readiness⛔ Blocked before merge - 2 items remain Keep open. Current main and the latest release still have the queue condition that blocks later steering. The earlier V1 compaction finding is addressed on this head, and this review found no definite introduced defect. Priority: P1 Review scores
Verification
How this fits togetherIncoming chat and agent RPC messages enter Gateway admission, which either steers the active agent run or queues a followup. Session receipts then inform the Control UI's pending-message view. flowchart LR
A[Incoming chat or agent request] --> B[Gateway admission]
B --> C{Steering eligible?}
C -->|Yes| D[Active run injection]
C -->|No| E[Ordered followup queue]
D --> F[Session receipt]
E --> F
F --> G[Control UI pending view]
Before merge
Agent review detailsSecurityNone. PR surfacePR surface statistics unavailable: the file list is incomplete. Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep steering with the live run owner, preserve original input identity through queued execution, and derive pending UI state from authoritative receipts. Do we have a high-confidence way to reproduce the issue? Yes. Current-main source deterministically makes an older followup suppress later steering; the linked Control UI report also records the resulting queue behavior. I did not execute a current-main reproduction. Is this the best way to solve the issue? Yes. The branch changes the admission and receipt owners directly, retains ordered fallback, and keeps legacy injection blocked during compaction. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 915e37b7ddcb. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (7 earlier review cycles)
|
3d944e6 to
892372d
Compare
|
f0d0cf1 to
a705410
Compare
|
@clawsweeper re-review The V1 compaction finding is resolved in a705410: only guarded V2 injection can steer during compaction. The available-V1 regression fails before the fix and passes afterward without backend dispatch; built-in and native Codex automatic-compaction steering remains covered. All 168 refreshed backend cases and the unchanged 243-case UI file passed. The branch also incorporates the existing main fixes for the Bun GC runtime routing and OpenRouter line-limit guard. There are no configuration, schema, or storage-format changes. Current proof and CI are in the updated PR body. |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
* fix: restore steering across queued and active turns Keep eligible corrections steerable despite older followups. Retain source identity across promoted turns and Gateway principals, preserve authority through automatic routing changes, and reconcile consumed queue entries. Explain steering rejection, cancellation, and admission wait outcomes. Co-authored-by: NianJiuZst <[email protected]> Co-authored-by: sxh313 <[email protected]> Co-authored-by: anyech <[email protected]> * test(ui): capture group defaults menu failures Capture bounded menu and popup state before the browser context closes when the group-defaults flow fails. Preserve the original assertion, timeout, and error so a future CI failure supplies the evidence missing from the initial run. * test(gateway): use valid client for delegated handoffs Build the trusted handoff fixture through the production synthetic-client constructor instead of casting a partial client without required connection metadata. Preserve all handoff and model-selection assertions. * fix: require guarded injection for compaction steering * test(gateway): exercise completion during automatic compaction Replace the obsolete compaction-retry rendezvous with real post-turn automatic compaction and held transcript preparation. Match the production deferred lifecycle owner, and preserve live, revoked, and replaced-source final-effect assertions without increasing timeouts. --------- Co-authored-by: NianJiuZst <[email protected]> Co-authored-by: sxh313 <[email protected]> Co-authored-by: anyech <[email protected]>
|
Follow-up from the continued steering audit: a terminal item-only tool activity could still show Running while its parent turn continued. The correction preserves Outcome unknown when an end event has no outcome receipt; explicit failed, blocked, completed, and running statuses keep their existing behavior. The original browser regression reproduced before the fix (15.31s). The repaired live/history scenario and running-to-failed sibling pass (2 cases, 15.78s), as do all 66 card tests (7.61s), selected changed checks (380.72s), and independent review through P2. Existing contradictory fixtures now distinguish start/update activity from terminal activity. No new test cases, timeout increases, or fabricated result receipts. These inspected captures use the actual Control UI with a synthetic Gateway in Chromium 153.0.8010.12. The parent turn is active in both. This is local browser proof, not a deployment to an operator Gateway. The local candidate was not pushed: a canonical owner repair landed on main during final qualification. Update: main now contains canonical fix
|


Closes #148731
Closes #155451
What Problem This Solves
Fixes corrections getting stuck behind queued messages during an active conversation, and consumed messages reappearing above the composer after reconnecting.
User Impact
Each eligible new correction can steer the active turn even when an older message needs a followup. Promoted followups retain their original input identity, so historical completed replies no longer incorrectly block new steering. Automatic account rotation, model fallback, and automatic compaction preserve compatible steering. Steering during compaction requires the guarded V2 injection contract; legacy V1 backends continue to reject it.
Actual followups remain ordered. Explicit model/account changes, changed permissions, unsupported input, and completed or replaced owners still require a followup. Direct background turns with optional replies leave new human input for a turn that can answer it. Uncertain accepted input is never replayed automatically. No configuration or storage migration is required.
Why This Change Was Made
One rejected steering attempt previously disabled later attempts behind that queue. Separately, followup execution omitted the source identity used by the final-reply guard. Each admission now makes its own decision while preserving ordering among unresolved admissions and applying the configured queue cap after those decisions settle.
Command-owned runs expose their existing admitted execution owner to the same steering and transcript-commit path. Captured Gateway principals also retain their original operator comparison identity: the same authenticated browser must not look like a different source merely because its request was adapted. Live authority and revocation checks remain mandatory; copied client labels cannot establish that identity.
Compaction admission now requires a V2 backend that can revalidate authority at final dispatch. An available V1 sink is insufficient: the Copilot V1 adapter can await after send entry without that assertion. Built-in and native Codex V2 steering during automatic compaction remain supported.
The UI reconciles queued chips with authoritative pages and exact receipt lookups. Cancellation logs identify the cause, incoming input, and active run separately, and dispatch timing identifies the admission wait that caused a delay.
Evidence
Current candidate:
b8cce568519cb40bf86b6b3190424a09a6eb174d. Exact-head CI passed, includingopenclaw/ci-gateand every previously failing type-check and Node test group. GitHub required checks remain enforced.queued: true, and passes afterward withreason: "compacting"and no backend dispatch. Native Codex automatic-compaction steering still passes. The focused V1 regression took 34.15s including its wrapper; the refreshed embedded and native Codex suites took 40.78s and 53.58s in Vitest, respectively.git diff --checkpassed for the V1 repair. Independent Codex review found no accepted actionable issue in that repair. The complete scoped changed-check command also passed on the preceding published candidatea705410d776c: all 25 core test type-check groups, production types, formatting, lint, dead-export scans, and the import, storage, dependency, and other selected owner guards. Earlier runtime bundles and SDK boundary declarations passed. The complete scoped changed-check command also passed for the subsequent native-completion fixture repair, including Gateway test types, formatting, lint, static guards, and all three dead-export scans.After incorporating the Cron fixture repair below, the five PR commits are patch-identical by
git range-diff; there is no overlap between the PR’s 93 files and the incorporated main changes. The refreshed native-completion, direct-command steering, and pending-input pagination suites pass all 27 cases (53.96s wrapper).CI failures were investigated at their owners:
Initial CI failed an unchanged session-group worktree-option icon lookup, then cancelled unfinished jobs. The original 80-file shard passed locally with all 383 cases (282.41s), and the affected file passed independently (10 cases, 26.69s); these replays do not establish a fix. The diagnostic follow-up captures allowlisted menu, role, visibility, and popup state before browser teardown. A controlled failure verified capture and preservation of the original error (35.52s), then the full bundled browser file passed 10/10 cases (23.394s test time / 122.98s wall). Assertions and timeouts are unchanged. The next CI run passed all nine UI E2E jobs; the original icon-lookup failure remains unexplained, and future failures retain the missing evidence.
That run exposed a reproducible Gateway fixture failure: a delegated-handoff case cast a client without required connection metadata. The fixture now uses the existing synthetic-client constructor. The original two-file project reproduced one failure among 373 cases (308.16s); all 373 passed after repair with the CI worker setting (392.47s). Authorization assertions and production behavior are unchanged. Gateway test types, lint/format checks, and independent review passed.
CI on the fixture repair then failed one of 8,549 UI cases: the closed-pane GC test retained a weak reference under Bun. Its merge base lacked the already-merged runtime routing fix in feat: curate plugin categories and add Computer use discovery #158686 (
7f41da0c7e42), which routes this GC-sensitive file to Node. The branch now inherits that owner fix. The original test and its assertions remain unchanged; no skip, timeout increase, or new runtime exception is added by this PR.The local max-lines guard exposed an unrelated OpenRouter suppression whose baseline entry had been removed. The branch incorporates the merged owner fix in fix: restore OpenRouter test line-limit checks #159039 (
274668662570), which moves the Fusion cases to a sibling test file and removes the suppression. No baseline expansion or suppression is added here.CI on
a705410d776cfailed only Node groupcompact-small-12: its 57-file subgroup passed 751 cases and timed out in three native-completion compaction cases at 120 seconds. Local replay reproduced the first identical timeout. The fixture awaited an announce-retry delay that guarded V2 steering no longer enters. The test now exercises real post-turn automatic compaction and holds recorder preparation through the productiondeferTerminalLifecycleowner. All nine cases and their authority, no-write, transcript, queue, and deduplication assertions remain. The repaired file passes 9/9 (18.89s Vitest / 23.09s wall), and fresh independent review found no actionable P2-or-higher issue. The original 57-file subgroup replay passed 753/754 cases in 282.00s, including all repaired compaction cases. Its sole failure was an unchanged desktop Unix-socket fixture: the nested local temporary path was 107 bytes, exceeding the macOS socket-path limit. That exact case passed with a shorter private temporary directory (9.76s Vitest / 12.89s wall); it had passed in the Linux CI run. No assertion, timeout, skip, or socket fixture was changed. Scoped checks passed.CI on
76efe9052f18exposed a separate main integration break: newly landed Cron history and startup fixtures omitted the scheduler required by refactor(cron): move due timers into the Gateway scheduler #159099. The two type-check groups and seven history tests failed. This was reproduced on clean main; the local repair passed all 13 affected cases, both type graphs, changed checks, and independent review. The branch now incorporates the completed upstream repairc0e6951d6f02(including its deterministic scheduler clock and real scheduling-failure injection), which records 3,400 passing cases and all 25 test type-check groups. No Cron production fallback or new exception is added to this PR.A Codex acknowledgement or transcript commit does not prove that a later model request observed the input. This patch preserves that distinction and does not add ACP mid-turn input support. Gateway and browser proof uses isolated local state, synthetic fixtures, and controlled model execution.
Measured test costs and review resolution
Historical per-file wall time from the supported runner with
--maxWorkers=1; these values include compilation/setup. Counts below describe that campaign, before upstream test consolidation; the refreshed counts above describe the current affected suites. The reply-agent E2E file includes a one-time fresh runtime build (851.2 seconds). The inspected CI runs are linked above. Completed jobs includepreflight93s,security-fast43s, andcontrol-ui-performance108s. UI E2E shard 8/9 took 371.62s: 382 cases passed and one failed atsession-management.group-defaults.e2e.test.ts:201. The failure was a missing visiblemenuitemradioicon lookup, outside this PR's UI changes. The original job uploaded no failure diagnostics; the follow-up adds capture before teardown without changing product behavior, assertions, or timeouts. The original shard was replayed with the same include list, shard index, and worker count; all 383 cases passed locally. Remaining test-shard timings are incomplete because fail-fast cancelled them.extensions/codex/src/app-server/run-attempt.steering.test.tssrc/agents/agent-command-execution-identity.test.tssrc/agents/command/attempt-execution.cli.test.tssrc/agents/embedded-agent-runner/runs.steering.test.tssrc/agents/embedded-agent-runner/runs.test.tssrc/agents/harness/tool-authority.runtime.test.tssrc/agents/model-fallback.live-switch.test.tssrc/agents/model-fallback.probe.test.tssrc/agents/model-fallback.test.tssrc/agents/outcome-fallback-runtime-contract.test.tssrc/auto-reply/reply/agent-runner-execution-probes.test.tssrc/auto-reply/reply/agent-runner-fallback-steering.test.tssrc/auto-reply/reply/agent-runner-source-identity.test.tssrc/auto-reply/reply/agent-runner.runreplyagent.e2e.test.tssrc/auto-reply/reply/followup-turn-execution.steering.test.tssrc/auto-reply/reply/get-reply-run-admission.session-file.test.tssrc/auto-reply/reply/queue-policy.test.tssrc/auto-reply/reply/queue/enqueue.steering.test.tssrc/auto-reply/reply/reply-run-registry.abort.test.tssrc/auto-reply/reply/reply-run-registry.test.tssrc/auto-reply/reply/reply-timing-tracker.test.tssrc/auto-reply/reply/reply-tool-authority.test.tssrc/config/sessions/restart-recovery-receipt.test.tssrc/config/sessions/session-accessor.pending-inputs-consumed.test.tssrc/config/sessions/session-accessor.pending-inputs.test.tssrc/gateway/chat-queued-turns.test.tssrc/gateway/operator-run-authority.worker.test.tssrc/gateway/operator-run-cancellation.test.tssrc/gateway/server-methods/chat-send-message-injection.isolated-gateway.test.tssrc/gateway/server-methods/chat-send-message-injection.test.tssrc/gateway/server-methods/chat-send-pending-inputs.test.tssrc/gateway/server.chat-steer-direct-command.test.tsui/src/pages/chat/chat-pending-inputs.pagination.test.tsui/src/e2e/session-management.group-defaults.e2e.test.tsThe browser scenario took 15.62 seconds (113.92 seconds including its wrapper); the four-file UI group took 83.74 seconds. The strengthened pagination cases passed independently and again in the combined run.
Independent Codex review completed. An earlier finding proposed stripping an OpenRouter model prefix; it was rejected because
normalizeBuiltInProviderModelIdexplicitly adds this prefix for bare OpenRouter IDs, and all eight live-switch cases passed. The later V1-compaction finding was accepted, reproduced, repaired, and independently reviewed as described above. No accepted actionable findings remain in the reviewed changes. Initial fixture/model-registry and authority-projection failures were diagnosed and repaired, rather than hidden with retries or longer timeouts. The attempted remote validation setup did not complete; all manually run passing evidence cited here is local. GitHub CI outcomes are identified separately above. No live Gateway deployment is claimed.Thanks to @NianJiuZst, @sxh313, and @anyech for the related account-rotation, lifecycle-probe, and model-fallback investigations in #138516, #154868, and #151627.
Follow-up audit: terminal tool outcome repair and before/after browser proof.