claude-code - 💡(How to fix) Fix [BUG] Subagents falsely report task completion without verifying file changes were written [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#46755Fetched 2026-04-12 13:33:54
View on GitHub
Comments
2
Participants
3
Timeline
9
Reactions
1
Author
Timeline (top)
labeled ×5commented ×2cross-referenced ×2

Error Message

Error Messages/Logs

Root Cause

Root cause hypothesis: Agents appear to read files and plan changes correctly, but report completion without verifying the file was actually written. They do not re-read files after editing to confirm the change is present.

Fix Action

Fix / Workaround

A simple mitigation that works: having the parent agent (not the subagent) read all claimed-changed files after the subagent returns, and verify diffs. This was adopted as a workaround in this session but should be enforced at the framework level.

RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

When delegating tasks to subagents via the Agent tool, agents consistently report tasks as "done" or "fixed" without having actually written changes to disk, or having made only partial fixes while reporting full resolution.

Observed pattern across multiple tasks in a single session:

  1. Agent reports: "Fixed SellService.ts — commission now reads from WalletTransaction" → Reality: The file still had the original calculation clientFinalPrice * (partnerCommission / 100) — no change was made.
  2. Agent reports: "All 3 report pages now have VAutocomplete with debounced search" → User verification: filters were not working in the UI.
  3. Agent reports: "Dashboard refresh button now reloads full state" → Reality: DashboardHeader.vue was only refreshing its own local data, never emitting to parent.
  4. Agent reports: "CHANGELOG.md created" → Reality: File did not exist when checked immediately after.
  5. Multiple agents fixed commission calculations in some services but silently missed others — reporting the whole task as complete.

Root cause hypothesis: Agents appear to read files and plan changes correctly, but report completion without verifying the file was actually written. They do not re-read files after editing to confirm the change is present.

What Should Happen?

After every Edit or Write tool call, the agent should automatically re-read the edited lines to confirm the change is present in the file before reporting the task as complete.

Agents should never report a task complete without having read back the final state of every changed file.

A "verify mode" or post-edit read-back should be enforced as part of the agent's completion criteria.

Error Messages/Logs

Steps to Reproduce

  1. Spawn a subagent with the Agent tool and ask it to fix a specific bug in a backend service file (e.g. "change line 39 of SellService.ts from clientFinalPrice * pct to price * pct")
  2. Agent reports: "Fixed — partnerCommissionAmount = price * (partnerCommission / 100)"
  3. Read the file manually using the Read tool
  4. Observe that line 39 still contains the original code — no change was written

Reproduction rate: Approximately 40–60% of claimed fixes were either absent or incomplete upon manual verification across a single multi-task session.

Project context: TypeScript monorepo (Fastify + Vue 3). Agent tasks involved editing both backend services (api/src/services/) and frontend components (front/src/modules/).

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

2.1.101 (Claude Code)

Claude Code Version

2.1.101 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

Informações adicionais: The issue is particularly damaging in production codebases because:

  • The developer trusts the agent's completion report
  • Broken code is shipped without the developer realising the fix was never applied
  • Reproducing the issue requires manually reading every file the agent claimed to change

A simple mitigation that works: having the parent agent (not the subagent) read all claimed-changed files after the subagent returns, and verify diffs. This was adopted as a workaround in this session but should be enforced at the framework level.

Session evidence: multiple consecutive subagent tasks in the same session exhibited this behaviour, suggesting it is not an isolated incident.

extent analysis

TL;DR

Enforce a "verify mode" or post-edit read-back in the agent's completion criteria to confirm changes are written to files before reporting tasks as complete.

Guidance

  • Implement an automatic re-read of edited lines after every Edit or Write tool call to verify changes are present in the file.
  • Enforce a verification step at the framework level, where the parent agent reads all claimed-changed files after the subagent returns and verifies diffs.
  • Consider adopting the workaround of having the parent agent verify changes after the subagent returns, as a temporary mitigation.
  • Review the agent's reporting logic to ensure it only reports tasks as complete after verifying the changes are written to files.

Example

No explicit code example is provided, but the fix would involve modifying the agent's completion criteria to include a verification step, such as:

// Pseudocode example
afterEditOrCreate(file, changes) {
  // Write changes to file
  // ...
  // Re-read the file to verify changes
  const verifiedChanges = reReadFile(file);
  if (verifiedChanges === changes) {
    reportTaskComplete();
  } else {
    reportTaskFailed();
  }
}

Notes

The exact implementation details may vary depending on the specific requirements and constraints of the project. The provided example is a simplified illustration of the concept.

Recommendation

Apply the workaround of having the parent agent verify changes after the subagent returns, as a temporary mitigation, until a more permanent fix can be implemented at the framework level. This will help prevent broken code from being shipped without the developer realizing the fix was never applied.

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