Skip to content

Session Chat: floating pill system #899

Closed
7 of 7 issues completed
Closed

Description

@ivanfenenko

Session Chat gets one floating pill system. Every pill over the chat uses the same component and lives in one of three corners. Subagents and agent-run shells get a background work pill. Steering messages stay visible in the timeline.

Why: today each floating element has its own look and position: a top-centre pill, the btw row, the full-width queued strip, a centred "Scroll to end", and a separate collapsed-permission pill. Background work isn't shown in the parent chat at all, and a steer disappears from the chat until it's delivered. The btw pill is the look to standardise on.

Pill component (design system, both platforms)

  • One component in four layouts: icon + label, round icon only, live counter with a spinner, label with a close ✕.
  • Five states: live, ready, needs attention (amber text, thin amber ring), error, done (green check).
  • Same height, type and frosted glass as today's btw pill (OpenCodeSideQuestionPill).
  • Variant-first API with no colour or radius overrides. Gallery entry on both platforms.

Corner slots

  • Top left, context: at most 2 pills.
  • Bottom left, live activity: one pill, plus a "+N" button. "+N" springs up a stack of the rest, in priority order:
    1. needs input
    2. error
    3. btw answer ready
    4. running work
    5. queued
    6. finished (fades after about 3 s, so with other work it only shows in the "+N" stack)
  • Bottom right, navigation: empty at the end of the chat. When scrolled up it shows a round ↓, which becomes "↓ 3 new" when messages arrive.
  • Keyboard up:
    • The bottom-left pill shrinks to its icon, and "+N" and the other corners hide.
    • A needs-input pill never hides and keeps its full label.

Pills

  • Branch (top left):
    • Shows only a branch or worktree icon and "+128 −14", with no name. Worktree sessions get the worktree icon. With no changes, it shows the icon only.
    • Tapping it opens a small popover:
      • branch name, base branch and file count
      • the top 3 changed files
      • "View all changes"
      • a new "Copy branch name" action
    • With no changes, the popover shows only the branch, its base and "Copy branch name".
  • Todos (top left): "2/5" progress. Opens the existing todos sheet.
  • btw (bottom left): the existing pill, moved onto the component.
  • Queued (bottom left): "3 queued" replaces the full-width pending-prompts strip and opens the existing Up next sheet.
  • Request failed (bottom left): error pill with ✕.
    • Tapping it scrolls to the failure in the chat and highlights it.
    • ✕ dismisses it.
    • The retry countdown stays in the chat and is not a pill.
  • Background work (bottom left): replaces a plain subagent indicator.
    • Counter: "1 subagent · 2 shells" with a spinner. When one is waiting, it turns amber with a pulsing dot: "general needs input · 2 running".
    • Tapping it opens a panel with Subagents and Shells sections, each row with a live timer. Tapping a subagent opens its session.
    • Tapping a shell opens a half-height live output sheet: streaming output, "Running · 1 min 12 s", Copy, and Stop shell.
    • Depends on the server: first check whether the opencode server (v1 and v2) lists running agent shells, streams their output and can stop them. If it can't, ship subagents only and track shells separately.

Permission and question panels

  • Both panels keep replacing the composer while a request waits. Pills don't replace them.
  • A request from a subagent shows which one is asking:
    • a light amber row: the agent's letter, "general · subagent wants to run: npm test", and Open
    • the same row on the question panel ("explore · subagent asks")
    • the name comes from the subagent's session, which Session Chat already loads to find descendant requests
  • Paging between waiting requests: arrows next to "1 of 2", dots under the panel, and swipe.
  • Only a collapsed panel becomes a pill: "↑ Review permission" (today's collapsed pill, restyled) or "↑ Answer question".
    • The question panel gains the same collapse.
    • These pills have no ✕, so the request can't be dismissed by accident. Answer or deny it in the panel.
  • Tapping the needs-input pill opens the panel if it's collapsed, pages to that subagent's request, and pulses the panel briefly.

Steering in the timeline

  • Messages sent with steer during a run stay in the chat instead of only in the queued pill.
  • Consecutive steers share one "↱ Steering" label, right-aligned above the bubbles.
  • While pending, the bubble is dimmed with a dashed outline and "Pending · sends at the next step". After delivery it keeps the label.
  • Queued (not steered) messages stay in the queued pill only.

Out of scope

Day separators, cardless assistant replies, and collapsing the idle composer.

Acceptance

  • The shared pill component, with all layouts and states, in the Component Gallery on iOS and Android.
  • Three corner slots with the priority order, "+N" stack and keyboard behaviour above, on both platforms.
  • Branch, todos, btw, queued, request-failed and jump-to-latest pills on the new component, with the behaviour above.
  • Background work pill and panel for subagents. Shells are included if the server supports them; otherwise a follow-up issue is filed (shells: Session Chat: shells in the background work pill #907).
  • Permission and question panels name the asking subagent, page between requests, and collapse to pills with no ✕.
  • Steering messages are shown in the timeline with the label and pending state.
  • Works on v1 and v2 servers; no protocol-specific UI.
  • Unit tests on both platforms for slot priority, the keyboard rules and the steering projection.
  • Verified in the real apps against the scenario harness, with screenshots for both platforms.

Remaining:

Sub-issues, in build order:

Sub-issues

Sub-issues

7 of 7 Issues completed
Loading 7 sub-issues

Activity

  1. added
    enhancement
    ios
    android
    todo
    priority: medium
    on Oct 31, 2026
  2. ivanfenenko commented on Oct 31, 2026

    @ivanfenenko
    CollaboratorAuthor

    Server support for agent-run shells (for #904)

    I checked the opencode source at the v1 release v1.19.5 (810c0eba) and the v2 release v2.2.5 (9bbb8ce1). The beta branch no longer exists; v2 now ships from dev, and dev at bf544cd4 changes nothing relevant here.

    Recommendation: ship subagents in #904 on both protocols. Treat shells as a follow-up issue. v2 supports listing, reading and stopping shells. v1 has no background shells at all; it only has foreground tool calls, and the only way to stop one is to abort the whole session. Shipping shells now would make the panel differ by protocol, which the Acceptance list rules out ("no protocol-specific UI").

    Summary

    v1 (v1.19.5) v2 (v2.2.5)
    Agent can run a background shell No Yes, shell tool with background: true
    List running shells Only by finding running bash tool parts in the timeline GET /api/shell plus shell.created, shell.exited and shell.deleted events
    Stream output Yes for a running foreground call: message.part.updated with state.metadata.output Poll only: GET /api/shell/:id/output?cursor&limit. There is no output event.
    Stop one shell No. The only option is POST /session/:id/abort, which stops the whole run. DELETE /api/shell/:id

    v1 (classic)

    • The bash tool has no background mode. Its only parameters are command, timeout and workdir (prompt.ts#L16-L23).
      • The source says background bash was removed on purpose: core/src/tool/bash.ts#L72-L74 has TODOs to re-add it "only with owner-bound get/wait/cancel tools" and HTTP observation "after durable status, restart recovery, and authorization are defined".
      • There are no companion tools for reading output or killing a shell (registry.ts#L210-L226).
    • Live output of a running call. The tool part stays state.status: "running". The server calls ctx.metadata({ metadata: { output } }) on every stdout/stderr chunk (shell.ts#L475-L531).
      • output holds the last 30,000 characters (shell.ts#L27).
      • Each update arrives as a full message.part.updated {sessionID, part, time}, not as a message.part.delta.
      • The default timeout is 2 minutes.
    • Stopping. POST /session/:id/abort cancels the run and its descendant subagents. The bash child process is killed, and open tool parts become error with metadata.interrupted: true. No endpoint stops a single tool call or process.
    • /pty is unrelated. These are user-created terminals with no sessionID or callID; the agent never creates them.

    v2 (/api/*)

    • Background flag. The shell tool accepts background: boolean (tool/plugin/shell.ts#L46-L59). Background shells have no default timeout.
      • Every call, foreground or background, creates a Shell.Info record with an sh_… id and metadata.sessionID (shell.ts#L200-L214).
      • The process is a plain child process, not a PTY, and its output goes to a file.
    • Endpoints (protocol/src/groups/shell.ts), all scoped by location[directory]:
      • GET /api/shell lists running shells only.
      • GET /api/shell/:id
      • GET /api/shell/:id/output?cursor&limit returns {output, cursor, size, truncated}. cursor is a byte offset.
      • DELETE /api/shell/:id kills the process. It publishes shell.exited {status: "killed"}, then shell.deleted, and deletes the output.
      • Shell.Info fields are id, status (running|exited|timeout|killed), command, cwd, shell, file, pid?, exit?, signal?, metadata, time{started, completed?} (schema/src/shell.ts#L25-L61).
    • Events are shell.created {info}, shell.exited {id, exit?, status} and shell.deleted {id}.
      • They carry no session id at the top level; match on info.metadata.sessionID.
      • There is no shell.output event, so a live output sheet has to poll /output with the cursor.
      • A running foreground tool part gets one session.tool.progress with metadata.shellID. Its output only arrives in session.tool.success.
    • Interrupting a session does not stop its background shells. From reading the code (not tested), POST /api/session/:id/interrupt only cancels the job keyed by the session id (execution.ts#L128), and shell jobs are keyed by sh_…. Deleting the session does stop them.
    • packages/process-daemon is not agent shells. It is a Rust PTY daemon behind the experimental persistent user terminals.

    Telling a foreground running bash call from a background shell

    • v1: every agent shell is a foreground running tool part. A user-run ! command (POST /session/:id/shell) has the same shape, but comes after a synthetic user text part ("The following tool was executed by the user").
    • v2: Shell.Info has no foreground/background flag. You have to infer it from the tool part:
      • Foreground: the part is running with metadata.shellID.
      • Background: the part is already completed with metadata.status: "running" and metadata.shellID.
      • When a background shell finishes, the server adds a session.synthetic message with metadata.source: "shell".
      • User ! shells have metadata.background: true and emit session.shell.started / session.shell.ended.

    Subagents (both protocols, can ship now)

    • v1: the task tool creates the child session with parentID, which arrives in session.created as info.parentID.
      • While the call is still running, the tool part gets metadata: {parentSessionId, sessionId, model, background?} (task.ts#L185-L195).
      • The child's state comes from session.status {sessionID, status: idle|busy|retry}, or from the GET /session/status map.
      • permission.asked and question.asked carry the child's sessionID.
    • v2: the subagent tool sends the child id through session.tool.progress as metadata: {sessionID, status: "running"} (subagent.ts#L207).
      • The child's state comes from session.execution.started|succeeded|failed|interrupted for the child's id, or from GET /api/session/active. session.status is declared, but no code publishes it.
      • permission.asked and form.created carry the child's sessionID.
    • The app already covers this:
      • It reads metadata.sessionID / sessionId from the tool part.
      • It watches the child's messages.
      • It walks the parentID tree to find descendant permission requests.

    Follow-up scope for shells

    • v2-only: list from GET /api/shell and the shell.* events, filtered to this session tree; poll /output while the sheet is open; Stop with DELETE /api/shell/:id.
    • v1: either hide the Shells section, or show running foreground bash parts with streamed output and no per-shell Stop. That is a protocol-specific gap and needs a product call.
    • The app shows no live bash output today; nothing reads metadata.output while a part is running.
  3. added
    in-progress
    and removed
    todo
    on Oct 31, 2026
  4. added a commit that references this issue on Nov 1, 2026
  5. ivanfenenko commented on Nov 1, 2026

    @ivanfenenko
    CollaboratorAuthor

    Done. #924 connected the needs-input and prompt pills, with end-to-end screenshots on iOS and Android against the scenario harness on v1 and v2. #923 removed the old pill components. Shells continue in #907.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    androidenhancementin-progressiospriority: medium

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions