Workflow (multi-agent) resume restarts from the beginning after auto-compaction — silently re-runs completed agents
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet. Closest found: #63102 (resume cache unreachable), but that appears to be a different root cause: there the dispatcher can't re-transcribe
argsbyte-exactly. Here I resumed viascriptPath+resumeFromRunId(no arg re-typing), and the cache miss is caused by the run journal living under the pre-compaction session directory. Filing as a distinct bug; cross-referencing #63102. - [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code (
2.1.167)
What's Wrong?
A backgrounded Workflow (multi-agent / "ultracode" orchestration) was paused mid-run at Phase 4 (two parallel verification agents). Phases 1-3 (3 research agents -> design -> prototype) had completed. When I resumed with:
Workflow({ scriptPath: "<.../workflows/scripts/<workflow>-<runId>.js>", resumeFromRunId: "wf_b0b65ade-5c6" })
the workflow silently restarted from Phase 1, re-running the already-completed agents from scratch instead of replaying them from cache. The re-run agents were expensive read-only research agents, so this burned output tokens for zero new value, and there was no warning that the resume had found no cached results.
Root cause (observed): the session had been auto-compacted between launching the workflow and resuming it, which changed the session ID. Workflow resume appears to be same-session-only: the run's journal.jsonl (the resume cache) is stored under the original session's directory, so after compaction created a new session the resume couldn't locate the journal -> 0% cache hit -> full restart. The previous run's results were fully intact on disk and were recoverable manually from that journal.jsonl.
What Should Happen?
resumeFromRunIdshould resolve a run's journal by run ID across the whole project, regardless of which pre- or post-compaction session created it, so completed agents replay from cache and only the paused phase runs live.- On a genuine cache miss (no journal found, or 0% prefix hit), the resume should fail loudly (for example: "no cached results for
<runId>in this session; re-running from the start") rather than silently restarting, so the token cost is visible before it is incurred.
Error Messages/Logs
No error was emitted; the silent restart is part of the bug. Structural evidence from this run (runId = wf_b0b65ade-5c6):
Pre-compaction session:
- Workflow directory contained an intact `journal.jsonl` (~61 KB) plus 7 agent transcripts.
- The journal held 12 entries: 7 `started`, 5 `result`.
- Completed results included 3 research results (one was a transient `API Error: 500`), the design result (~29 KB), and the prototype result (~14 KB).
- Entries 10-11 were the two Phase-4 verify agents `started` with no `result`, matching the paused phase.
Post-compaction session:
- Different session ID, same `runId` directory.
- 3 brand-new research agents started ~8 hours later, meaning Phase 1 re-ran from scratch.
Steps to Reproduce
- Launch a multi-phase
Workflowin the background, for example research -> design -> prototype -> verify. - Pause it mid-run. In my case, it was paused at the Phase-4 parallel verify agents.
- Let the session auto-compact during a long conversation, creating a new session ID.
- Resume with
Workflow({ scriptPath, resumeFromRunId }).
Expected: Phase 1-3 agents replay from cache instantly; only the paused Phase-4 agents run live.
Actual: the workflow restarts from Phase 1 and re-runs completed agents.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
Unknown
Claude Code Version
2.1.167 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Other (zsh in Codex desktop)
Additional Information
Workaround: manually read the prior session's journal.jsonl (it contains each completed agent's result) and continue from those results instead of re-running the workflow.
The core issue is not that a resume can miss cache in all cases; it is that an auto-compaction boundary makes a valid resumeFromRunId unable to find its existing journal, and the workflow restarts silently rather than warning before spending tokens.
This issue has 10 comments on GitHub. Read the full discussion on GitHub ↗