claude-code - 💡(How to fix) Fix Subagent ignores tool-call denials and keeps fetching instead of summarizing existing context [1 pull requests]

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…

When a user denies a tool call inside a running subagent (e.g. denying a WebFetch), the agent should treat this as a signal to stop gathering and summarize what it already has. Instead, it treats each denial as a temporary obstacle and immediately tries the next URL on its list — continuing to accumulate tool uses and cost.

Root Cause

  • In this specific case: ~98 WebFetch calls were made, costing ~$1.15, before the session was force-killed via Ctrl+C
  • The user explicitly tried to stop the agent mid-run by denying tool calls — the signal was ignored
  • The useful context from the first ~98 fetches was lost because the agent never got to summarize

Fix Action

Fixed

RAW_BUFFERClick to expand / collapse

Summary

When a user denies a tool call inside a running subagent (e.g. denying a WebFetch), the agent should treat this as a signal to stop gathering and summarize what it already has. Instead, it treats each denial as a temporary obstacle and immediately tries the next URL on its list — continuing to accumulate tool uses and cost.

Steps to reproduce

  1. Spawn a subagent with a research prompt (e.g. "search Reddit and HN for user opinions on X")
  2. The agent starts fetching URLs in sequence
  3. User denies one of the WebFetch tool calls via the permission prompt
  4. Expected: agent stops fetching, uses its existing context to produce the summary
  5. Actual: agent finds the next URL and tries again — indefinitely

Impact

  • In this specific case: ~98 WebFetch calls were made, costing ~$1.15, before the session was force-killed via Ctrl+C
  • The user explicitly tried to stop the agent mid-run by denying tool calls — the signal was ignored
  • The useful context from the first ~98 fetches was lost because the agent never got to summarize

Expected behavior

A tool-call denial inside a subagent should be treated as "stop and use what you have." The agent has already gathered substantial context — it should synthesize that into a response rather than continuing to search.

This is similar to how a human researcher would respond to "stop, tell me what you found so far" — not by trying to open another browser tab.

Suggested fix

When a tool call is denied inside a subagent:

  • Inject a system message along the lines of: "The user denied this tool call. Stop gathering and summarize your findings from the context you already have."
  • Or: treat repeated denials (2+) as an implicit stop_sequence

Environment

  • Claude Code CLI
  • Model: claude-sonnet-4-6 (subagent)
  • Platform: macOS

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…

FAQ

Expected behavior

A tool-call denial inside a subagent should be treated as "stop and use what you have." The agent has already gathered substantial context — it should synthesize that into a response rather than continuing to search.

This is similar to how a human researcher would respond to "stop, tell me what you found so far" — not by trying to open another browser tab.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING