Repository navigation
Description
Version: 2026.5.26 (10ad3aa)
Provider: anthropic/claude-sonnet-4-6 (also seen with fallback chain)
Frequency: 42 occurrences in ~3 hours across 4 distinct sessions, on a host that ran 2026.5.18 cleanly for weeks.
Pattern
Each occurrence follows the same sequence in the master log:
[T+0] embedded run auto-compaction start
[T+60s] compaction retry aggregate timeout (60000ms): proceeding with pre-compaction state
[T+60s] using pre-compaction snapshot: timed out during compaction
[T+60s] embedded run failover decision
[T+60s] lane task error: lane=main … error="Error: Cannot continue from message role: assistant"
[T+60s] lane task error: lane=session:agent:<id>:whatsapp:direct:<num> error=same
[T+60s] model fallback decision
The user-visible result is a generic "Auto-compaction could not recover this turn" delivered to the channel even though the assistant had produced content in the previous turn.
Apparent root cause
After the compaction timeout, the gateway falls back to the pre-compaction snapshot but then ships a prompt whose last message has role: assistant. The Anthropic API correctly rejects this. The fallback path that retries with a different provider hits the same shaped prompt and also fails.
What I tried
daemon restart— bug recurs on next message even in a fresh session.- Reducing system-prompt bloat (M365 MCP filtered from 125 → 31 tools, schema chars 673k → 116k) — does not fix the role error; only delays compaction triggers.
compaction.reserveTokensFloor: 20000(per upgrade notes) — present, doesn't help.
Reproduces with
- Long-running session that accumulates tool-call exchanges
- Bootstrap > 100k tokens (pushes auto-compaction earlier)
- Sonnet 4.6 primary; same error after fallback to gemini-2.5-flash
Happy to share full anonymized log slice if useful.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon May 28, 2026
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed May 27, 2026, 9:19 PM ET / 01:19 UTC.
Summary
Keep open: current main still has a plausible source-level path where compaction-timeout recovery can reuse an assistant-tailed transcript and then hit the existing continuation guard, and there is no merged fix or canonical issue that fully owns this exact 2026.5.26 regression.
Reproducibility: no. live current-main replay was run, but the source path is clear enough to reproduce with a long session whose compaction retry times out and whose selected snapshot ends in an assistant message. The reporter’s log sequence matches current logging and recovery text.
Ways to help us reproduce this
Next step
A bounded repair looks possible in the compaction-timeout retry and session continuation path, but the worker must first add a focused source-level regression for the reported assistant-tail failure.
Review details
Best possible solution:
Normalize the compaction-timeout recovery path so retries never continue or submit provider prompts from an assistant-tailed snapshot, while preserving already delivered assistant content and avoiding duplicate user-turn persistence.
Do we have a high-confidence way to reproduce the issue?
No live current-main replay was run, but the source path is clear enough to reproduce with a long session whose compaction retry times out and whose selected snapshot ends in an assistant message. The reporter’s log sequence matches current logging and recovery text.
Is this the best way to solve the issue?
Unclear as an implementation, because no patch is present yet. The maintainable fix should be in the compaction-timeout retry/snapshot boundary or continuation guard, not in provider-specific fallback wording.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 5846878924b5.
Label changes
Label changes:
P1: The report describes a latest-release regression that repeatedly breaks long-running channel sessions after auto-compaction timeout.impact:message-loss: The channel receives a recovery failure instead of the expected continued answer after the affected turn.impact:session-state: The failure is about compaction/retry state selecting or replaying the wrong transcript boundary.issue-rating: 🐚 platinum hermit: Current issue advisory state selects this label.clawsweeper:needs-live-repro: Current issue advisory state selects this label.Label justifications:
P1: The report describes a latest-release regression that repeatedly breaks long-running channel sessions after auto-compaction timeout.impact:session-state: The failure is about compaction/retry state selecting or replaying the wrong transcript boundary.impact:message-loss: The channel receives a recovery failure instead of the expected continued answer after the affected turn.Evidence reviewed
Acceptance criteria:
What I checked:
agentLoopContinuestill throwsCannot continue from message role: assistantwhenever the context tail is an assistant message, matching the reported error string. (packages/agent-core/src/agent-loop.ts:83, 5846878924b5)timedOutDuringCompactionand selects the pre-compaction snapshot when available before building the result metadata. (src/agents/embedded-agent-runner/run/attempt.ts:4787, 5846878924b5)src/agents/embedded-agent-runner/run/compaction-timeout.test.ts:99, 5846878924b5)src/auto-reply/reply/agent-runner-execution.ts:1140, 5846878924b5)Likely related people:
packages/agent-core/src/agent-loop.ts,src/agents/sessions/agent-session.ts,src/agents/embedded-agent-runner/run/attempt.ts)src/agents/embedded-agent-runner/run/attempt.ts)src/agents/embedded-agent-runner/run/attempt.ts)How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper autofix,@clawsweeper automerge,@clawsweeper fix ci, or@clawsweeper address review.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.