[Bug] Deep-research workflow loses progress on token/spend limit, restarts from zero on resume
Bug Description
Title: deep-research does not resume after hitting the token/spend limit — it restarts from zero
Summary
The deep-research skill runs as a Workflow that fans out (dozens of search +
verification subagents). When a run is interrupted by the period spend limit,
there is no durable checkpoint: the resume state lives in a session-scoped cache
(resumeFromRunId is same-session only) that is lost as soon as the session ends.
Re-invoking the skill starts a brand-new run and repeats the entire fan-out from
scratch, so the tokens already spent produce nothing.
Steps to reproduce
- Run /deep-research on a broad topic.
- The run hits the period spend limit and is cut off before producing any
deliverable.
- Wait for the limit to reset, then re-run /deep-research on the same topic.
- Observed: the run starts over from zero and consumes the whole quota again,
still with no result.
Observed behavior
- Two consecutive runs were cut off by the spend limit.
- Each run consumed 100% of the available quota and produced no final report.
- Verified, sourced claims gathered before each cutoff were only persisted in the
session transcript on disk, never surfaced as a usable deliverable.
- Re-launching the skill after the reset repeated the full fan-out instead of
continuing where it stopped.
Expected behavior
- A run interrupted by the spend/token limit should be resumable and continue from
where it stopped, without re-doing already-completed and already-verified work.
- Partial progress (verified claims) should be checkpointed to durable storage
(e.g. written out incrementally) so an interruption never results in total loss.
Impact
- Full quota burned twice with zero usable output.
- The natural recovery action (wait for reset, relaunch) actively makes it worse,
since relaunching always restarts.
Suggested fixes
- Persist run state (script + runId + completed-agent cache) durably so resume
works across sessions, not just within one.
- Add a "resume last run" path distinct from launching a fresh run.
- Checkpoint verified claims to a file/note incrementally during the run.
- Respect an explicit token/cost budget so the fan-out is sized to fit rather
than overrunning the limit.
Environment
- Claude Code, model Fable 5.
- Billing: monthly spend limit (was €40 at time of the incident).
- Skill: deep-research (built-in), running as a Workflow.
Environment Info
- Platform: linux
- Terminal: ghostty
- Version: 2.1.216
- Feedback ID: 42de5846-f4e5-4833-9989-8effed1d8a5a
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗