(session-state): subagent activity feeds the same running set and the same rung for every source - #288
Merged
Merged
Conversation
… same rung for every source A remote or local-transcript subagent event now threads its agentId into activeSubagentsByParent through one write path, so the child row gets the same running dot, slot and TTL as a local PTY subagent. Closes #285. On a remote parent, a busy touch that coincides with a fresh subagent spawn (3 s window, either order) no longer outranks agentsBusy for the 20 s decay: the Task-tool invocation writes the parent's own transcript too, which put the remote row on the animated busy rung while the local row sat on the static agents-busy rung. A busy touch outside the window still wins. Closes #284.
…ent runs; ownership guard honours attach Replaces the coincidence window: a remote parent's busy decay is 3 s instead of 20 s whenever agentsBusy is set, on every subagent touch rather than the first spawn edge, and busy is never cleared synchronously. A parent that really works keeps writing at the 1 s throttle and stays busy; one merely bookending a Task-tool call lands on agentsBusy within seconds. reflectSubagentRunningState now repaints the parent slot unless the row is genuinely remote-owned (present and not attached), so an attached remote row gets the same live repaint as a local one.
…ame short decay while a subagent runs seedRemoteActivity computed its remaining window from PIP_DECAY_MS, so a rebuild triggered by the subagent's own writes put a waiting parent back on the busy rung for up to 20 s after its short decay had fired.
This was referenced Sep 13, 2026
Merged
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.
Closes #284, closes #285.
Both come from the parity audit (
.work-files/switchboard/parite-sidebar-2026-09-13.md, findings A2 and B1/B2), reproduced through the real renderer under jsdom.#285 — running dot on remote / local-transcript subagent rows.
activeSubagentsByParentwas fed only by the localsubagent-spawned/subagent-completedIPC pair; the remote watch event and the local-transcript adapter set the parent'sagentsBusyand dropped theagentId.noteSubagentActivity(parent, agentId)inpublic/sidebar.jsis now the single write path for the three sources, so the child row gets the same.runningdot, slot and TTL. The B2 hypothesis (DOM id mismatch) does not hold: subagent rows are ided fromsubagentSessionId(parent, agentId)on every layout, and the existing no-rebuild test passes onmain. One side effect fixed on the way:reflectSubagentRunningStaterepainted the parent slot from the local-pty snapshot, which would have blanked a remote or local-transcript parent's icon — it now repaints only when local-pty owns the row.#284 — remote parent on the animated busy rung while only a subagent runs. A Task-tool invocation writes the parent's own transcript too, so the remote watch channel fired a plain
busythat outrankedagentsBusyfor the 20 s decay. The parent's busy decay is nowSUBAGENT_PARENT_DECAY_MS= 3 s instead ofPIP_DECAY_MS= 20 s wheneveragentsBusyis set: every subagent touch shortens a pending longer decay,busyis never cleared synchronously. A parent that really works keeps writing at the 1 s IPC throttle and staysbusy; one merely bookending a Task-tool call lands onagentsBusy— the local row's rung — within seconds. A parent with no subagent keeps the 20 s decay. A first version used a 3 s coincidence window keyed on the spawn edge; review reproduced two failures (genuine output swallowed inside the window; a second spawn has no edge) and it was replaced. Domain PRIORITY untouched.seedRemoteActivitykeeps itsPIP_DECAY_MSarithmetic (out of scope, noted in the context doc).Tests:
test/dom-sidebar-subagent-running-parity.test.js(remote, local-transcript, decay, local IPC without rebuild, attached remote parent repaints live, unattached remote parent's remote-painted icon untouched);test/remote-session-adapter.test.jswith an injected clock (busy holds under 1 s touches while a subagent runs; a coincident touch decays toagentsBusyat 3 s; a second spawn shortens the decay; no-subagent parent keeps 20 s). Rationale in.ai/contexts/session-state.mdand.ai/contexts/subagent-observability.md.