claude-code - 💡(How to fix) Fix [Bug] Background Agent produces no deliverable when parent session hits usage limit [2 comments, 3 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
anthropics/claude-code#55928Fetched 2026-05-05 06:02:42
View on GitHub
Comments
2
Participants
3
Timeline
5
Reactions
0
Author
Timeline (top)
labeled ×3commented ×2

Error Message

If agent fails, parent should see error/stderr, not "completed" status.

Code Example

[]
RAW_BUFFERClick to expand / collapse

Bug Description Claude Code Bug Report — Background Agent + Session Limit Date: 2026-05-04 Reporter: [email protected] Product: Claude Code CLI Summary Background Agent tool reports completion but produces no deliverable file when the parent session hits its usage limit mid-run. User loses work and has no way to recover agent output. Environment OS: Windows (path C:\Users\giris...) Mode: Auto mode active Plugins: context-mode, aws-serverless, document-skills, anthropic-skills, others Session usage at 98% when background agent launched Reproduction Parent session at 98% usage. Launch background research agent via Agent tool with run_in_background: true. Prompt instructs agent to Write final report to a specified absolute path. Receive notification: agent completed. Verify file at expected path → file does not exist. Re-launch second background agent with same instructions. Parent session hits usage limit before second agent completes. No SendMessage tool available in current toolset to query/resume agent. Expected Background agent that completes successfully should leave its Write artifacts on disk. If agent fails, parent should see error/stderr, not "completed" status. Parent session should be able to retrieve agent results even after usage limit (e.g. agent output persisted to a known location). Actual Agent reports complete; no file written. No mechanism to inspect agent failure without reading the JSONL transcript (which the harness explicitly forbids — "would overflow your context"). When parent session ends, background agent state and any in-flight work appears lost. Impact Silent data loss. User cannot trust "agent completed" notifications. Background agents are most valuable precisely when context is tight — but that is exactly when they fail opaquely. Suggested Fixes Persist background agent's final tool-call summary (especially Write paths) to a small status file the parent CAN safely read. Distinguish "agent finished its turn" from "agent achieved its goal" in notifications. Provide a SendMessage / AgentStatus tool by default so parent can query a completed background agent for its deliverables. When usage limit nears, surface a warning before background agents are launched so user can decide whether to defer. Agent IDs (for log lookup) a93ff8663f50186cc — first run, "completed" but no file written a66a22198a3656213 — second run, parent hit limit before completion

Environment Info

  • Platform: win32
  • Terminal: mintty
  • Version: 2.1.126
  • Feedback ID: eb4bff33-cc96-48e7-89ec-18ec4c04c175

Errors

[]

extent analysis

TL;DR

The issue can be mitigated by implementing a mechanism to persist background agent results to a safe location, such as a status file, to prevent silent data loss when the parent session hits its usage limit.

Guidance

  • Implement a status file to store the background agent's final tool-call summary, including Write paths, allowing the parent session to safely read the results.
  • Distinguish between "agent finished its turn" and "agent achieved its goal" in notifications to provide clearer status updates.
  • Consider adding a SendMessage or AgentStatus tool to query completed background agents for their deliverables.
  • Surface a warning when the usage limit is near, allowing users to decide whether to defer launching background agents.

Example

No code snippet is provided as the issue does not contain sufficient technical details to create a specific example.

Notes

The provided issue lacks specific technical details, such as code snippets or API documentation, making it challenging to provide a comprehensive solution. The suggested fixes are based on the problem description and may require further modification to fit the actual implementation.

Recommendation

Apply workaround: Implement a status file to store background agent results, as this provides a straightforward solution to prevent silent data loss and allows for easier debugging and recovery.

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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [Bug] Background Agent produces no deliverable when parent session hits usage limit [2 comments, 3 participants]