Repository navigation
fix(cli-peer): tighten terminal tracking and BTW turn watching - #3677
Merged
Merged
Conversation
The BTW watchers cloned the whole session every 250 ms and dropped the registration if the turn was not running on the first check, which left it uncancellable. Read only the session state and allow a short start grace. Track only the terminals a tab list shows instead of every host terminal. Publish a missed exit before terminal-closed, and deliver both on the controller so the close no longer discards the exit code. List Desktop capabilities explicitly instead of relying on the order of ALL.
This was referenced Nov 2, 2026
bobleer
added a commit
to Raing5Days/OpenBitFun
that referenced
this pull request
Nov 2, 2026
Regenerate the remote surface registry artifacts after openBitFun#3677 and openBitFun#3591.
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Follow-ups from the re-review of #3669.
Refs #3417
get_session_state()instead of cloning the whole session every 250 ms. A turn not yet running on the first check keeps its registration for up to 5 seconds, sobtw_cancelstill works. The decision lives inBtwTurnWatchinagent-runtime.listSessions()no longer starts tracking, becauseterminal_listspans every workspace on the host.useTerminalSessionsdeclares what it shows throughsetTrackedSessions(owner, ids), per owner, so concurrent tab lists don't overwrite each other.session_statusonce before publishingterminal-closed.ALLexceptTerminalCursorReplayV1.One addition beyond the review list:
PeerTerminalReplaykept a single pending lifecycle event, so a close right behind an exit discarded the exit code on the controller. Fixing only the host would not have delivered it, so pending events are now queued in order.Type and Areas
Type: bug fix
Areas: CLI peer host, Desktop, agent-runtime, Product Operation Registry, web UI (terminal)
Motivation / Impact
Lower polling cost and fewer host stream subscriptions on large hosts.
/btwstays cancellable right after it starts, and terminals report their exit code when closed quickly.Compatibility
No wire or persisted format changes. Desktop's advertised capabilities are unchanged. With an older CLI host, exit tracking for tabs without a mounted view still works, now only for the tabs shown.
Verification
Passed:
cargo test --locked -p openbitfun-agent-runtime --features agent-runtime --lib side_question(6 passed)cargo test --locked -p openbitfun-cli --bin openbitfun peer_host::(119 passed)cargo test --locked -p openbitfun-product-domains --no-default-features remote_surface(20 passed)cargo check --locked -p openbitfun-desktop(compiles; the Desktop watcher has no test of its own)pnpm --dir src/web-ui run test:run src/tools/terminal/services src/app/scenes/shell/hooks src/app/hooks/sessionTerminalDirectoryWiring.test.ts; 49 passed before the new hook test was fixed, and that test then passed in its own run. The two were not re-run together.pnpm --dir src/web-ui run type-check; eslint on the touched terminal services anduseTerminalSessions.tspnpm run capabilities:check,pnpm run i18n:audit,pnpm run check:repo-hygienenode scripts/check-core-boundaries.mjsfrom a temporary sibling checkout at this head (theagent-harness:checkstep of the pnpm script was not run)Remote scenarios exercised: none in a real session. Peer Device Mode has unit coverage with mocked transport only. Remote workspace, remote control and Detached Dispatch were not exercised.
Reviewer Notes
useTerminalSessionsre-declares its tracking after each refresh, and clears it when its effect re-runs. AsavedSessionIdschange can therefore briefly close and reopen the lifecycle streams.editor_ai_api.rswas checked and has no matching watcher, so it is unchanged.Checklist