Skip to content

Stage F: make FILE_NOT_FOUND self-correcting with a sibling listing#8

Closed
Anmolnoor wants to merge 1 commit into
stage-e/content-gen-and-retry-fixesfrom
stage-f/helpful-not-found
Closed

Stage F: make FILE_NOT_FOUND self-correcting with a sibling listing#8
Anmolnoor wants to merge 1 commit into
stage-e/content-gen-and-retry-fixesfrom
stage-f/helpful-not-found

Conversation

@Anmolnoor
Copy link
Copy Markdown
Owner

Context

Live testing turned up a dead-end: asking the agent to read a file by description, it guessed a filename (res/anmolnoor-report.md), got a bare "File does not exist.", and — with nothing to correct from — repeated the same wrong path until the no-progress detector stopped the turn. The real file was res/anmolnoor-github-report.md.

The agent should discover, not require exact hand-fed paths. A good not-found error makes that automatic.

Note: based on stage-e/content-gen-and-retry-fixes; merge order #3#4#5#6#7 → this.

What changed

FILE_NOT_FOUND (across read, read_chunk, edit, apply_diff) now reports:

  • the missing path,
  • the entries in its parent directory (a "did you mean", capped at 12), and
  • a suggestion to discover paths via foundation.files.

So instead of File does not exist., the model sees:

File does not exist: res/anmolnoor-report.md. Directory 'res/' contains: anmolnoor-github-report.md.

— and self-corrects on the next iteration. Same "make failures legible" spirit as Stage A's truncation work. The listing only covers the already-resolved (in-scope / granted) parent, so it adds no new access.

Tests

2 new (403 total, ruff clean): a missing-file read names the real sibling in the error + sets a suggestion; an orchestrator turn that reads the wrong name surfaces the real filename into the next iteration's planning context and the corrected read executes.

🤖 Generated with Claude Code

A wrong-filename guess dead-ended: file.read returned a bare "File does not
exist.", so the model had nothing to correct with and repeated the same bad
path until the no-progress detector stopped it.

Now FILE_NOT_FOUND (read, read_chunk, edit, apply_diff) reports the missing
path plus the entries in its parent directory and a suggestion to discover
paths via foundation.files. The model can self-correct on the next iteration
instead of guessing again — same "make failures legible" spirit as Stage A.

Tests: read of a missing file names the real sibling in the error; an
orchestrator turn that reads the wrong name surfaces the real filename into the
next iteration's context and the corrected read succeeds.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Anmolnoor
Copy link
Copy Markdown
Owner Author

Merged into main via commit 27c97b0 (stages A–G landed as one merge). See the summary on #9.

@Anmolnoor Anmolnoor closed this May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant