Skip to content

feat(opencode): TUI half declares working/idle from execution events (#310) - #317

Merged
amirlehmam merged 2 commits into
amirlehmam:masterfrom
Mattheinrichs:feat/opencode-tui-activity
Oct 21, 2026
Merged

amirlehmam merged 2 commits into
amirlehmam:masterfrom
Mattheinrichs:feat/opencode-tui-activity

Conversation

@Mattheinrichs

Copy link
Copy Markdown
Contributor

Phase 3b of the CLI-side (TUI) half, following the constraint agreed in #310 (and the lesson from 01df550): a pane whose TUI is a client of a remote/shared server now reads working while a turn runs and idle when it ends, instead of staying unknown.

Event Report
session.execution.started report-agent --run-depth 1
session.execution.succeeded / .failed / .interrupted report-agent --run-depth 0
  • Absolute values only. Never --run-start/--run-end; two producers converge on the same declaration instead of inflating a refcount.
  • Tracked by session id. Hosting gates only a START. A turn that ends after the user switched tabs still clears — the exact class of bug 01df550 fixed for ask replies — and a subagent's end cannot return the pane to idle while its parent is still running.
  • Deduped transitions. Replayed started/ended events cannot spawn redundant CLI calls.
  • Root-aware starts. A start in a child session is admitted only when its root is hosted (viewed session or open tab); the raw session id is what gets tracked, so a child end never removes the parent.
  • Marker 3 → 4; docs and CLAUDE.md updated. No CLI or renderer changes.

Tests

Nine new core cases (started/ended, failed/interrupted, replay dedupe, view-moved clear, unhosted ignored, last-running-wins, no start → no report, no refcount flags, missing session id) plus entry-shape assertions (execution subscriptions, marker 4). 69 tests in the two TUI suites, watched red first. Full suite: only the pre-existing Windows/path.join failures that also fail on untouched master in this container. Typecheck and entry syntax clean.

Known gap (deliberate)

No seeding on load: a turn already in flight when the TUI starts is not shown until the next started. Seeding via tabs.list()/session.status needs those shapes verified; happy to add it once they are.

Live check after merge: install marker 4 (wmux opencode-tui), submit a prompt → sidebar shows Working; completion → Idle; switch tabs mid-run → still clears. A TUI killed mid-run decays to unknown after main's 15-minute trust window, the same rule every producer lives under.

Part of #310

Mattheinrichs and others added 2 commits October 20, 2026 13:13
…mirlehmam#310)

Phase 3b of the CLI-side (TUI) half: a pane whose TUI is a client of a
remote or shared server now reads "working" while a turn runs and "idle"
when it ends, instead of staying unknown.

`session.execution.started` declares `report-agent --run-depth 1`;
`succeeded`/`failed`/`interrupted` declare `--run-depth 0`. The values are
ABSOLUTE — never `--run-start`/`--run-end` — so a second producer converges
instead of inflating a refcount (the constraint from the phase-3 review).

Running sessions are tracked by id, the same principle 01df550 applied to
asks: hosting only gates a START, so a turn that ends after the user
switches tabs still clears, and a subagent's end cannot return the pane to
idle while its parent is still running. Depth changes are deduped, so
replayed execution events cannot spawn redundant CLI calls.

Marker 3 → 4. Docs and CLAUDE.md updated.

Part of amirlehmam#310
…not overtake its start

Each report-agent call is its own CLI process; spawned a few ms apart they race
to the pipe, and a short turn's --run-depth 0 landing before its 1 left the pane
'working' for the 15-minute trust window (amirlehmam#151). callWmux now reports completion
on every path, and the activity reporter keeps one call in flight, collapsing
whatever changed meanwhile into the latest wanted depth.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

2 participants