Count Codex background terminals

This commit is contained in:
iris-ai committed 2026-09-16 01:07:40 -04:00
1 parent cbae7ee8c0
commit 827a30768c
5 files changed
+361 -35

No files matched your search

+11 -6
View File
@@ -899,12 +899,17 @@ The ordinary notifications still supply outcomes and summaries, including when
one is ordered after the level already corrected the status. Older CLIs send no
level and retain the edge fallback below.
Codex has no equivalent level for the whole session. Its collaboration
lifecycle does have the fact the screen needs: the subagent registry counts
its open child threads, including ones found on disk after adoption, and emits
the same `backgroundTasks` event whenever that count changes. Backgrounded
Codex commands are not included because app-server exposes no session-level
set for them; the UI does not infer a count from tool cards.
Codex's collaboration lifecycle supplies the subagent half of the same fact:
the registry counts its open child threads, including ones found on disk after
adoption. App-server's experimental `thread/backgroundTerminals/list` supplies
the command half as an authoritative set of process ids. The driver keeps that
set only in memory, refreshes it at terminal lifecycle boundaries and once a
second while nonempty, and adds its size to the open-child count. A response
for an unknown request cannot alter the set, and a lifecycle edge never
blindly decrements it. Starting a replacement app-server resets the command set
to zero; adopting one asks it for a fresh snapshot. Every total change emits
the same `backgroundTasks` event, and the UI does not infer a count from tool
cards.
What the notification is still used for is the status: it is what closes a task
in `Status::Waiting`'s bookkeeping. Handled once, however many of the two