Skip to content

feat(queue): tell the sender whether a busy-time message steered the running turn - #160405

Open
kiranvk-2011 wants to merge 10 commits into
openclaw:mainfrom
kiranvk-2011:feat/steer-receipts
Open

kiranvk-2011 wants to merge 10 commits into
openclaw:mainfrom
kiranvk-2011:feat/steer-receipts

Conversation

@kiranvk-2011

@kiranvk-2011 kiranvk-2011 commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Related: #25222, #83871, #124731, #159816

Two OpenClaw lobsters clasping claws as a steering wheel

What Problem This Solves

Fixes: in a chat channel, a message sent while a run is active gets no visible response. The sender can't tell whether it steered the running turn or is waiting for its own, so people resend, or /stop a run that was already doing what they asked.

User Impact

User impact: with messages.queue.steerReceipts: true, each message that arrives during a run in steer mode gets its own reply quoting that message:

  • 🦞🛞 Current run steered with your new message. once the runtime has taken the message into the running turn
  • ⏳ Couldn't steer the current run; your message is queued behind it. when the message falls back to a followup turn and the queue keeps it
  • when the fallback runs into messages.queue.cap, the receipt follows the queue's actual disposition instead of promising an answer: summarized (including a summary line that was elided but is still retained), dropped (asks the sender to resend), or at-cap (a sibling steer is still parked, so the outcome isn't final yet)
  • fallback receipts say where the message is now and never promise an answer, because the queue can still change. With drop: old, if a later overflow evicts a message that was reported as queued, the sender gets one follow-up reply to that message: dropped, please resend. Summary-entry trimming has no disposition hook, so the summary receipt says older entries can be trimmed instead of sending a second notice

It is off by default, so nothing changes unless an operator turns it on.

Scope, stated upfront: #25222 describes a broader busy-reply contract: all queue modes, configurable text, /stop and /new guidance, and stable reason codes. This PR is a first, opt-in piece of that for steer mode only, where the outcome is known exactly. If you'd rather extend it here (for example make the text configurable, or cover followup/collect), or change the default wording, tell me and I'll adjust.

Why This Change Was Made

runActiveReplySteer already knows the outcome, and the receipt is sent at exactly those points:

  • Steered fires only after finalizeReplyMessageInjectionAttempt returns accepted, meaning the runtime took the input. For runtimes that steer at tool boundaries, that's when the current tool call ends, so the receipt is never premature.
  • Fallback fires on every path that hands the message back to the followup queue. parkSteerCandidate().fallback() returns where the message ended up (queued / at-cap / summarized / dropped), because releasing the park reapplies queue overflow. For queued/at-cap fallbacks, armSteerReceiptEvictionNotice wraps the run's existing onQueueDisposition (the observer still runs first) and sends the follow-up on queue-cap-old, ordered after the first receipt.
  • Cancelled or aborted steers send nothing, and ambient room events never get a receipt.

The receipt goes out through routeReply as a standalone reply with mirror: false, so the model never sees its own receipts. It is deliberately not the message's terminal reply: a queued message still owes its real answer from the followup, and a second terminal reply for the same inbound would collide with it.

Two channel details learned from real traffic:

  • Telegram quotes only an explicit replyToId. It has no threading.resolveReplyTransport, so the payload names the message. FollowupRun.messageId is often unset on the steer path, so the id falls back to sessionCtx.MessageSid, the same fallback resolveAcceptedSteerRunId already uses.
  • responsePrefixContext comes from the active run, so operators who template messages.responsePrefix see the model, not a literal {modelFull}.

Config surface: one boolean. The core config budget goes from 2464 to 2465 (docs/.generated/config-baseline.counts.json). It's opt-in because #83871 asked for this without default chat noise. If you'd prefer receipts on by default with no key, which fits "every action has a visible outcome", I can drop the key.

schema.labels.ts was already over the line cap. The messages.* labels moved unchanged into schema.labels.messages.ts, and the file shrinks.

Evidence

Live, on a Telegram deployment running this PR plus #159816 (claude-cli, Claude Code 2.1.280), in DMs and a forum topic with message_tool_only group replies. Examples from the logs:

  • A message sent mid-turn got its receipt 1 to 50 s later, when the running tool call finished. For example: outbound send ok … threadId=35 replyToMessageId=71 4 s after message 71.
  • Each turn then ended with one reply covering both messages, and no followup turn replayed the steered message.
  • The operator testing it preferred per-message receipts with no debounce, so each message gets its own quoted confirmation.

Tests: src/auto-reply/reply/steer-receipt.test.ts has 12 pure unit tests, with routeReply mocked and no timers, I/O or Gateway boot:

  • off unless the key is set
  • the steered and queued texts
  • replies to the steered message id in the right thread and account, with mirror: false
  • falls back to the source message id when the queued run has none
  • silent for room events and unroutable origins
  • never throws when delivery fails
  • no fallback text (queued, at-cap, summarized, dropped) promises an answer
  • the eviction follow-up fires once, after the fallback receipt, quoting the original message; it is not armed when receipts are off and ignores other dispositions

src/auto-reply/reply/queue/enqueue.steering.test.ts asserts the fallback disposition for each drop policy (summarize, old, new), including a deferred overflow behind a parked sibling (drop: old reports queue-cap-old for the evicted earlier fallback), a run whose summary line was elided but is still retained, and the same run reported dropped once more overflow trims its elided copy.

Single-worker wall time (vitest run --maxWorkers=1 <file>, local):

File Tests Duration
src/auto-reply/reply/queue/enqueue.steering.test.ts 10 12.3 s
src/auto-reply/reply/steer-receipt.test.ts 12 2.1 s

Also run:

  • The existing steer-adoption and runReplyAgent suites, and src/config/schema*: passing. The common-tier snapshot gains exactly messages.queue.steerReceipts.
  • node scripts/check-changed.mjs against current main: the conflict-marker and line-cap ratchets pass. It then stops on the env-var budget (484 > 483), which comes from main because this diff adds no env vars. pnpm tsgo:core, oxlint and oxfmt are clean on the final head.

🤖 Generated with Claude Code

…running turn

Adds opt-in messages.queue.steerReceipts. In steer mode, each message that arrives
during an active run gets a standalone reply quoting it: "🦞🛞 Current run steered with
your new message." once the runtime has taken it into the turn, or a "⏳" notice when it
falls back to a followup. Receipts are routed replies (mirror off), never the message's
terminal reply, so a queued message still gets its real answer. Room events stay silent.

Refs openclaw#25222

Co-Authored-By: Claude Opus 5.5 <[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 size: M labels Sep 28, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 28, 2026
@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

Adds optional quoted channel receipts reporting successful steering, queue fallback, overflow, and later eviction.

Example: Telegram message 71 arrives in forum topic 35 during an active turn, with messages.queue.steerReceipts enabled.

  • Before: The sender receives no confirmation that the message joined the active turn.
  • After: Once steering is accepted, a receipt quotes message 71 in topic 35.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) No discrete introduced correctness defect was established; partial behavior evidence, unresolved configuration direction, confirmed conflicts, and unattributed failing checks prevent readiness.
Proof confidence 🦪 silver shellfish (2/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Product

Kind: Feature · Worth it: Needs a maintainer decision · Fix scope: Partial
User problem: Channel senders cannot readily distinguish accepted steering from a message waiting for a later turn.
Reason: The narrower feature is useful and preserves default silence, but adds an unapproved configuration option and covers only part of the linked busy-feedback request.

Merge readiness

⛔ Blocked before merge - 2 items remain

Keep open: this PR contains meaningful, distinct channel feedback work that current main does not provide, but its new opt-in setting needs an owner decision.

Reviewed head: 1215c55d8b068c329979b8a2bf4d2ee24d7785a6
Owner decision: Required. See Decision needed.

Decision needed

  • Question: Should OpenClaw add a steer-only messages.queue.steerReceipts setting alongside its deliberately quiet automatic fallback behavior?
  • Recommendation: Sponsor the narrow opt-in feature: Approve steer-only receipts with the existing quiet default, and integrate them with current session-controller ownership.
  • Why: The contribution has concrete user value, but neither its discussion nor the broader request records owner approval of this additional configuration surface.

Before merge

  • Add real behavior proof - The body reports successful Telegram steering through a deployed Claude CLI runtime and includes a matching outbound target trace, but supplies no final-head channel evidence for fallback or later eviction and no latest-stable upgrade run. The inspected image is decorative. Attach live output, logs, or terminal screenshots covering those paths, with IPs, credentials, phone numbers, and non-public endpoints redacted. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.
  • Complete next step - The contributor should resolve GitHub's confirmed conflicts while retaining current session-controller ownership and the quiet default.

Findings

None.

Tests

  • Missing end-to-end proof: Provide redacted channel output showing fallback and later-eviction receipts in order against their quoted messages, plus a latest-stable upgrade retaining existing settings; the existing success trace does not exercise these cases.
Agent review details

How this fits together

Inbound channel messages enter active-turn steering or the followup queue; the added receipt helper routes those outcomes back through the existing channel reply owner.

flowchart TD
  A[Channel message] --> B[Steering adoption]
  B --> C[Active runtime]
  B --> D[Followup queue]
  C --> E[Receipt helper]
  D --> E
  E --> F[Reply routing]
  F --> G[Quoted channel receipt]
Loading

Technical review

Best possible solution:

If approved, attach opt-in receipts to the current session-controller and queue outcomes through existing reply routing while preserving quiet defaults.

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

Source confirms that automatic fallback is intentionally quiet; this PR proposes additional feedback rather than repairing a demonstrated violation of that contract.

Is this the best way to solve the issue?

The patch uses existing steering, queue-disposition, and routing owners appropriately; accepting its new setting is a product choice, and conflict resolution must retain current session-controller ownership.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against eee7a1bd5264.

Provenance checked

  • Parked steering and queue overflow keeps the original intent (dba9fb8: Preserve arrival order and queue custody while runtime steering resolves.)
  • Steering acceptance keeps the original intent (6515f6a: Keep start-or-steer and captured injection settlement under one authoritative owner.)
  • Configuration labels keeps the original intent (f8171ff: Maintain complete discoverable configuration help and labels; this PR moves existing message labels unchanged and adds the new setting's label.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Source +206, Tests +269, Docs +30, Generated +1. Total +506 across 14 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 8 232 26 +206
Tests 2 271 2 +269
Docs 1 30 0 +30
Config 0 0 0 0
Generated 3 4 3 +1
Other 0 0 0 0
Total 14 537 31 +506

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Configuration surface 1 new optional boolean messages.queue.steerReceipts enables per-message channel feedback and defaults to disabled.

Labels

Label changes:

No label changes.

Label justifications:

  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall readiness starts with the lower of the proof and patch scores. It is capped at 3/6 if the fix is partial, the change offers little benefit, a product decision is still open, or the PR reverses an earlier decision without saying why. ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (9 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-28T15:40:06.210Z sha 8f348fc :: blocked before merge. :: [P2] Recognize retained elided summaries before reporting a drop
  • reviewed 2026-09-28T21:10:28.947Z sha 9d717ad :: blocked before merge. :: [P2] Keep queued receipts truthful after later overflow
  • reviewed 2026-09-28T22:31:01.403Z sha 9d717ad :: blocked before merge. :: [P2] Keep queued receipts truthful after later overflow
  • reviewed 2026-09-29T00:57:54.010Z sha 30b00b2 :: blocked before merge. :: [P2] Keep fallback receipts truthful after later overflow
  • reviewed 2026-09-29T06:10:05.287Z sha 7756af5 :: blocked before merge. :: none
  • reviewed 2026-09-29T10:57:35.023Z sha c4d689a :: blocked before merge. :: none
  • reviewed 2026-09-29T16:42:41.060Z sha f5e043e :: blocked before merge. :: none
  • reviewed 2026-09-30T10:56:21.684Z sha 1215c55 :: blocked before merge. :: none

Reviewed November 24, 2026, 4:41 PM ET / 21:41 UTC (Revision 10).

@kiranvk-2011

Copy link
Copy Markdown
Contributor Author

A note on the red checks. The failing suites are the Control UI rename-composition e2e, subagent-registry.requester-wake.e2e, a hosted control-plane timeout (90 s) and the heartbeat runner. None of them import the changed files (steer-receipt.ts, agent-runner-steer-adoption.ts, the queue config schema and labels). Several are timeout or 'not observed' assertions. On the sibling PR #160379, one of these e2e suites fails the same way on the base commit without any change. I can't re-run jobs from a fork. A maintainer re-run of the failed jobs would confirm.

ci and others added 2 commits September 28, 2026 15:06
# Conflicts:
#	docs/.generated/config-baseline.sha256
…osition

Releasing a parked steer reapplies queue overflow, so a fallback is not always a
retained followup. parkSteerCandidate().fallback() now returns where the message
ended up (queued / at-cap / summarized / dropped), and the receipt text follows it:
"dropped" tells the sender to resend, "summarized" says it goes into the summary,
and "at-cap" covers a retained item whose overflow is still deferred behind a
sibling parked steer. Only a final "queued" promises an answer after the run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TRWvtxDWMcs2uSaSRoCwKz
@kiranvk-2011

Copy link
Copy Markdown
Contributor Author

Update: merged current main (no rebase, conflict was only the generated config baseline, regenerated with pnpm config:docs:gen), and fixed the review finding in 8f348fc.

Fallback receipt vs. queue overflow. ClawSweeper was right: parked.fallback() reapplies overflow, so "I'll answer this right after it" could be sent for a message the cap had just dropped. parkSteerCandidate().fallback() now returns where the message ended up, and the receipt follows it:

  • queued: retained and final, the only case that promises an answer after the run
  • summarized: drop: summarize moved it into the overflow summary
  • dropped: drop: old/new removed it; the receipt asks the sender to resend
  • at-cap: still retained, but a sibling steer is parked, so overflow is deferred and old/summarize may still evict it. The receipt says so instead of promising.

Tests in enqueue.steering.test.ts assert the outcome for each drop policy, including the deferred case with two parked steers, and steer-receipt.test.ts checks that none of the non-final kinds promise an answer. The docs and help text describe the cap behaviour.

Config and data model. steerReceipts is an optional boolean, off by default, and nothing reads it unless it is set to true, so existing configs behave exactly as before. The schema.labels* files flagged as a "database schema" are UI labels and help text. Nothing is stored or migrated. The one compatibility note: a config that sets the key would fail strict validation on a build from before this PR, like any new key.

Scope (the open decision). I kept this as a focused, opt-in piece for steer mode rather than the full busy contract in #25222. The receipt kinds are typed and come from the queue's own disposition, so a later generic contract (followup/collect modes, configurable text, reason metadata) can reuse them. It wouldn't need to replace this. If you'd rather not add a steer-only key and want it under a broader messages.queue.busyReceipts-style surface, I'm happy to rename or reshape it. I'd just like a maintainer to pick the shape first.

Local runs: the steering/queue/receipt suites, the config schema suites, tsgo:core, oxlint, oxfmt, config:docs:check, and check:base-config-schema all pass. check:changed stops only on the env-var budget (484 > 483). That comes from main, since this diff adds no env vars.

Summary-line overflow moves an older source into summaryElisions as a compact
copy (tracked through sourceRefs). The fallback outcome resolver only looked at
summarySources, so it reported "dropped" for a message the summary turn still
delivers. Treat a run whose compact copy is still in an elision as "summarized";
only an evicted copy is a drop.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TRWvtxDWMcs2uSaSRoCwKz
@kiranvk-2011

Copy link
Copy Markdown
Contributor Author

The elided-summary P2 is addressed in 9d717ad. The outcome resolver now also checks summaryElisions. If the run's compact copy (looked up through sourceRefs) is still in an elision, it reports summarized. It reports dropped only once the elision cap has evicted that copy. A new case in enqueue.steering.test.ts builds that state (cap 1, summarize, three parked steers) and fails without the fix. I added single-worker timings for the changed test files to the PR body.

@openclaw-barnacle openclaw-barnacle Bot reopened this Sep 28, 2026
ci and others added 3 commits September 29, 2026 00:49
# Conflicts:
#	docs/.generated/config-baseline.sha256
# Conflicts:
#	docs/.generated/config-baseline.counts.json
#	docs/.generated/config-baseline.sha256
…ges later

A fallback receipt used to promise "I'll answer this right after it", but a
later overflow can still evict that message (drop:old) or trim its summary
entry. Fallback wording now states where the message is and never promises an
answer. When receipts are on and the fallback was queued, the run's
onQueueDisposition is wrapped so a later "queue-cap-old" eviction sends one
follow-up reply to the same message asking the sender to resend it, ordered
after the first receipt. Summary-entry trimming has no disposition hook, so the
summary receipt says older entries can be trimmed instead.

SteerReceiptKind now reuses ParkedSteerFallbackOutcome from the queue (fixes the
knip unused-export finding).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TRWvtxDWMcs2uSaSRoCwKz
@kiranvk-2011

Copy link
Copy Markdown
Contributor Author

Addressed the "keep fallback receipts truthful after later overflow" P2 in 7756af5, after merging current main.

  • Fallback receipts no longer promise an answer. They say where the message is now, for example "your message is queued behind it", because a later overflow can still change that.
  • With drop: old, a later overflow can evict a message that was reported as queued. The existing queue-cap-old disposition now triggers one follow-up reply to that message, saying it was dropped and should be resent. The follow-up is ordered after the first receipt. The wrapper chains the existing onQueueDisposition observer, so admission bookkeeping is unchanged.
  • Summary-elision trimming has no disposition hook. I didn't add one to shared queue state for this, so the summary receipt says instead that older entries can be trimmed.
  • New tests: the drop: old eviction of an earlier fallback, the elided entry being trimmed and then reported dropped, and the follow-up's ordering and once-only behaviour. The knip unused-export finding from the last run is fixed by reusing ParkedSteerFallbackOutcome for the receipt kinds.

Thanks for the scope recommendation. Keeping this as the focused, opt-in setting for steer mode works for me.

@clawsweeper clawsweeper Bot removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 29, 2026
@clawsweeper clawsweeper Bot added 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 29, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Nov 24, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale after 7 days without qualifying human activity.
Without new human activity, Barnacle may close it as not planned 7 days after this message was posted. This is administrative inactivity cleanup, not a claim that the problem is fixed.
A human update restarts the inactivity clock; a new PR head also restarts it. A maintainer can add no-stale for a durable hold, or bad-barnacle to suppress Barnacle. Remove the hold when work can resume.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Nov 25, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: L stale Marked as stale due to inactivity status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant