fix: dedupe single-instance fallback handoff and relax activation polling#699
Merged
Conversation
…lling Three small cleanups to the single-instance activation path: - request_existing_instance_show: on the IPC-fallback path, the handoff file was always written *and* the window was poked directly, so a primary instance could act on the same request twice (once via the 750ms handoff poll, once via the direct restore). Now the handoff is skipped for a plain generic_fallback that a successful window restore already satisfied, while discussion/ alert_details intents — which the window poke cannot carry — are still handed off. Window restore logic extracted into _show_existing_window. - Relax the handoff poll from 750ms to 2000ms via a named constant. The file is only a fallback to the named-pipe IPC, so it doesn't need sub-second latency and shouldn't run a perpetual high-frequency timer for the whole session. - Document the "allow startup on any failure" policy in try_acquire_lock. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
7cae3e3 to
e1a0548
Compare
Exercises _start_activation_handoff_polling with wx mocked so the changed Timer.Start call is covered, and pins the interval constant at 2000ms. 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.
Follow-up cleanup to the single-instance activation path. No relation to the ABI fix in #698 beyond touching the same files — kept separate so each PR has one thesis.
Changes
request_existing_instance_showused to both write the handoff file and poke the window directly — so the primary instance could act on the same request twice (once via the handoff poll, once via the direct restore). Now the handoff is skipped for a plaingeneric_fallbackthat a successful window restore already satisfied, whilediscussion/alert_detailsintents — which the window poke can't carry — are still handed off. Window-restore logic extracted into_show_existing_window.try_acquire_lock.Tests
Two new tests assert the dedupe: generic-on-success writes no handoff;
discussion-on-success still does. 32/32 single-instance + activation tests pass.🤖 Generated with Claude Code