Repository navigation
#907 Session Chat: shells in the background work pill - #927
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <[email protected]>
shell-foreground-stream (v1 and v2), shell-background and shell-two-running (v2) exercise the background work pill's shells. The harness can list, read and stop a session's v2 shells as another client, and check.mjs asserts named server-side facts per protocol (serverChecks) with a per-scenario timeout. Co-Authored-By: Claude Opus 5.5 <[email protected]>
v1 reads running shells and their output from bash tool parts. v2 lists /api/shell, follows shell.created/exited/deleted, polls output tail first and stops a shell with DELETE, gated on the server declaring GET /api/shell. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Session Chat binds the open session's shells, lists running ones in panel order, counts them on the background work pill, and owns the shell output sheet: output is read only while the sheet is observed, Stop shows Stopping… until the shell ends, and a failed stop shows an inline error. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A running agent shell for the background work panel: terminal glyph, one-line monospace command, optional description and a live timer. Listed in the Component Gallery with running and long-command states. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The subagents sheet becomes the background work panel with Subagents and Shells sections. A shell row opens a half-height output sheet with a live status line, Copy, and Stop shell where the server supports it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
AgentShell and AgentShellOutput product types behind a protocol-selected remote: v1 reads running bash tool calls and their metadata output from the transcript; v2 lists GET /api/shell, follows shell.created/exited/deleted, polls output tail-first while observed, and stops with DELETE. The v2 remote is used only when /openapi.json declares GET /api/shell. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A running shell row next to OpenCodeChildSessionRow: terminal glyph in the leading slot, the command in monospace on one line, the description below, and a live timer. The gallery shows running and long-command states. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The pill counts running shells with subagents ("1 subagent · 2 shells"), the
panel becomes Background work with Subagents and Shells sections, and a shell
row opens a half-height output sheet with a live status line, Copy, and Stop
shell where the server can stop it. Output is read only while the sheet is up
and the app is active.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ure/907-ios' into feature/907-background-shells-pill
…names v1 ends an aborted or timed-out bash call as completed with no exit code and a <shell_metadata> notice; map those to Stopped and Timed out. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Read v2 shell support again on every reconnect, so a cold start that opens Session Chat before the contract probe still shows shells. Only shells created while a list request is in flight survive its answer. An open sheet whose shell leaves without an end event ends locally. Output read before a failed page is kept. Durations drop zero parts, v1 output at the 30,000-character cap counts as truncated, and failed, timed-out and non-zero exits use the error color, matching iOS. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… lazily On a cold start the v2 contract is read after Session Chat binds, so the first pick could be "no shells" for good. The shell list now picks v1, v2 or none again on every stream (re)connect. Remotes get a transcript subscription they open only when they read it, so v2 and unsupported servers hold none. Co-Authored-By: Claude Opus 5.5 <[email protected]>
An open output sheet whose shell leaves the list while running, or whose output is gone (404), now ends it locally: Stopped when Stop was in flight, else Exited, so the sheet no longer stays Running or Stopping. A shell list that ends can start again. Loaded messages reach the shells only when they change. An ended shell with no end time shows its state alone, and opening a shell output logs against the background work panel. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Collaborator
Author
There was a problem hiding this comment.
Automated review: no finding that 2+ of 2 passes agreed on.
6 finding(s) from a single pass, not posted
ios/OpenCode Mobile/OpenCode Mobile/UI/SessionChat/Region/SessionChatShells.swift:75high: iOS shells keep querying the old directory after session.moved (muse-spark-1.3-contributor)ios/OpenCode Mobile/OpenCode Mobile/Domain/Shell/AgentShellRemote.swift:219medium: iOS v2 shell output polls forever after the shell ends (muse-spark-1.3-contributor)ios/OpenCode Mobile/OpenCode Mobile/Domain/Shell/V2AgentShellAdapter.swift:19medium: iOS v2 shells always drop the description (muse-spark-1.3-contributor)ios/OpenCode Mobile/OpenCode Mobile/UI/SessionChat/Region/SessionChatShells.swift:121medium: Transcript feed keeps the previous session's messages after rebind (glm-5.3-flash)android/app/src/main/java/dev/opencode/mobile/domain/shell/AgentShellDomainAdapter.kt:179low: Android ignores string-encoded shell exit codes (muse-spark-1.3-contributor)ios/OpenCode Mobile/OpenCode Mobile/Domain/Shell/V2AgentShellAdapter.swift:101low: V2AgentShellList.replace drops known ended shells on every relist (glm-5.3-flash)
opencode pr-review · passes: muse-spark-1.3-contributor, glm-5.3-flash, deepseek-v4.1-flash · $0.213 · 1 pass(es) failed
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.


















Fixes #907
Session Chat's background work pill now counts the shells the agent runs, next to subagents ("1 subagent · 2 shells"). The panel gets a Shells section, and tapping a shell opens a half-height sheet with its live output, Copy, and Stop shell where the server supports it.
What changed
AgentShellproduct type; the protocol difference stays in the domain layer.bashtool parts of the open session. Output comes fromstate.metadata.outputonmessage.part.updated. No per-shell Stop (v1 can only abort the whole session), so the button is hidden.GET /api/shell(on open and every reconnect) plusshell.created/shell.exited/shell.deleted, filtered bymetadata.sessionID. Output is polled from/api/shell/:id/outputonly while the sheet is visible and the app is in the foreground. It reads the tail first, so a long log doesn't download from the start. Stop callsDELETE /api/shell/:id. Gated on the server's/openapi.jsondeclaringGET /api/shell.completedwith a<shell_metadata>notice; it now reads as Stopped / Timed out.OpenCodeShellRowon both platforms, with Component Gallery entries. The subagents sheet became the "Background work" panel.api/opencode-shells.openapi.yamldocuments the v2 routes and events as observed on opencode 2.2.shell-foreground-stream(v1 and v2),shell-backgroundandshell-two-running(v2), with server-side checks.Checks
:app:testDebugUnitTest3140 passed (1 skipped),:app:assembleDebugOK.OpenCode MobileTestspassed (3070) before the review fixes; after them, the shell, background-work, pill-slot and Session Chat view model suites passed (325).check.mjs --variantsfor the three shell scenarios passes on opencode v1 1.19.5 and v2dev.Risks / Follow-ups
maindoes the same.🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.