Skip to content

fix(sessions): keep steering queued while the target is busy - #160490

Merged
VACInc merged 2 commits into
mainfrom
openclaw/steering-transcript-commit-20260928
Sep 28, 2026
Merged

VACInc merged 2 commits into
mainfrom
openclaw/steering-transcript-commit-20260928

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #160296 (session-control permissions; separate scope).

What Problem This Solves

Fixes sessions_send(mode="steer") withdrawing valid guidance after 30 seconds when the receiving built-in run is still busy.

User Impact

Explicit steering acknowledges admission without waiting for a busy model response or tool to finish. The receiving run retains exact-message cleanup, so pending guidance is not carried into a later unrelated turn after abort or handoff.

Acceptance is not proof of transcript persistence or model consumption, and the in-memory queue is not made restart-durable. Existing authorization, explicit cancellation, and already-submitted-input limits remain. No new settings, timeout increase, schema change, merge, or deployment.

Why This Change Was Made

The admission-only tool path requested a transcript-commit receipt using the reply-wait deadline. Expiry canceled the queued message before the receiving run could consume it.

The correction uses the existing steering lifecycle rather than adding a queue: explicit admission returns after enqueue, releases the completed caller’s deadline/listeners, and leaves commit or terminal cleanup with the receiving session. Calls requesting transcript confirmation keep their existing bounded wait; omitted options retain their existing behavior. Native Codex steering owns a separate queue contract and is unchanged.

Evidence

  • Before: both explicit-steer cases fail through the real session-send tool and AgentSession when a virtual clock crosses 30 seconds with the target response held. Both non-steer control cases pass.
  • After: 92 focused cases pass: tool/SQLite persistence boundary (4), queue lifecycle (16), real session lifecycle (23), ordinary session tools (40), and dispatch admission/refusal (9). The tests prove admission before consumption, persistence exactly once after release with provenance intact, no extra target run, and retention of unrelated queued input. No production session was steered or stopped.
  • Independent review identified a terminal-cleanup regression in the initial draft. A real abort/new-prompt negative control reproduced it; the corrected lifecycle now passes that control and commit/settled/handoff cleanup cases.
  • Prior-head independent P2 review had no actionable findings. Production types, the three affected test-type graphs, type-aware lint, formatting, line-cap and whitespace checks passed on that head.
  • ClawSweeper’s 16:27 UTC exact-head review on f7701d22708d6e31beb1158cbecaec68fb2f67f8 is Ready for maintainer review, with no patch or security finding and no before-merge item.
  • Prior-head hosted CI was not green on ac18338c2322b323ad8b22743a9b299300986ad9; these results do not describe the merged head. Run 36436170082 has two originating failed UI jobs and a failed aggregate gate; 36 sibling jobs were canceled by fail-fast, so they are not passing proof. No CI rerun or unchanged re-push was used.
  • UI E2E 6/9: all three cases in ui/src/e2e/chat-user-avatar-alignment.e2e.test.ts time out waiting for .chat-group.user .chat-avatar:visible. The same three cases and locator fail in PR #156479's UI E2E 6/9 job, on head cc27e0f5772e1d231eb5bcf68fcd399b73e6ce3d. This is independently observed on another PR.
  • UI E2E 3/9: does not reuse catalog reasoning for a different session runtime in ui/src/e2e/chat-flow.models-reasoning.e2e.test.ts times out waiting for a visible thinking slider; the locator resolves to a hidden input. I did not find the same case failing in the nearby PR runs inspected. Its independent recurrence remains unproven.
  • This PR changes only src/agents/ and docs/concepts/session-tool.md; neither failing UI test nor its UI implementation is in the branch diff. The executed merge fc1d7e15e9446f861e4a042e6a95c77d8659fe3a has the same ui/ tree as its main parent 670415932ee7dc54d3d59c2e00870f55ed54004c. These UI reds are outside this PR's changed files. They remain reported here for the separate flake-fix work; no UI test was edited, and this PR is not claimed CI-green or merge-ready.

Main conflict integration (current head)

  • Merged origin/main at 4902e4ae49a669702b92a1df3aeb01b167ec6715 once, creating f7701d22708d6e31beb1158cbecaec68fb2f67f8. The sole conflict was docs/concepts/session-tool.md. Its resolution keeps main's sessions_send access-check statement and this PR's admission, delayed transcript, and cancellation limits. src/agents/tools/sessions-send-tool.delivery.ts merged automatically; main's session-creation path and this PR's steering receipt both remain.
  • Current-head local proof: 131 focused tests passed across steering, queued-message lifecycle, AgentSession next turn, sessions-send admission/A2A, and ordinary sessions tools. Production and test TypeScript graphs, scoped lint, formatting, and whitespace checks passed. A pinned-tree P2 autoreview found no actionable defects. No production Gateway was steered or stopped.
  • The two browser failures above belong to the prior head. Current-head CI run 36450284408 completed with 156 passing jobs, 21 skipped, two originating failed jobs, and a failed aggregate gate. The PR is not claimed CI-green or merge-ready. No job rerun, unchanged re-push, timeout increase, or assertion weakening was used.
  • Current-head check-source-contracts fails lint:tmp:export-name-collisions on names including assertForegroundUpdateOrigin and runDaemonInstall in src/cli/daemon-cli.ts and other src/cli/ / src/infra/ owners. Those files are byte-identical to merge parent 4902e4ae49a669702b92a1df3aeb01b167ec6715 and are outside this PR's six-file diff. The same guard and names fail in PR #160527 and PR #160495.
  • Current-head UI E2E 7/9 fails 20 side-chat input focus cases in ui/src/e2e/chat-session-companion-focus.e2e.test.ts after control-ui-e2e-suite.test-support.ts reports scenario cleanup did not settle within 180000ms. Both UI files are unchanged from that merge parent and are outside this PR's diff. I did not observe the same cleanup failure in the nearby PR jobs sampled; independent recurrence is unproven. These failures remain for separate CI repair, with no UI test edited here.

Test cost

Measured with the repository test wrapper and --maxWorkers=1:

Changed test file Cases Command wall Vitest duration
openclaw-tools.sessions-steering.test.ts 4 34.49 s 8.07 s
attempt.queue-message.test.ts 16 7.64 s 5.86 s
agent-session-loop-next-turn.test.ts 23 11.59 s 9.78 s

Command wall includes import/compiled-worker preparation; reported test execution is below five seconds per file. The 30-second boundary uses a virtual clock, not a sleep. Existing timeouts, assertions, queue order, and cancellation coverage are retained. Hosted CI stopped on the browser-only failures above; local per-file timing is the available scoped cost evidence. No full-suite or native Codex timing change is claimed.

Worked on by

Work sessions


View the OpenClaw team session

Inherited CI failures (admin exception)

Exact-head run 36450284408 (head f7701d2) is red only in:

  • check-source-contracts (lint:tmp:export-name-collisions): duplicate exports introduced on main by 5de949fc462 (src/cli/daemon-cli.ts vs src/cli/daemon-cli/*), reproduced on clean main; a forward fix is being prepared separately. This PR touches none of those files.
  • checks-ui-e2e (7/9): ui/src/e2e/chat-session-companion-focus.e2e.test.ts cleanup timeout, red in 8 other recent PR runs and in main's own scheduled runs since d769e31; mock-Gateway UI test, this PR changes no ui/ code.

ClawSweeper Revision 5: no findings. Landed under the AGENTS.md pre-existing-red exception by the maintainer.

Acknowledge explicit steering admission without withdrawing it at the reply
wait deadline. Keep exact-message terminal cleanup with the receiving run.

Worked on by:
- @VACInc

Co-authored-by: VACInc <[email protected]>
@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling size: S labels Sep 28, 2026
@roboclaw-bot
roboclaw-bot marked this pull request as ready for review September 28, 2026 14:22
@roboclaw-bot roboclaw-bot reopened this Sep 28, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 28, 2026
@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 28, 2026, 12:27 PM ET / 16:27 UTC (Revision 5).

ClawSweeper review

What this changes

The branch makes explicit cross-session steering return after queue admission, retains cleanup of unconsumed guidance when the receiving run ends, and updates tests and session-tool documentation.

Merge readiness

✅ Ready for maintainer review

Current main still waits for transcript commitment on explicit steering and can withdraw queued guidance when that wait expires. The branch addresses the documented admission behavior, and this review found no actionable patch defect.

Priority: P2
Reviewed head: f7701d22708d6e31beb1158cbecaec68fb2f67f8

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The focused patch has meaningful assembled-tool and terminal-cleanup coverage, with no identified correctness or security defect.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The host identifies this as a MEMBER-attributed bot PR, outside the external-contributor proof gate. The reported current-head checks exercise the assembled session-send tool, an AgentSession, and SQLite readback after a held response; no live Gateway run or stored-data contract change is claimed.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The host identifies this as a MEMBER-attributed bot PR, outside the external-contributor proof gate. The reported current-head checks exercise the assembled session-send tool, an AgentSession, and SQLite readback after a held response; no live Gateway run or stored-data contract change is claimed.
Evidence reviewed 9 items Current-main behavior: Current main requests transcript-commit waiting for active-run delivery, including explicit steering.
Current-main timeout: The existing transcript-wait timer cancels the exact queued steer when the deadline expires.
Documented contract: Current-main documentation describes explicit steering as an admission-only result governed by the existing session-send access checks.
Findings None None.
Security None None.

How this fits together

The session-send tool checks access before passing guidance to an active agent run. The receiving session queues that guidance, then consumes and records it at a steering boundary or removes it when the run ends.

flowchart TD
  A[Agent sends guidance] --> B[Session access check]
  B --> C[Active run admission]
  C --> D[Steering queue]
  D --> E[Next steering boundary]
  E --> F[Transcript and model]
  D --> G[Run ends and pending guidance is removed]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +13, Tests +75, Docs 0. Total +88 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 2 21 8 +13
Tests 3 108 33 +75
Docs 1 1 1 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 130 42 +88

Review metrics

None.

Technical review

Best possible solution:

Keep one receiving-run owner for admitted steering, with an immediate admission receipt and exact cleanup of pending guidance at run termination.

Do we have a high-confidence way to reproduce the issue?

Yes, from source: current main waits for transcript commitment on explicit steering and cancels the queued message at that deadline. The PR supplies a held-response regression path, which this read-only review did not execute.

Is this the best way to solve the issue?

Yes. The patch separates admission from transcript confirmation within the existing queue lifecycle and retains terminal cleanup without adding another queue.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against abb37032e7f7.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: The PR addresses a bounded loss of session steering when the receiving run stays busy beyond the send deadline.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The host identifies this as a MEMBER-attributed bot PR, outside the external-contributor proof gate. The reported current-head checks exercise the assembled session-send tool, an AgentSession, and SQLite readback after a held response; no live Gateway run or stored-data contract change is claimed.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Josh Avant: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vyctor H. Brzezowski: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (4 earlier review cycles)
  • reviewed 2026-09-28T14:32:44.259Z sha ac18338 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-28T14:40:06.122Z sha ac18338 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-28T14:52:45.805Z sha ac18338 :: needs changes before merge. :: none
  • reviewed 2026-09-28T15:27:50.279Z sha ac18338 :: blocked before merge. :: none

@VACInc

VACInc commented Sep 28, 2026

Copy link
Copy Markdown
Member

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@VACInc

VACInc commented Sep 28, 2026

Copy link
Copy Markdown
Member

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@VACInc
VACInc merged commit 20472c4 into main Sep 28, 2026
246 of 250 checks passed
@VACInc
VACInc deleted the openclaw/steering-transcript-commit-20260928 branch September 28, 2026 16:43
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 29, 2026
…w#160490)

Acknowledge explicit steering admission without withdrawing it at the reply
wait deadline. Keep exact-message terminal cleanup with the receiving run.

Worked on by:
- @VACInc

Co-authored-by: roboclaw-bot <[email protected]>
Co-authored-by: VACInc <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants