-
Notifications
You must be signed in to change notification settings - Fork 0
feat(pi): open plan mode docs in Fleet modal #201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # Fleet bridge handler return type and lint | ||
|
|
||
| ## Symptom | ||
|
|
||
| While adding the Pi plan-open bridge command, changing `FleetBridgeServer`'s `RequestHandler` from `Promise<unknown>` to `unknown | Promise<unknown>` made lint report: | ||
|
|
||
| - `@typescript-eslint/no-redundant-type-constituents` because `unknown` absorbs the union | ||
| - `@typescript-eslint/await-thenable` at the call site that awaited the handler result | ||
|
|
||
| ## Fix | ||
|
|
||
| Keep `RequestHandler` as `Promise<unknown>` and keep bridge request handlers `async`. If a handler is currently synchronous, use a real async boundary rather than changing the framework type. | ||
|
|
||
| ## Lesson | ||
|
|
||
| Do not use `unknown | Promise<unknown>` for async callback return types in this codebase. It looks flexible, but lint treats `unknown` as overriding the promise branch and then flags awaited values as non-thenable. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # Pi plan modal bridge disconnect handling | ||
|
|
||
| ## Symptom | ||
|
|
||
| The Pi plan modal response flow initially assumed that once `pi.plan_open` returned, the Fleet bridge would stay connected until the user clicked Approve/Reject/Continue. If the WebSocket disconnected after opening the modal but before the response, `exit_plan_mode` could wait forever. After adding delivery failure checks, the modal could also become effectively unclosable because every dismissal path tried to send `continue` through the disconnected bridge. | ||
|
|
||
| ## Fix | ||
|
|
||
| - Add a disconnect callback to the Fleet Pi bridge extension client. | ||
| - Have pending `exit_plan_mode` response waiters resolve as `continue` on bridge disconnect, matching abort behavior. | ||
| - Make renderer-side response delivery failures visible but non-blocking by showing an error with a direct Dismiss escape hatch. | ||
| - When invoking disconnect handlers, iterate over a copy so handlers can unsubscribe themselves without skipping later handlers. | ||
|
|
||
| ## Lesson | ||
|
|
||
| For two-way UI flows over an agent bridge, handle all lifecycle edges explicitly: | ||
|
|
||
| 1. Request opened but response never arrives. | ||
| 2. Response send fails after user action. | ||
| 3. User needs a local dismiss path even if the agent can no longer be notified. | ||
| 4. Event handler arrays must tolerate handlers unregistering during dispatch. |
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exit_plan_modehangs forever if the Fleet bridge disconnects betweenbridge.sendresolving andpi.plan_responsearriving.createPlanResponseWaiter(L87-L113) only resolves on (a) a matchingpi.plan_responseevent, or (b) the tool-callsignalaborting. TheFleetBridgeClienttype (L32-L36) exposes no disconnect/close event, and the try/catch wraps onlybridge.send— once it returns, control passes toawait responseWaiter.promise. If the WS closes after that point (Fleet quits, network drop, etc.), no exception is thrown into the catch andpendingPlanResponseskeeps the entry forever.session_shutdown(L221-L227) only fires on the Pi session ending, not on bridge disconnect, so the tool call hangs indefinitely.