You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ISAStaleWriteGuard.recordView() hashes the whole file after an offset/limit Read, so a whole-file Write from a 5-line view passes the guard #2187
So a session that read 5 lines of a 200-line ISA is credited with a hash of all 200, and a later whole-file Write passes the guard. That is exactly the case the hook exists to catch.
Repro
# 12-line ISA whose C2 was closed by another session
echo '{"session_id":"sess-A","tool_name":"Read","tool_input":{"file_path":"<path>/ISA.md","offset":1,"limit":5},"tool_response":{}}' \
| bun hooks/ISAStaleWriteGuard.hook.ts
echo '{"session_id":"sess-A","tool_name":"Write","tool_input":{"file_path":"<path>/ISA.md","content":"clobber"}}' \
| bun hooks/PreToolGuard.hook.ts; echo "exit=$?"
Observed: the view file records the hash of all 12 lines after a read of 5, and PreToolGuard exits 0 — the whole-file Write is allowed.
Expected
A partial read is not a view. The Write blocks with the guard's stale-write message, or the path falls back to "never observed here", which is the documented fail-open state and is strictly safer than a false full view.
Fix sketch
In the import.meta.main branch, skip recordView when tool_input.offset or tool_input.limit is present — or record a "partial" sentinel that check() treats as a mismatch.
Raised as an issue rather than a PR because the choice between "skip the record" and "record a sentinel that actively blocks" changes how noisy the guard gets on large ISAs, and that is the maintainer's call.
This is Shiva, Eugene's AI Assistant, reporting on Eugene's behalf.
Confirmed. recordView() hashed the whole file regardless of Read offset/limit, so a partial Read passed the guard as if the whole file had been reviewed. Now skips recordView() on partial Reads, falling back to the documented fail-open behavior.
Environment: ThinkPad, Ubuntu 24.04.4 LTS, Ryzen AI 9 HX PRO 370, Bun 1.3.11.
Thanks @Bowlerjim. We took the "skip the record" option with one refinement. A partial Read never advances a full view the session already has. If a partial Read is the session's first look at the ISA, it records a view, so an edit by another session afterwards still blocks a whole-file Write. There are tests for both paths. It goes out in the next public release (8.3.0).
Closing this out. I checked the fix described above in source and its tests: a partial Read never advances an existing full view. Next release carries it.
Activity
waveman2020-sudo commentedon Sep 23, 2026
This is Shiva, Eugene's AI Assistant, reporting on Eugene's behalf.
Confirmed.
recordView()hashed the whole file regardless of Read offset/limit, so a partial Read passed the guard as if the whole file had been reviewed. Now skipsrecordView()on partial Reads, falling back to the documented fail-open behavior.Environment: ThinkPad, Ubuntu 24.04.4 LTS, Ryzen AI 9 HX PRO 370, Bun 1.3.11.
danielmiessler commentedon Sep 28, 2026
Thanks @Bowlerjim. We took the "skip the record" option with one refinement. A partial Read never advances a full view the session already has. If a partial Read is the session's first look at the ISA, it records a view, so an edit by another session afterwards still blocks a whole-file Write. There are tests for both paths. It goes out in the next public release (8.3.0).
danielmiessler commentedon Oct 3, 2026
Closing this out. I checked the fix described above in source and its tests: a partial Read never advances an existing full view. Next release carries it.