fix(pst): suppress double browser-open for same URL (10s dedup)#74
Merged
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
gh pr create then gh pr edit --body-file fire the hook back-to-back for the same URL, opening the browser twice. Fix: 10-second recency dedup cache at ~/.cache/pst-hooks/open-on-post-dedup.json. Atomic write (tmp+rename), self-healing on corrupt JSON, cross-session scope documented in comments. Co-Authored-By: Claude Sonnet 4.6 <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
gh pr createfollowed immediately bygh pr edit --body-filefired the open-on-post hook twice for the same PR URL, opening the browser back-to-back.gh pr createandgh pr edit --body(-file)match the hook's posting-detection regex, so a create+immediate-description-update pattern produces two opens.~/.cache/pst-hooks/open-on-post-dedup.json. Same URL within 10s is suppressed; genuine re-opens after the TTL pass through normally.Implementation details:
File.rename(POSIX-atomic, safe for concurrent hook processes)JSON::ParserErrordeletes the corrupt cache and starts freshTest plan
~/.cache/pst-hooks/open-on-post-dedup.jsonmanually -- next open self-heals (deletes file, opens normally)PST_NO_BROWSER=1 gh pr create-- no browser open🤖 Generated with Claude Code