Repository navigation
feat(tui): surface sessions awaiting input at the top of the open menu - #53435
Merged
Merged
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why
When a background session, independent session (
session_create), or subagent blocks on a permission prompt or a question (Form),SessionExecutionkeeps its drain active and reports"running". In theCtrl+OOpen menu (DialogOpen) and/sessions(DialogSessionList), blocked sessions therefore render a working spinner instead of a "needs input" state, sink chronologically below newer activity, and drop out ofCtrl+Oaltogether once 8 newer sessions update.What Changes
Sessions awaiting a permission (
!) or question (?) now surface at the top ofSessionsinCtrl+O(DialogOpen) and display!/?attention markers in bothCtrl+Oand/sessions(DialogSessionList).1. Opening
Ctrl+Owhile background sessions are blocked on input (Before)Blocked sessions sit buried by
time.updatedwith a false working spinner (⠋), or fall past the 8-session recent limit completely.2. Opening
Ctrl+Owhile background sessions are blocked on input (After)Sessions awaiting a question (
?) or permission (!)—including root sessions blocked via a child subagent or older than the 8 most recent sessions—sort to the top ofSessionswith?/!icons soEnterimmediately opens the first blocked session.Attention Hydration & Lineage Resolution
sequenceDiagram participant TUI as DialogOpen (Ctrl+O) participant Data as Solid Data Store participant Server as OpenCode Server TUI->>Data: Sync permissions & forms for active() sessions Data->>Server: GET /api/session/:id/permission & /form (cached per session) Server-->>Data: Pending permissions & forms alt Pending or active sessionID is a child subagent TUI->>Data: data.session.sync(root(id)) Data->>Server: GET /api/session/:id Server-->>Data: SessionInfo (parentID -> rootID) Data->>Data: Register childID in family[rootID] end TUI->>TUI: Sort attention(rootID) sessions to top with ! / ?packages/client/src/solid/data.ts,packages/tui/src/component/dialog-open.tsx):data.tsexposes read-onlyactive(),permission.sessions(), andform.sessions()selectors over existing store records. WhenDialogOpenmounts, it calls the existingdata.session.permission.sync(id)anddata.session.form.sync(id)methods on currently running (active()) sessions—sharing the samesync.runcache keys asSessionandSessionTabs.packages/tui/src/component/dialog-open.tsx,packages/tui/src/context/session-tabs.tsx): When a pending permission, pending form, or active session belongs to a child subagent not in the root session list,DialogOpensyncsdata.session.root(id)sosessionTabs.status(rootID).attentionreflects the blocked child.family(sessionID)always retainssessionitself even when a child'sSessionInfoarrives before its root's.Demo
open-attention-demo.mp4
Side-by-side
opencode-drivecapture (96x26viewport, simulated LLM). Left:origin/v2(4ed2978a30). Right:pending-attention. Two background sessions are blocked (Audit Cloudflare worker bindingson ashellpermission andMigrate auth session cookieson aquestion), followed by 8 newer idle sessions. PressingCtrl+OandEnteron the left opens an idle session while hiding the older permission-blocked session; on the right, both blocked sessions surface at the top with?and!andEnteropens the blocked session directly to its question prompt.Scope
This PR owns surfacing awaiting-input sessions and their
!/?indicators inDialogOpen(Ctrl+O) andDialogSessionList(/sessions). Global chrome badges and toast notifications remain separate follow-ups.Verification
bun test test/cli/tui/dialog-open.test.tsx test/cli/tui/dialog-session-list.test.tsx test/context/session-tabs.test.tsx test/cli/tui/data.test.tsx bun run checkpackages/tui: 98 pass, 0 fail acrossdialog-open.test.tsx,dialog-session-list.test.tsx,session-tabs.test.tsx, anddata.test.tsx(including the regression test covering older permission-blocked sessions and child-subagent question prompts).bun run check: 0 errors across all 36 workspace tasks andoxlint.opencode-driveagainst bothorigin/v2andHEAD.