Repository navigation
Description
Summary
When messages.queue.mode is set to "steer", inbound messages are never injected into the active agent turn at tool call boundaries as documented. Instead, they silently degrade to followup behavior (waiting for end-of-turn, then triggering a new turn). There is zero diagnostic logging when this occurs.
Expected behavior
Per queue.md docs:
steer: inject immediately into the current run (cancels pending tool calls after the next tool boundary). If not streaming, falls back to followup.
Messages sent while the agent is executing tool calls should be:
- Picked up by
queueEmbeddedPiMessage() - Pushed into the pi-agent-core steering queue via
activeSession.steer(text)→agent.steer() - Dequeued by
getSteeringMessages()at the next tool call boundary inagent-loop.js - Injected into the conversation, skipping remaining pending tool calls
Actual behavior
Messages sent during active tool execution:
- Arrive at the gateway reply pipeline
- Are not injected mid-turn at any tool call boundary
- Are queued as a followup and processed only after the current turn ends
- Trigger a new agent turn (identical to
followupmode behavior)
No diagnostic logging occurs when steer degrades to followup. The diag.debug lines in queueEmbeddedPiMessage() (reasons: no_active_run, not_streaming, compacting) do not appear in /tmp/openclaw/*.log even with logging.level: "debug".
Reproduction
- Set
messages.queue.mode: "steer"globally in config - Send a message that triggers the agent to make multiple sequential tool calls (e.g. a research question requiring several
exec/Readcalls) - While tool calls are executing, send additional messages
- Observe: none of the messages are injected mid-turn. All wait for end-of-turn and trigger new turns.
This was reproduced live across ~10 consecutive turns with 30+ tool call boundaries total. Zero mid-turn injections occurred.
Config
{
"messages": {
"queue": {
"mode": "steer",
"debounceMs": 1000,
"cap": 20,
"drop": "summarize"
}
}
}Channel: Discord
Version: 2026.3.13
Model: anthropic/claude-opus-4-6
Code path analysis (from source inspection)
The pi-agent-core layer (agent-loop.js) correctly implements steering:
getSteeringMessages()is polled between sequential tool executions and after each turn- When steering messages are found, remaining tool calls are skipped with "Skipped due to queued user message"
- The
steeringQueueon the agent is a simple array thatsteer()pushes to anddequeueSteeringMessages()drains
The gateway bridge layer connects these via:
queueEmbeddedPiMessage(sessionId, text)→handle.queueMessage(text)→activeSession.steer(text)→agent.steer(message)- Guards:
handle.isStreaming()and!handle.isCompacting()— note thatisStreamingis set totruefor the entire agent loop duration (including tool execution), so this guard should pass during active runs - Gateway reply pipeline checks
shouldSteer && isStreamingbefore attempting steer injection - Fallback: when steer injection fails for any reason,
resolveActiveRunQueueAction()returns"enqueue-followup"forqueueMode === "steer", silently degrading to followup
The exact failure point is unclear from static source analysis alone. The pi-agent-core steering mechanism and the gateway bridge both appear correct in isolation. The failure may be:
- A race condition in session/sessionId resolution before the embedded run handle is registered
- Something in the event subscription layer that drops or ignores the injected steering turn
- A timing issue between the gateway reply pipeline and the embedded run lifecycle
- Tool execution mode (parallel vs sequential) affecting when steering is polled
Instrumentation or debugger attachment would be needed to determine the exact failure point.
Suggestions
- Add logging when steer injection fails and falls back to followup — currently this is completely silent
- Log the specific guard that rejected the steer (was it
isStreaming,isCompacting,no_active_run, or something else?) - Ensure the
diag.debuglines inqueueEmbeddedPiMessage()are actually routed to the file logger whenlogging.level: "debug"is set
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
Ryce commentedon Mar 20, 2026
Ryce commentedon Mar 20, 2026
ppamment commentedon Mar 22, 2026
Root cause found via instrumentation
I patched
reply-Bm8VrLQh.jswithfs.appendFileSynclogging at every decision point. Results from/tmp/steer-debug.log:Every inbound message that arrives during an active run shows
isActive=falseandisStreaming=falsewhen it reachesrunReplyAgent. This means:session:<key>) serializes all runs for a given sessionrunReplyAgentafter the first run completesisActive=falseandisStreaming=false, so the steer path is skipped andactiveRunQueueAction=run-nowtriggers a fresh runThe steer decision code inside
runReplyAgentworks correctly — it just never gets a chance to run while a run is active. The session lane queue prevents it.The fix needs to happen upstream: when
mode=steerand a run is active, the inbound message should bypass the session lane queue and callqueueEmbeddedPiMessagedirectly (before enteringrunReplyAgent), or the lane queue should check for steer mode and short-circuit to the steer injection path.ppamment commentedon Mar 22, 2026
Correction to my previous comment: The log entries I posted were all hourly heartbeats (spaced ~65min apart), not user messages or steer attempts. They only prove that heartbeats reach
runReplyAgentwithisActive=false— which is expected (heartbeats should run when the session is idle).The instrumentation has not yet captured an actual inbound user message arriving while a run is active. This means either:
runReplyAgententirely (handled by the session lane queue before reaching this function)runReplyAgentbut through a path I haven't instrumentedThe root cause conclusion about "session lane queue blocking" may still be correct, but the evidence I cited doesn't prove it. Still investigating.
paulodearaujo commentedon Mar 31, 2026
+1
openclaw-barnacle commentedon Apr 29, 2026
This issue has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.
clawsweeper commentedon Apr 29, 2026
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.
Close as duplicate of the earlier open tracker #48003. Current main still shows the steer-to-followup behavior shape, but #48003 already tracks the same remaining root issue and open PRs #73365 and #75226 are the active fix candidates; this issue’s Discord reproduction and diagnostic notes should be preserved there as supporting context.
So I’m closing this here and keeping the remaining discussion on the canonical linked item.
Review details
Best possible solution:
Keep #48003 as the canonical open tracker, review or replace #73365/#75226 for the code fix, and carry this issue’s Discord diagnostics into that thread.
Do we have a high-confidence way to reproduce the issue?
Yes. Source inspection on current main shows same-session Discord work is serialized, steering is attempted only while
isStreamingis true, non-streaming embedded handles reject steering, and activesteerfalls through to followup.Is this the best way to solve the issue?
Yes. Closing this as a duplicate is the best tracking outcome because #48003 is already open for the same remaining bug and the active fix work belongs in #73365, #75226, or a focused replacement.
Security review:
Security review: No patch is attached to this issue, so there is no PR security or supply-chain diff to review.
What I checked:
steeras active-runtime delivery, with followup only when the current run cannot accept steering or steering is unavailable. Public docs:docs/concepts/queue.md. (docs/concepts/queue.md:42, a3f6f24b79a5)runReplyAgentonly callsqueueEmbeddedPiMessagewheneffectiveShouldSteer && isStreaming, so active non-streaming phases do not attempt the embedded steering helper from this path. (src/auto-reply/reply/agent-runner.ts:1014, a3f6f24b79a5)queueEmbeddedPiMessagerejects an active embedded handle whenhandle.isStreaming()is false and returnsfalseafter areason=not_streamingdebug line. (src/agents/pi-embedded-runner/runs.ts:81, a3f6f24b79a5)steerand legacyqueuemodes toenqueue-followup, and the colocated test asserts that behavior. (src/auto-reply/reply/queue-policy.ts:21, a3f6f24b79a5)createChannelRunQueueusesKeyedAsyncQueue, which chains same-key tasks behind the previous tail. (extensions/discord/src/monitor/message-run-queue.ts:90, a3f6f24b79a5)Likely related people:
src/auto-reply/reply/agent-runner.ts,src/agents/pi-embedded-runner/runs.ts,src/auto-reply/reply/queue-policy.ts)src/auto-reply/reply/agent-runner.ts,src/agents/pi-embedded-runner/runs.ts)docs/concepts/queue.md,docs/concepts/queue-steering.md,src/auto-reply/reply/queue-policy.ts)extensions/discord/src/monitor/message-run-queue.ts,src/plugin-sdk/channel-lifecycle.core.ts,src/plugin-sdk/keyed-async-queue.ts)Codex review notes: model gpt-5.5, reasoning high; reviewed against a3f6f24b79a5.
clawsweeper commentedon Apr 29, 2026
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve.
Keep open. Current main still does not satisfy the steer contract: current-run injection remains gated on streaming, active non-streaming embedded handles are rejected, active steer resolves to followup, and Discord same-session work is still serialized before reply handling can attempt steering. The focused related fix PR #73365 is open and unmerged, so this should not be closed as implemented.
Required change / next step:
No separate ClawSweeper repair job should be queued because open maintainer-labeled PR #73365 already covers the focused fix; the maintainer action is to review, land, or replace that PR.
Review details
Best possible solution:
The desired end state is lifecycle-aware steer delivery: eligible same-session messages should reach the embedded steering queue while a run is active, rejected steer attempts should emit useful diagnostics, followup fallback should remain deliberate, and docs/tests should describe the actual injection boundary consistently.
What I checked:
steeras immediate current-run injection with followup only when not streaming. Public docs:docs/concepts/queue.md. (docs/concepts/queue.md:27, e46dccb35374)steercurrent-run injection from followup/collect behavior after the current turn ends, though the exact injection boundary wording differs from queue.md. Public docs:docs/concepts/agent.md. (docs/concepts/agent.md:87, e46dccb35374)runReplyAgentonly callsqueueEmbeddedPiMessageunderif (shouldSteer && isStreaming), so active non-streaming tool execution does not reach the embedded steering helper from this path. (src/auto-reply/reply/agent-runner.ts:930, e46dccb35374)queueEmbeddedPiMessagereturns false for an active embedded handle whenhandle.isStreaming()is false, loggingreason=not_streamingonly inside the helper. (src/agents/pi-embedded-runner/runs.ts:71, e46dccb35374)steerruns toenqueue-followup, and the colocated test asserts that behavior. (src/auto-reply/reply/queue-policy.ts:17, e46dccb35374)createChannelRunQueue; that queue delegates toKeyedAsyncQueue, which chains tasks per key before processing the next message. (extensions/discord/src/monitor/message-run-queue.ts:90, e46dccb35374)Likely related people:
git ls-remoteconfirms the PR head ref still exists. (role: likely follow-up owner; confidence: medium; commits: b29ea4e33486; files:src/auto-reply/reply/agent-runner.ts,src/agents/pi-embedded-runner/runs.ts,src/auto-reply/reply/queue-policy.ts)src/auto-reply/reply/agent-runner.ts,src/agents/pi-embedded-runner/runs.ts,src/auto-reply/reply/queue-policy.ts)Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against e46dccb35374.
Deniable9570 commentedon May 6, 2026
Can confirm this also affects steer-backlog mode. Telegram user on 2026.4.2, same behavior — messages queued as followup instead of being injected mid-turn. queueDepth=0 at every run start confirms messages arrive after prior turn completed.