Skip to content

Fix Pi feedback delivery after reload - #1240

Merged
backnotprop merged 1 commit into
backnotprop:mainfrom
Whamp:fix/pi-reload-feedback-routing
Aug 9, 2026
Merged

Fix Pi feedback delivery after reload#1240
backnotprop merged 1 commit into
backnotprop:mainfrom
Whamp:fix/pi-reload-feedback-routing

Conversation

@Whamp

@Whamp Whamp commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Problem

A Plannotator browser tab can outlive a Pi /reload. When its feedback arrives, the old callback correctly finds a newly registered Pi runtime, but current-pi-session.ts rejects that runtime as same-session because reload preserves the Pi session ID and file.

The callback then falls through to the stale captured pi object and reports:

This extension ctx is stale after session replacement or reload.

The notification fallback fails for the same reason.

Fix

Track the in-process extension runtime token as part of PiSessionIdentity. A reload now counts as a different active runtime even when its persistent session ID is unchanged. Existing session-ID/file comparison remains the fallback for identities without runtime tokens.

Test

Added a regression test that registers a replacement runtime with the same session ID and verifies both feedback and notification delivery go only to the replacement.

1 pass
0 fail
6 expect() calls

Focused command:

cd /tmp
npx --yes bun test /tmp/plannotator-debug/apps/pi-extension/current-pi-session.test.ts

@backnotprop
backnotprop merged commit 033368e into backnotprop:main Aug 9, 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

Development

Successfully merging this pull request may close these issues.

2 participants