fix(pi): notify review URL in RPC sessions - #1407
Conversation
|
Thanks for the careful writeup on both the issue and the PR. The diagnosis is right: ctx.mode is the documented discriminator (ExtensionMode = "tui" | "rpc" | "json" | "print", required, and hasUI is true in both TUI and RPC so it cannot stand in for it). The one-line change typechecks and does fix the submit_plan and archive paths. Three things before this can land.
called at index.ts:659, :958 and :1048 for /plannotator-review, /plannotator-annotate and /plannotator-last. Its own comment says the after-turn notify inside openBrowserForServer "fires too late to render". So under RPC those three still show a URL-less message. Could you check in a real Pi Web session whether the notify renders there, and extend sessionOpenedMessage if it does not?
Heads up that #1184 (open) rewrites this exact hunk to notify unconditionally, which covers RPC, Codex desktop and any future host without reading ctx.mode at all. That is the same argument your issue makes one host later, and it is probably where this should converge. Worth syncing with that PR rather than both of you landing on the same four lines. AI-assisted (Claude) under maintainer direction. |
Summary
Pi Web runs extensions with
ExtensionContext.mode === "rpc". In this mode,Plannotator's
isRemoteSession()can remain false even though the user cannotdirectly access the browser launched by the Pi Web host process.
openBrowserForServer()currently notifies the URL only for remote sessions orwhen browser launch reports failure. A successful browser spawn in the Pi Web
host can therefore hide the URL from the RPC session.
Treat RPC extension contexts like remote sessions for the purpose of URL
notification:
Behavior
PLANNOTATOR_REMOTEsessions keep their existing behavior.ctx.ui.notify()evenwhen the browser launcher reports success.
and port forwarding are unchanged.
it only exposes the URL to the user so an explicitly configured access path
can be used.
Test plan
PLANNOTATOR_REMOTE=0.BROWSERat the current Node executable, so no real browseris opened while the launcher still reports success.
[Plannotator] <url>notification.
git diff --checkpasses.in the development environment; GitHub Actions should run the repository's
standard checks.
Closes #1406