Skip to content

fix(post-tool): scope Bash marker clear to the command's own files (#83)#87

Merged
Cannon07 merged 2 commits into
mainfrom
fix/bash-post-tool-scoped-marker-clear
Jun 11, 2026
Merged

fix(post-tool): scope Bash marker clear to the command's own files (#83)#87
Cannon07 merged 2 commits into
mainfrom
fix/bash-post-tool-scoped-marker-clear

Conversation

@Cannon07

Copy link
Copy Markdown
Owner

Summary

Fixes #83. When an agent issues multiple separate Bash commands that touch files (several rm deletes, shell writes), accepting the first command's PostToolUse cleared 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:

changes.clear_by_statuses({ "deleted", "bash_modified", "bash_created" })

That avoided clobbering modified markers 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 and changes.clear() only that command's rm_paths / write_paths — mirroring how the ApplyPatch branch closes specific files via patch_paths. Scoped clear, no global wipe; helps every backend.

  • Concurrent pending Bash commands keep their markers until each is accepted.
  • Concurrent Edit/Write modified / created markers stay untouched — those paths never appear in a shell command's detection.
  • Removed the now-orphaned changes.clear_by_statuses helper (it only backed the global sweep, no caller/test remained).

Tests

Added regression specs in post_tool_handle_spec.lua:

  • Two pending Bash deletes → accept the first → only its marker clears, the second survives.
  • Same for shell writes (bash_created / bash_modified).
  • Updated a pre-existing test that encoded the old global-clear behaviour (its command touched only a.txt but asserted b.txt cleared too).

Full plenary suite green — all 9 spec files, 0 failures / 0 errors.

🤖 Generated with Claude Code

Cannon07 and others added 2 commits June 12, 2026 01:35
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>
@Cannon07 Cannon07 merged commit 895c7db into main Jun 11, 2026
3 checks passed
@Cannon07 Cannon07 deleted the fix/bash-post-tool-scoped-marker-clear branch June 11, 2026 20:44
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.

Bash post-tool clears neo-tree markers globally, wiping concurrent Bash command markers

1 participant