Skip to content

fix(settings): include command in add-event dedup key (#2382) - #2431

Closed
gregario wants to merge 1 commit into
garrytan:mainfrom
gregario:fix/issue-2382
Closed

gregario wants to merge 1 commit into
garrytan:mainfrom
gregario:fix/issue-2382

Conversation

@gregario

@gregario gregario commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #2382 — gstack-settings-hook add-event deduplicates on (event, matcher, _gstack_source) but ignores the command field. When an entry loses its _gstack_source tag (or is re-registered under a different source), the same hook command is appended as a duplicate — firing N times per matching tool call.

The fix adds command to the match predicate: an entry with the same (event, matcher, command) is now treated as the same hook regardless of source tag. On match, the existing entry is updated in place (including refreshing its _gstack_source), preventing duplication and making add-event self-healing for untagged entries.

Verification

  • bun test test/gstack-settings-hook-schema-aware.test.ts green (15/15)
  • Two regression tests fail on main:
    • "dedup includes command: same (event, matcher, command) with different source updates in place"
    • "dedup includes command: untagged entry with same command is updated not duplicated"
    error: expect(received).toHaveLength(expected)
    Expected length: 1
    Received length: 2
    
  • Both pass after fix applied
  • Discrimination verified: reverting only bin/gstack-settings-hook causes both failures

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

Fixes garrytan#2382.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@trunk-io

trunk-io Bot commented Aug 1, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@garrytan

Copy link
Copy Markdown
Owner

Thank you — this was absorbed on main (credited in the v1.6x CHANGELOG entries; roster in PR #2604). Closing.

@garrytan garrytan closed this Aug 17, 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

2 participants