GeezerVison is showing github.com — feat(tui): add a Scripts tab to the composer picker by jlongster · Pull Request #64956 · anomalyco/opencode
Conversation
jlongster
commented
Nov 19, 2026
•
edited by opencodejr
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Issue for this PR
Closes #
Type of change
- Bug fix
- New feature
- Refactor / code improvement
- Documentation
What does this PR do?
Adds a Scripts tab to the TUI composer picker (↓) for Code Mode scripts running in the background, like the desktop activity pill (#64790).
createData gets a job slice: job.sync(sessionID) lists running jobs for the session tree once (experimental.job.list with descendants: true, status: "running"), relists on reconnect, and experimental.job.updated adds running jobs / drops settled ones. job.list(sessionID) returns the tree's running jobs. Desktop is not switched to it here.
- Scripts tab shows the session's own
codemode jobs: first line of the script's code (from the completed execute part with that jobID, falling back to the job title, then "Script") and elapsed time. ctrl+d cancels the job; Enter does nothing. The tab only registers while a script runs.
- Footer reads "↓ 1 script · 2 subagents · 2 shells"; clicking opens the first non-empty tab.
- Subagents, as on desktop: a subagent counts as active while its session runs or a running job is owned in its subtree; ctrl+d interrupts it and cancels those jobs.
Mini mode is unchanged.
How did you verify your code works?
bun run typecheck:tsc in packages/client and packages/tui
bun test test/solid-job.test.ts (new, packages/client)
- prettier + oxlint on touched files
- opencode-drive TUI run: a backgrounded script with two shells shows "↓ 1 script · 2 shells", the Scripts tab lists "// Build both targets" with elapsed time, ctrl+d cancels it and the tab and footer entry disappear.
Screenshots / recordings
Recorded with opencode-drive: footer, Scripts tab, after cancel.
Checklist
- I have tested my changes locally
- I have not included unrelated changes in this PR
Added by the opencode bot (AI-generated).
Related: #54221
Public API: adds job.list/sync/invalidate to @opencode/client/solid createData, job.list to the TUI plugin Data interface, and composer.script.* keybinds (backwards compatible)
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks sound to me. Tests and type checks pass, but I couldn't run the Scripts tab in the TUI.
How I checked: bun test test/solid-job.test.ts passes in packages/client, and typecheck:tsc passes in packages/client and packages/tui. I couldn't get the simulated model to leave a Code Mode script running in the background: execute finished in about 150ms each time, even with OPENCODE_FLAGS=full_codemode. So the tab, the footer count and ctrl+d cancel weren't exercised at runtime, and I have no before/after screenshots. Could you attach the opencode-drive recording or screenshots mentioned in the description? The job slice follows the desktop logic from #64790. The reconnect relist works because going offline clears every sync key. The subagent "active while its subtree owns a running job" rule matches desktop.
Public API: additive and backwards compatible:
createData() in @opencode/client/solid gains job.list(sessionID), job.sync(sessionID) and job.invalidate(sessionID).
- New TUI keybind keys:
composer.script.up, composer.script.down and composer.script.cancel.
- No server, protocol or plugin API changes.
No blocking concerns.
Related: #54221
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new commit only reverts an unrelated formatting edit in data.ts, so the diff now has no stray changes. Behaviour doesn't change and I have no new concerns. The earlier review had no open points. The public API impact is the same as before: additive job.list/job.sync/job.invalidate on createData and new composer.script.* keybinds, all backwards compatible. The before/after screenshots or recording I asked for would still help, because I couldn't run the Scripts tab with the simulated model.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
User decisions:
- Separate Scripts tab in the TUI composer picker
- Enter on a script does nothing
- Use a shared job slice in createData
- Only Code Mode scripts, no image or video jobs
- Leave mini mode unchanged
User decisions:
- Fix the review findings on the TUI Scripts tab
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The follow-up reads correctly. Tests and type checks pass in client, tui and plugin. I didn't drive the TUI again: the base now holds a Code Mode script in the foreground for 2 minutes before moving it to the background (#64957). The before/after screenshots or recording would still help.
The new commits keep a grandchild session's jobs in the list even when that session isn't loaded. They also keep job updates that arrive while the list is still loading, fetch the list again on reconnect, and clear a deleted session's jobs. Composer tabs now stay in a fixed order when Scripts comes and goes. Two smaller fixes: the subagents tab lists jobs from the root session, and the footer now reads data from the plugin context.
Public API: additive and backwards compatible:
createData() in @opencode/client/solid gains job.list, job.sync and job.invalidate.
- The TUI plugin
Data interface gains job.list(sessionID) (marked experimental). Plugins that only read Data are unaffected. Code that builds its own Data object needs the new field, as the footer test mocks did.
- New TUI keybind keys:
composer.script.up, composer.script.down and composer.script.cancel.
One point on the new client tests (inline): they wait using sleep-and-poll loops.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
}))
|
|
|
const ids = () => root.data.job.list("ses_root").map((item) => item.id)
|
|
|
// Resolves the next job list once its request is in flight.
|
|
|
const respond = async (data: JobInfo[]) => {
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests wait using timing: respond and the reconnect check poll with Bun.sleep(1) against a 2s wall-clock timeout, line 78 relies on Bun.sleep(0), and the last check sleeps 10ms to show no request was made. On a loaded CI box that can flake or pass for the wrong reason. Since fetch is already mocked, could it signal each request (e.g. push a resolver and resolve a waiter promise), so the test awaits the request instead of polling? The reconnect case could then await the second request and its response directly. That would also make the three tests shorter and easier to follow.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
User decisions:
- Fix CI on the TUI Scripts tab PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new commit only adds a job-list stub to the TUI test fixture, so fixture-based tests get an answer for the session's new job.sync call. Nothing new to flag. The public API impact is the same as in my last review. The open point about timing-based waits in solid-job.test.ts still stands.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…read
User decisions:
- Fix CI on the TUI Scripts tab PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new commits look right. The client tests now wait for each job-list request itself instead of polling or sleeping, and passed on four runs. The composer picker switches to a requested tab that registers late, until the user picks one; the new test covers this and passes. Type checks pass in client and tui. The public API impact is the same as in my last review. No new concerns.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|