fix(desktop): bound terminal close process probes

VI
4h ago
+189-26

What & why

Closing a terminal tab waits for running-process checks. A request queued behind a saturated host-service connection pool can leave the close pending indefinitely. Serial checks also multiply the wait across split panes: two stalled probes took 4.04 seconds even with individual two-second deadlines.

Each foreground-terminal probe now has a two-second abort signal and uses a non-batched transport, so an active batch sibling cannot delay its cancellation. Checks for a tab's terminals run concurrently, keeping the overall wait near one timeout budget. The running-process confirmation, background-terminal exclusion, and existing fail-open policy are preserved. POST and legacy-host GET fallback are covered.

Refs #6376. Daemon reply correlation, dropdown Remove, and the issue's other control-plane symptoms remain separate.

How I tested it

Automated CDP input against an isolated dev desktop (renderer localhost:3105, CDP 9256), with its local test organization/workspace verified. A real tab contains two terminal panes running sleep 10000. Temporary fixture routes hold all six HTTP connections to that dev host-service:

  • Before: complete close took 4.04 s. The before screenshot shows the tab and both terminals still present at 3.58 s.
  • After: the tab closed in 2.06 s while all six connections were still held.
  • Healthy host: the running-process confirmation appears. Cancel retains both terminals; confirmation closes both.
  • Host session lists are empty after closing the fixture. No console errors occurred during the measured interactions; expected timeout warnings were captured.
Before: still open at 3.58 sAfter: closed at 2.06 s
BeforeAfter

Healthy-host confirmation · Measurements, scripts, source blobs, and fixture patch

This is synthetic HTTP-pool saturation, not a reproduction of the original 13–14-agent workload. Fixture routes were removed before lint/tests/typecheck/commit. The UI run used verified snapshot 8c30de370a7f62e6465bc9e25f8a09bdb9208c29; the four guard/transport files have identical blob IDs on the fresh-base head 66d281c51fab2951bd81bd0cad47d7c7d6185264. The installed app was not modified or restarted.

Latest validation:

  • bun run lint:fix, then clean bun run lint: pass.
  • bun run typecheck: 42/42 tasks pass on the final head.
  • Terminal library: 3973 tests pass, including a deferred-probe regression that fails before concurrent probing without waiting for a real deadline.
  • Workspace-client: 34 tests pass, including cancellation with an active same-tick batch sibling and legacy GET fallback.
  • After the final rebase/lockfile install: all four guard tests, scoped desktop/workspace-client typecheck, and clean lint pass again.

The initial full monorepo run on the earlier submission completed 28/30 tasks, failing in unchanged shared recurrence and agent-setup system-CLI fallback tests. No new full monorepo test run is claimed for this follow-up.

Codex assisted with implementation and automated verification. No human review or manual testing is claimed.

Checklist

  • PR title follows conventional commits (type(scope): subject)
  • bun run lint and bun run typecheck pass (CI fails on lint warnings too)
  • "Allow edits from maintainers" is checked on fork PRs
  • I have signed the CLA (the bot asks on your first PR)

Summary by CodeRabbit

  • Bug Fixes
    • Closing terminals is no longer held up indefinitely by a stalled status check. Checks time out after two seconds and treat the terminal as not running.
    • Terminal status checks continue to report accurately when they complete successfully, and both terminal checks run concurrently when confirming a close.
    • Aborting an individual request no longer disrupts other in-flight requests, and legacy service requests continue to work with batching enabled or skipped.