Skip to content

feat(app): add a reusable running sessions list - #62851

Open
joe-ieta wants to merge 3 commits into
anomalyco:devfrom
joe-ieta:running-sessions
Open

joe-ieta wants to merge 3 commits into
anomalyco:devfrom
joe-ieta:running-sessions

Conversation

@joe-ieta

@joe-ieta joe-ieta commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Issue for this PR

Part 3 of the split requested in #60867; design context: #60241. Independent of the session-index PR #62845 and the project-action refactor #62850.

Type of change

  • New feature

What does this PR do?

Add a reusable RunningSessions list under shell/sidebar. It combines active session IDs with already collected background shells across connected servers, including child sessions. Rows show waiting requests, project/branch and elapsed time. Connections, selection and navigation are supplied by the caller.

Metadata and requests load when a keyed row arrives or its connection changes. Inbox and Running share the existing branch retry/timeout state machine and elapsed formatting; the two single-use helpers are inlined.

Exposure: mounted in the component lab with a local server fixture and Playwright tests. Production mounting belongs to the later opt-in Side bar PR after design review; no interface mode or default changes here, so no runtime flag is needed in this PR.

How did you verify your code works?

bun run check, application/client TypeScript checks, 36 client data tests, 8 branch/Inbox unit tests and changed-file lint pass. The two real-component regressions pass 20/20 repeated runs (2 workers, no retries), covering child sessions, shell deduplication, navigation, request counts and retry/reconnect. The retry regression fails with the old loader.

Three existing Inbox browser regressions pass against a production build. Both full component suites pass cold: app 268/268 and session-ui 209/209, with no retries or dependency re-optimization.

Windows validation uses an equivalent temporary import for the repository's custom-elements.d.ts symlink; it is not committed. Upstream fork CI awaits maintainer workflow approval (action_required).

Visual

<svg xmlns="http://www.w3.org/2000/svg" width="240" height="72" viewBox="0 0 240 72"><style>@media(prefers-reduced-motion:no-preference){.pulse{animation:p 1.8s ease-in-out infinite}@keyframes p{50%{opacity:.3}}}</style><rect x="8" y="8" width="224" height="56" rx="8" fill="currentColor" opacity=".06"/><g fill="currentColor"><circle class="pulse" cx="24" cy="26" r="4"/><rect x="38" y="23" width="108" height="6" rx="3" opacity=".6"/><circle cx="24" cy="46" r="4" opacity=".4"/><rect x="38" y="43" width="76" height="6" rx="3" opacity=".4"/></g></svg>

Screenshots / recordings

Try the real component: bun run --cwd packages/stories dev, then http://localhost:6006/?id=sidebar-running--overview (or sidebar-running--retry). Controls change only the local fixture.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Added by the opencode bot (AI-generated).

Public API: adds shell.activeSessions() to @opencode/client's createData data object (backwards compatible)

@joe-ieta
joe-ieta marked this pull request as ready for review November 9, 2026 08:13

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The client part is small and correct: shell.activeSessions() is tested, the client tests pass (36/36) and both packages type-check with tsc. The app part is ~490 lines that nothing mounts, so I couldn't try it; the only check on it is that it compiles.

Public API: adds shell.activeSessions() to the data object returned by createData in @opencode/client (backwards compatible). Nothing else public changes.

Concerns:

  • Code nothing uses yet. RunningSessions and its four helpers aren't mounted or tested anywhere, so nothing exercises them until the Side bar PR lands. It's worth asking whether this should ship together with the PR that mounts it.
  • Duplicated Inbox logic. shell/sessions/branches.ts re-implements the Inbox's branch loading without its retry and timeout handling, and duration.ts repeats the elapsed-time formatting in inbox.tsx. Sharing the Inbox code would be better than keeping a second copy. activity.ts and labels.ts are each used once; AGENTS.md asks to inline helpers like these.
  • Two behaviour issues, noted inline: branch lookups never retry, and requests repeat on every list change.

@joe-ieta

joe-ieta commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

Could a maintainer please approve the pending fork CI workflows for this PR? The required checks are waiting for approval (action_required); local validation is documented in the PR body. Thanks.

@joe-ieta

joe-ieta commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

Addressed in f72b8d4: shared Inbox loading/elapsed formatting, inlined the single-use helpers, and added a real Running component story plus regression tests (20/20 repeated runs). The component takes connections, selection and navigation from its caller, so it can be tried independently in the component lab: sidebar-running--overview / sidebar-running--retry. Production mounting stays in the separate opt-in Side bar PR. Full lint/type checks and three existing Inbox browser regressions pass.

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both earlier concerns are fixed, and I found nothing new that should block a merge.

  • Branch loading: Running now uses the Inbox's branch loader (moved to shell/sessions/branches.ts and branch-machine.ts) with its retries, timeouts and reconnect handling. On the Inbox side this only moves code; behaviour is unchanged.
  • Repeated syncs: session, permission and form syncs now run once per row, when it first appears or its connection changes, instead of for every row on each list change.
  • Duplicated helpers: elapsed-time formatting is shared with the Inbox and gives the same output. The single-use helpers are inlined.
  • Use in the app: the component is still only shown through Storybook and component tests. That's fine for this split.

I ran the branch, Inbox and session unit tests (114 pass) and tsc for packages/app (passes). I couldn't run the Playwright component specs here.

Public API: adds shell.activeSessions() to the data object returned by createData in @opencode/client (backwards compatible). Nothing else public changes.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant