Skip to content

fix: dedupe single-instance fallback handoff and relax activation polling#699

Merged
Orinks merged 3 commits into
devfrom
fix/single-instance-activation-cleanup
May 28, 2026
Merged

fix: dedupe single-instance fallback handoff and relax activation polling#699
Orinks merged 3 commits into
devfrom
fix/single-instance-activation-cleanup

Conversation

@Orinks
Copy link
Copy Markdown
Owner

@Orinks Orinks commented May 28, 2026

Stacked on #698 (base is fix/single-instance-handle-truncation, not dev). Retarget to dev after #698 merges.

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

  1. Dedupe the fallback handoff (correctness). When the named-pipe IPC is unavailable, request_existing_instance_show used 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 plain generic_fallback that a successful window restore already satisfied, while discussion/alert_details intents — which the window poke can't carry — are still handed off. Window-restore logic extracted into _show_existing_window.
  2. Relax the handoff poll 750ms → 2000ms via a named constant. The file handoff is only a fallback to IPC, so it doesn't need sub-second latency and shouldn't run a perpetual high-frequency timer for the whole session.
  3. Document the "allow startup on any failure" policy in 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

Base automatically changed from fix/single-instance-handle-truncation to dev May 28, 2026 21:57
Orinks and others added 2 commits May 28, 2026 17:59
…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>
@Orinks Orinks force-pushed the fix/single-instance-activation-cleanup branch from 7cae3e3 to e1a0548 Compare May 28, 2026 22:00
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>
@Orinks Orinks merged commit eb8c62c into dev May 28, 2026
3 checks passed
@Orinks Orinks deleted the fix/single-instance-activation-cleanup branch May 28, 2026 22:07
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.

1 participant