-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
[Feature]: Surface CLI session resets (reason=system-prompt) to the active conversation #96553
Copy link
Copy link
Open
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.enhancementNew feature or requestNew feature or requestimpact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Description
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.enhancementNew feature or requestNew feature or requestimpact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Priority
None yet
Summary
Emit a visible in-band notice when the
claude-clibackend resets its CLI session and replays the transcript, so the continuation isn't mistaken for a rogue/duplicate agent.Problem to solve
When a config reload /
gateway restartchanges the system prompt mid-conversation, theclaude-clibackend invalidates its resumable CLI session, mints a new CLI session id, and replays the full transcript into the fresh session with the boilerplate "Continue this conversation using the OpenClaw transcript below as prior session history. Treat it as authoritative context for this fresh CLI session."This reset is completely silent to the active conversation — it's only visible in host-side
[agent/cli-backend]logs. From inside the running agent (and to anyone watching the transcript directory), the replayed session is indistinguishable from a second, concurrent agent instance that holds the entire transcript and is taking real actions — editing live config, spawning sub-agents — with no user involvement. Current behavior is insufficient because it gives the agent no signal that "the other session is just me, resumed." An agent that cannot read host logs has no way to self-diagnose this and will, correctly on the available evidence, escalate it as possible tampering. The result is a manufactured security scare for an entirely benign, single-process event.Proposed solution
When a CLI session reset occurs, emit a lightweight event to the active session (and ideally to the channel surface), including the reason and the old/new CLI session ids. For example, a one-line system notice:
Specifics:
[agent/cli-backend]logs.reason,oldSessionId,newSessionId,historyReplayed: true.Alternatives considered
Impact
claude-cliruntime; all channel surfaces (observed on webchat); most acutely, agents instructed to monitor their own state for tampering, and security-conscious operators.gateway restart. For an actively-managed instance this is common, not an edge case.Evidence/examples
Real incident, 2026-06-24, OpenClaw
2026.6.10 (aa69b12), containerized single runtime (PID 8,activeSessions=1throughout):Two config edits to
agents.defaults.model.fallbacks+gateway restart(SIGUSR1) reloads at 19:38 and 19:41:54. At 19:43:41 the backend reset:A new transcript
.../claude/projects/<workspace>/4b2a0475-….jsonlappeared, first entry aqueue-operationwith the "Continue this conversation…" boilerplate. The replayed session then editedopenclaw.jsonand spawned a sub-agent. The active webchat session had gone idle at 19:43:23 (message_completed) — so this was sequential, same process, not concurrent — but nothing surfaced that fact, and it was initially investigated as a possible rogue/uncoordinated writer before host logs confirmed it benign.Additional information
openclaw.jsonwrites. With the current single-long-lived-process architecture a real race is unlikely, but if two runtimes ever coexisted they could clobber each other's edits. An advisoryflock(or atomic write + compare-and-swap) on config persistence would be belt-and-suspenders — happy to split into a separate issue if preferred.