fix(post-tool): scope Bash marker clear to the command's own files (#83)#87
Merged
Merged
Conversation
The Bash PostToolUse branch cleared neo-tree markers by status, globally, wiping the still-pending markers of concurrent Bash commands: accepting the first of several batched deletes/writes cleared every deleted/bash_* marker, not just the accepted command's files. Re-run the deterministic shell detector on the post payload and clear only that command's rm_paths/write_paths — mirroring how the ApplyPatch branch closes specific files via patch_paths. Concurrent Bash commands keep their markers, and concurrent Edit/Write modified/created markers stay untouched (those paths never appear in a shell command's detection). Remove the now-orphaned changes.clear_by_statuses helper (it only backed the global sweep) and add regression specs: accepting one of two pending Bash deletes/writes clears only its own marker. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…#83) The OpenCode E2E harness stubbed `bash_after` with empty args, a relic of when the Bash post-tool did a global status sweep and ignored the command. Now that the post-tool re-detects the command to scope the marker clear, the empty stub no longer matches production: OpenCode's real after-hook carries the tool args on `input` (including the command), as documented in backends/opencode/index.ts. Forward the command through `bash_after` so the harness is faithful and the "OpenCode bash rm marks as deleted" regression exercises the real clear path. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #83. When an agent issues multiple separate Bash commands that touch files (several
rmdeletes, shell writes), accepting the first command'sPostToolUsecleared the neo-tree markers for all of them — the remaining pending commands were left unmarked.The Bash post-tool branch cleared markers by status, globally:
That avoided clobbering
modifiedmarkers from concurrent Edit/Write, but it didn't stop concurrent Bash commands from clobbering each other.Fix
Re-run the deterministic
shell_detect.detect()on the post payload andchanges.clear()only that command'srm_paths/write_paths— mirroring how theApplyPatchbranch closes specific files viapatch_paths. Scoped clear, no global wipe; helps every backend.modified/createdmarkers stay untouched — those paths never appear in a shell command's detection.changes.clear_by_statuseshelper (it only backed the global sweep, no caller/test remained).Tests
Added regression specs in
post_tool_handle_spec.lua:bash_created/bash_modified).a.txtbut assertedb.txtcleared too).Full plenary suite green — all 9 spec files, 0 failures / 0 errors.
🤖 Generated with Claude Code