Skip to content

Running and Done tabs in the background work panel - #971

Merged
ivanfenenko merged 1 commit into
mainfrom
feature/966-background-work-tabs
Nov 3, 2026
Merged

ivanfenenko merged 1 commit into
mainfrom
feature/966-background-work-tabs

Conversation

@ivanfenenko

@ivanfenenko ivanfenenko commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #966

What

The Session Chat background work panel now has Running / Done tabs, plus new rows on iOS and Android.

  • A segmented control, Running N | Done N. The panel opens on Running.
    • Running holds subagents that are running or waiting for input, plus running shells.
    • Done holds finished, failed and stopped subagents, newest first.
    • When Running is empty it says "Nothing running. Finished work is under Done."
  • Done gets a dot when a subagent finishes after you last viewed the tab. Viewing Done clears it. The dot lives in the Screen Model in memory: seenDoneIds / hasUnseenDone, plus the setBackgroundWorkDoneVisible action.
  • Rows lead with the task title. The letter avatar and the repeated "general" name are gone. The agent shows as a small tag only when it isn't general.
    • Running rows show a spinner, the title, the current step, the tool count and a live timer. Waiting rows stay amber.
    • Done rows show ✓ or !, the title, a one-line result (the reason in the error colour when failed or stopped), the run time and when it finished.
  • The 0:00 fix: a settle stamped with its start time is no longer a finish time. A v2 live tool.success with no running event before it carries the event time as both start and end. The duration is now hidden when it is unknown or under a second, instead of showing zero.

Design system

  • OpenCodeFilterTabs
    • New variant: style: .segmented (equal-width segments on a track).
    • New per-tab unseen dot, read out as "new".
  • New OpenCodeTaskRow: state-aware (running, waitingForInput, done, failed, stopped), with title, tag, detail, caption and time. It lines up with OpenCodeShellRow.
  • Gallery: a new Task Row entry, a segmented sample under Filter Tabs, and an updated Background Work demo with tabs, a dot and richer rows. The playground audit tasks carry a child tool summary.

What the servers actually send

I checked opencode's tags and dev, plus a live v2.2.2 harness run:

Child tool summary (step, count) Result Errors
v1 ≤ 1.1.x metadata.summary (the child's tool parts) plain output error
v1 1.19 none <task …><task_result>…</task_result></task> Subagent failed (task_id: …): msg
v2 none <subagent sessionID=… state=…>…</subagent> Subagent failed (sessionID: …): msg, Subagent cancelled (sessionID: …)

So the current step and the tool count only show on servers that send metadata.summary. On current v1 and v2, running rows show the title and the timer and leave the rest out, as the issue asks. Background calls settle at spawn with a "working in the background" note. That note is never shown as a result.

Checks

  • Android: :app:testDebugUnitTest is green, including the new SessionChatBackgroundWorkTabsTest (15 tests). ktlintCheck reports nothing in the changed files.
  • iOS: the full unit suite is green (3,123 tests), including the new SessionChatBackgroundWorkTabsTests.
  • The new tests cover the tab split, the Done dot, row mapping (step, count, result, duration, unknown duration, agent tag) and v1/v2 task part parsing.
  • Harness: a new subagent-running-and-done scenario (P1) runs three subagents in one turn: an explore one that finishes, one that fails (unknown agent) and one held running for 40s. check.mjs passes on v2.
  • Real apps on v2 through the scenario harness: screenshots are in the comment below.

Risks / Follow-ups

  • v1 not checked in the real apps. By decision, no v1 server binary was installed for this check. v1 task part parsing (classic metadata.summary, 1.19 <task_result>, task_id errors) is covered by unit tests only.
  • On current servers there is no current step or tool count, because neither protocol sends a child tool summary. Showing them would mean reading the child session. The activity card already watches in-flight children on Android.
  • Background subagents get no server result or finish time. The v2 completion notice keeps only its description in the app's model. Their duration comes from the child session update or the live finish.
  • The relative time says "now" under a minute, the same as the shared formatter.

🤖 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

The Session Chat background work panel splits into a Running / Done
segmented control on iOS and Android. Running holds working and waiting
subagents plus running shells; Done holds finished, failed and stopped
subagents, newest first, with a dot for finishes since the tab was last
viewed.

Rows lead with the task title through a new OpenCodeTaskRow. The agent
shows as a tag only when it is not "general". Done rows show the first
result line or failure reason, the run time and when it finished. The
current step and tool count show only when the task part carries the
classic v1 metadata.summary; current v1 and v2 servers do not send it.

A settle stamped with its start time no longer counts as a finish, and
run times under a second or unknown are hidden, so done rows no longer
read 0:00. OpenCodeFilterTabs gains a segmented style and an unseen dot.
The harness gets a subagent-running-and-done scenario.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ivanfenenko

Copy link
Copy Markdown
Collaborator Author

Evidence: real apps on v2 (scenario harness, subagent-running-and-done)

Three subagents in one turn: an explore subagent that finishes, one that fails (unknown agent) and one held running for about 40s.

Step iOS Android
Running: spinner, title, live timer, no "general" tag ios running android running
Done, newest first: ✓ with an explore tag, result line and run time; ! with the reason in red and no 0:00 ios done android done
The last subagent finishes while Running is open: empty state, Done gets a dot ios dot android dot
Tapping a row still opens the child session ios child

Not checked in the real apps: v1 (no v1 server binary, by decision; unit tests cover v1 parsing), and the Android row-tap screenshot (same onOpenSubagent path as before).

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Automated review: no finding that 2+ of 2 passes agreed on.

opencode pr-review · passes: muse-spark-1.3-contributor, glm-5.3-flash, deepseek-v4.1-flash · $0.171 · 1 pass(es) stopped early · 1 pass(es) failed

@ivanfenenko
ivanfenenko merged commit caf5a38 into main Nov 3, 2026
@ivanfenenko
ivanfenenko deleted the feature/966-background-work-tabs branch November 3, 2026 08:49
This was referenced Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Session Chat: Running and Done tabs in the background work panel

1 participant