Repository navigation
feat(sidebar): mark sessions waiting for user input #461
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -600,6 +600,10 @@ export class AgentSessionWrapper { | |
| || this.pendingUiRequests.size > 0 || this.pendingHostTools.size > 0 || this.pendingHostUris.size > 0); | ||
| } | ||
|
|
||
| isAwaitingInput(): boolean { | ||
| return this.pendingUiRequests.size > 0; | ||
| } | ||
|
|
||
| /** Local history navigation is busy control work, not an interruptible model turn. */ | ||
| isEditingHistory(): boolean { | ||
| return this.historyEditInFlight; | ||
|
|
@@ -1465,7 +1469,8 @@ export class AgentSessionWrapper { | |
|
|
||
| /** Forget a pending dialog and its expiry timer. */ | ||
| private forgetPendingUiRequest(id: string): void { | ||
| this.pendingUiRequests.delete(id); | ||
| // An answered or expired dialog no longer waits on the user: the sidebar follows. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔥 The Roast: You added 🩹 The Fix: In 📏 Severity: critical |
||
| if (this.pendingUiRequests.delete(id)) notifyRunningChange(); | ||
| const timer = this.uiExpiryTimers.get(id); | ||
| if (timer) { | ||
| clearTimeout(timer); | ||
|
|
@@ -3109,6 +3114,8 @@ export interface RunningRpcSession { | |
| cwd: string; | ||
| /** Absent on this machine, as on `SessionInfo`: the sidebar groups a placeholder under it. */ | ||
| hostId?: string; | ||
| /** A blocking dialog (ask, confirm, input, …) waits for the user. */ | ||
| awaitingInput?: true; | ||
| } | ||
|
|
||
| export interface RunningSessionUpdate { | ||
|
|
@@ -3197,7 +3204,12 @@ export function getRunningRpcSessions(): RunningRpcSession[] { | |
| for (const [sessionId, session] of getRegistry()) { | ||
| if (session.isRunning()) { | ||
| const id = session.sessionId || sessionId; | ||
| map.set(id, { id, cwd: session.cwd, ...(session.host.id === LOCAL_HOST_ID ? {} : { hostId: session.host.id }) }); | ||
| map.set(id, { | ||
| id, | ||
| cwd: session.cwd, | ||
| ...(session.host.id === LOCAL_HOST_ID ? {} : { hostId: session.host.id }), | ||
| ...(session.isAwaitingInput() ? { awaitingInput: true as const } : {}), | ||
| }); | ||
| } | ||
| } | ||
| return [...map.values()]; | ||
|
|
||
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.
🔥 The Roast: This test asserts
pushed.at(-1) === trueafter emitting the dialog event, butpushedonly gets values whennotifyRunningChange()fires. Since the bug above prevents that notification, this test passes only becauseawaiting()callsgetRunningRpcSessions()directly (bypassing the notification system). The subscription callback never actually runs — the test doesn't verify the real code path the sidebar uses.🩹 The Fix: Fix the notification bug in
trackExtensionUiRequestfirst, then verifypushedactually receives the update. Consider awaiting a microtask or using a test helper that waits for the subscription callback.📏 Severity: warning