Don't resend read_file when the file hasn't changed. - #1359
Dhirenderchoudhary wants to merge 3 commits into
Conversation
nc-review: comments — 1 important, 4 nits@Dhirenderchoudhary — a few things worth a look, none blocking. Adds a stub-on-repeat path for read_file when (path, range, mtime, size) match a prior read, plus per-subagent stub scopes via AsyncLocalStorage, and wires compact/clear/writes to invalidate stubs while leaving the edit guard untouched. The core stub logic is sound and the new read-tracker tests are tight; the changes are coherent with issue #793 and ready to merge once the small wording and coverage issues below are addressed. 🟠 important · The behavioural change that subagents now run inside ⚪ nit · The stub message and the new tool description both tell the model it can ⚪ nit · In ⚪ nit ·
⚪ nit · The new 🔴 blocking · 🟠 a reviewer would ask for a change · ⚪ optional Automated code review — correctness, security, design, tests, plus duplicates and scope. A human still decides; this is not a substitute for review and is not exhaustive. The required status checks separately cover lint, formatting, types, unused dependencies, the test suite and the build. This bot never merges. Maintainers can rerun with |
Description
Phase 2 of #793. Repeat
read_fileon the same path and line range now returns a one-line stub if mtime/size have not changed, instead of dumping the file again.Compact and
/compact(including--restore) bump a generation so the next read is real./clearwipes the stub map with the edit guard. Writes drop that path. Subagents get their own stub scope so a parent read cannot stub a file they never saw.markFileSeenis still just the edit guard. Not a 5-stage compiler. Phase 1 (auto-compact on--plain/ ACP / subagents) is already on main.Type of Change
Changeset
pnpm changeset) describing this change for the changelogDocs-only or internal chores need no changeset (or run
pnpm changeset --emptyto note that intentionally).Testing
Automated Tests
.spec.ts/tsxfilespnpm test:allcompletes successfully)Manual Testing
Checklist