Repository navigation
fix(gateway): steering a session while its worktree is being created is held until the task finishes - #165462
Conversation
Only mark explicit steering rejected when admission captured an injection target. A steer admitted before the initial reply owner exists can then use normal steering admission when workspace preparation finishes. Preserve existing queued follow-up terminal and cancellation semantics. Add real-handler coverage for accepted, unavailable, and rejected backends, including exactly-once transcript persistence. The regression fails on the original condition and passes after the fix; its three cases take 47.77 seconds command wall, with 38 sibling cases passing separately.
|
🦞👀 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 October 5, 2026, 5:31 AM ET / 09:31 UTC (Revision 2). ClawSweeper reviewWhat this changesThe PR lets messages sent with Steer during worktree preparation attempt delivery to the initial turn once its runtime becomes ready, with regression coverage and documentation. Merge readiness✅ Ready for maintainer review The fix remains necessary on current main. The narrow production change preserves existing steering safeguards and follow-up custody, and the updated assertions match targetless admission. No blocking correctness finding was identified. Priority: P2 Review scores
Verification
How this fits togetherGateway chat admission accepts session messages before workspace preparation finishes. The reply owner then either steers the message into the active turn or retains it for a follow-up. flowchart TD
A[Steer message] --> B[Gateway admission]
B --> C[Workspace preparation]
C --> D[Reply owner]
D --> E{Runtime accepts steering?}
E -->|Yes| F[Initial turn and transcript]
E -->|No| G[Follow-up queue]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource 0, Tests +337, Docs +3. Total +340 across 4 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Let the existing reply owner make the first steering attempt after preparation, preserving exact-target authorization and exactly-once follow-up delivery when injection is unavailable. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the failure path: send an explicit steer while initial worktree preparation has no reply owner; current main pre-labels it rejected and the reply runner skips late injection. No runtime reproduction was executed in this review. Is this the best way to solve the issue? Yes, the condition repairs the incorrect disposition at its producer and reuses the established steering owner without changing queue, protocol, configuration, or storage contracts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 10080eaf91bc. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
|
Post-merge live verification on main 500c95a showed this did not fix the common live ordering: a steer sent ~2 s after |
…is held until the task finishes (openclaw#165462) * fix(gateway): attempt pre-start steering after workspace preparation Only mark explicit steering rejected when admission captured an injection target. A steer admitted before the initial reply owner exists can then use normal steering admission when workspace preparation finishes. Preserve existing queued follow-up terminal and cancellation semantics. Add real-handler coverage for accepted, unavailable, and rejected backends, including exactly-once transcript persistence. The regression fails on the original condition and passes after the fix; its three cases take 47.77 seconds command wall, with 38 sibling cases passing separately. * test(gateway): align targetless steering admission expectations
What Problem This Solves
Fixes: a message sent with Steer while a new session is still creating its worktree ("Creating worktree…") never reaches the running task; it is silently held until the task finishes and then runs as a separate follow-up turn.
User Impact
User impact: steering during worktree preparation now joins the session's first turn as soon as the runtime is ready, the same as steering any running turn. If the runtime cannot accept it, the message still runs once as a follow-up (unchanged). No config, protocol, or storage change.
Why This Change Was Made
chat.sendwithqueueMode: "steer"pre-labels the input as already rejected for injection. That is right when admission found the active reply to inject into and the attempt failed, but during worktree preparation the first turn has no reply owner yet, so no injection was ever attempted; the reply runner then skipped its normal steering attempt and queued the message. The label is now applied only when admission actually captured an injection target, so the existing reply owner makes its first attempt once preparation finishes.The queued-follow-up acknowledgement semantics (the returned run id is finalized when the input is queued, and the follow-up executes under its own run id) are intentionally unchanged here; that is existing tested behavior.
Evidence
Live (dev Gateway, OpenAI provider, one agent on the built-in runtime and one on the Codex runtime): five parallel
sessions.create {worktree: true, message}calls; while each was "Creating worktree…" (the global allocation lease made this 10–70 s), achat.send {queueMode: "steer"}returnedstartedafter ~6 s. Both steers (one per runtime) were missing from the transcript while the original task ran, then appeared after its final answer and ran as a new turn; the original task never saw them.Regression through the real
sessions.create+chat.sendhandlers, pending worktree preparation, reply admission, queue custody, and transcript persistence (synthetic backend acceptance; no provider):Siblings unchanged and passing:
chat-send-message-injection.test.ts,chat-send-steering-custody.test.ts(38 tests). Gateway test types, scoped lint, formatting, ratchets, andgit diff --checkpass.Production +1/−1; new regression tests +337 (one new file, three cases); two existing assertion sites updated; docs +3. The test is seconds-long because it crosses
sessions.createworktree preparation andchat.sendadmission, which no cheaper layer composes.CI follow-through: run 37286694017 (attempt 1) found three outdated
chat.directive-tags.test.tsassertions at two sites: targetless admission must leavemessageInjectionDispositionabsent, rather than pre-label it rejected. Updated those assertions while retaining the dispatch, stale-owner, and transcript checks. No additional production change.Corrected candidate proof: all four focused files (
chat.directive-tags,chat-send-prestart-steer,chat-send-message-injection, andchat-send-steering-custody) pass: 171 tests, 207.69 s command wall on this host. Formatting, scoped lint, andgit diff --checkpass. Independent Codex autoreview of the complete candidate is scoped-clean through P2.