openclaw - 💡(How to fix) Fix [Bug]: v5.7 regression — implicit steering (steeringMode:all) + prefill injection cause amnesia loops and context loss in TUI sessions [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#80191Fetched 2026-05-11 03:17:49
View on GitHub
Comments
1
Participants
2
Timeline
1
Reactions
2
Timeline (top)
commented ×1

After upgrading from v2026.4.24 to v2026.5.7, TUI sessions exhibit severe context loss ("amnesia") and looping behavior where the assistant repeats the same response 3+ times while ignoring user instructions. Two distinct but interacting regressions:

  1. Implicit steering via queueEmbeddedPiMessage — In v5.7, this function gained a third options parameter with steeringMode defaulting to "all". When a user sends a message during active streaming, the agent-runner's effectiveShouldSteer logic silently converts it to an in-stream steering event instead of starting a new run. The user's message effectively "disappears" into the current stream. In v4.24, queueEmbeddedPiMessage(sessionId, text) had no steeringMode and just called handle.queueMessage(text).

  2. Assistant-role injection causing prefill errors/steer injects a synthetic assistant message {role: "assistant", provider: "openclaw", model: "gateway-injected"} that causes 400 invalid_request_error: This model does not support assistant message prefill on claude-opus-4.6 via github-copilot. This also reproduces without /steer, suggesting OpenClaw v5.7 injects assistant-role content in other code paths too.

  3. Failed context recovery triggers full regeneration instead of incremental response — When _recover_context.py fails between a user follow-up and the next assistant turn, the agent regenerates its previous answer from scratch instead of answering the new question.

Error Message

  • Line 123 (08:00Z): Fatal prefill error on claude-opus-4.6

Session revisa-error (b798e202.jsonl)

  • Line 13 (08:08Z): Same prefill error reproduced without /steer
  • #79887 — Anthropic prefill rejection without fallback poisons sessions (CLOSED, same prefill error but different root cause)
  • #77228 — Session corruption: prefill error cascades into provider cooldown
  • #75395 — Claude Opus 4.6 via OpenRouter prefill error

Root Cause

  • #79887 — Anthropic prefill rejection without fallback poisons sessions (CLOSED, same prefill error but different root cause)
  • #76754 — Telegram DM replies mix stale and current intent when runs overlap (CLOSED, similar stale-reply symptom)
  • #77228 — Session corruption: prefill error cascades into provider cooldown
  • #62322 — Recovery chain inconsistency after aborted runs
  • #75395 — Claude Opus 4.6 via OpenRouter prefill error

Code Example

function queueEmbeddedPiMessage(sessionId, text, options) {
  // ...
  handle.queueMessage(text, options ?? { steeringMode: "all" })
}

---

const effectiveShouldSteer = !effectiveResetTriggered && shouldSteer;
if (effectiveShouldSteer && isStreaming) {
    if (queueEmbeddedPiMessage(sessionKey, followupRun.prompt, {
        steeringMode: resolvePiSteeringModeForQueueMode(resolvedQueue.mode),
        ...resolvedQueue.debounceMs !== void 0 ? { debounceMs: resolvedQueue.debounceMs } : {}
    }) && !effectiveShouldFollowup) {
        await touchActiveSessionEntry();
        typing.cleanup();
        return; // message steered into existing stream, no new run
    }
}
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Summary

After upgrading from v2026.4.24 to v2026.5.7, TUI sessions exhibit severe context loss ("amnesia") and looping behavior where the assistant repeats the same response 3+ times while ignoring user instructions. Two distinct but interacting regressions:

  1. Implicit steering via queueEmbeddedPiMessage — In v5.7, this function gained a third options parameter with steeringMode defaulting to "all". When a user sends a message during active streaming, the agent-runner's effectiveShouldSteer logic silently converts it to an in-stream steering event instead of starting a new run. The user's message effectively "disappears" into the current stream. In v4.24, queueEmbeddedPiMessage(sessionId, text) had no steeringMode and just called handle.queueMessage(text).

  2. Assistant-role injection causing prefill errors/steer injects a synthetic assistant message {role: "assistant", provider: "openclaw", model: "gateway-injected"} that causes 400 invalid_request_error: This model does not support assistant message prefill on claude-opus-4.6 via github-copilot. This also reproduces without /steer, suggesting OpenClaw v5.7 injects assistant-role content in other code paths too.

  3. Failed context recovery triggers full regeneration instead of incremental response — When _recover_context.py fails between a user follow-up and the next assistant turn, the agent regenerates its previous answer from scratch instead of answering the new question.

Steps to reproduce

  1. Run OpenClaw v2026.5.7 via TUI with github-copilot/claude-opus-4.6 or github-copilot/gpt-5.4
  2. Start a conversation. While the assistant is streaming a response, send a follow-up message.
  3. Observed: the follow-up is silently treated as steering (via effectiveShouldSteer + queueEmbeddedPiMessage), not as a new turn. The assistant continues its previous response or loops.
  4. After several exchanges, the assistant begins repeating the same analysis verbatim, ignoring explicit user corrections like "you're repeating yourself" or "you're ignoring what I wrote."
  5. Additionally: using /steer or having the gateway inject assistant-role messages causes prefill errors on Anthropic models.

Expected behavior

  • Messages sent during streaming should queue as new turns, not implicit steering (or at minimum, the default steeringMode should not be "all").
  • No assistant-role content should be injected in ways that break providers that don't support prefill.
  • Context recovery failures should not cause full response regeneration / looping.

Evidence from JSONL transcripts

Session tui-47da4c23 (db585db0.jsonl)

  • Lines ~25, ~35, ~55: Same hackathon analysis repeated 3 times while user explicitly said "no me has hecho ni puto caso" (L27) and "respondiendo lo mismo tres veces seguidas" (L57)
  • Line 101 (07:53Z): /steer injects {role: "assistant", content: "steered current session.", provider: "openclaw", model: "gateway-injected"}
  • Line 123 (08:00Z): Fatal prefill error on claude-opus-4.6

Session revisa-error (b798e202.jsonl)

  • Line 13 (08:08Z): Same prefill error reproduced without /steer

Session problemas-5.7 (10a9e921.jsonl)

  • Lines 86 vs 91: Near-identical diagnostic response repeated after _recover_context.py failed (L90)

Code references (v5.7)

queueEmbeddedPiMessagedist/runs-7EMiaNjW.js line 18:

function queueEmbeddedPiMessage(sessionId, text, options) {
  // ...
  handle.queueMessage(text, options ?? { steeringMode: "all" })
}

effectiveShouldSteerdist/agent-runner.runtime-DQsCsHUA.js lines 3462-3503:

const effectiveShouldSteer = !effectiveResetTriggered && shouldSteer;
if (effectiveShouldSteer && isStreaming) {
    if (queueEmbeddedPiMessage(sessionKey, followupRun.prompt, {
        steeringMode: resolvePiSteeringModeForQueueMode(resolvedQueue.mode),
        ...resolvedQueue.debounceMs !== void 0 ? { debounceMs: resolvedQueue.debounceMs } : {}
    }) && !effectiveShouldFollowup) {
        await touchActiveSessionEntry();
        typing.cleanup();
        return; // message steered into existing stream, no new run
    }
}

In v4.24, queueEmbeddedPiMessage had no options parameter and no steeringMode logic.

Environment

  • OS: Linux 6.17.0-19-generic (Ubuntu)
  • OpenClaw: v2026.5.7
  • Previous working version: v2026.4.24
  • Node: v22
  • Provider/Models: github-copilot/claude-opus-4.6, github-copilot/gpt-5.4, openai-codex/gpt-5.5
  • Channel: TUI (openclaw-tui)

Related issues

  • #79887 — Anthropic prefill rejection without fallback poisons sessions (CLOSED, same prefill error but different root cause)
  • #76754 — Telegram DM replies mix stale and current intent when runs overlap (CLOSED, similar stale-reply symptom)
  • #77228 — Session corruption: prefill error cascades into provider cooldown
  • #62322 — Recovery chain inconsistency after aborted runs
  • #75395 — Claude Opus 4.6 via OpenRouter prefill error

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

  • Messages sent during streaming should queue as new turns, not implicit steering (or at minimum, the default steeringMode should not be "all").
  • No assistant-role content should be injected in ways that break providers that don't support prefill.
  • Context recovery failures should not cause full response regeneration / looping.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING