Skip to content

fix(subagents): coalesce child refreshes without losing observations - #809

Open
Juliusolsson05 wants to merge 2 commits into
mainfrom
fix/subagent-refresh-coalescing
Open

fix(subagents): coalesce child refreshes without losing observations#809
Juliusolsson05 wants to merge 2 commits into
mainfrom
fix/subagent-refresh-coalescing

Conversation

@Juliusolsson05

@Juliusolsson05 Juliusolsson05 commented Sep 5, 2026

Copy link
Copy Markdown
Owner

Parent JSONL bursts and periodic polls could read the same child byte range concurrently, duplicating turns/tool calls and emissions (#802). Each Claude/Codex tracker now has one refresh owner and coalesces requests received during I/O into a trailing pass. Late appends and parent completion still drain; stopped trackers cannot repopulate offsets/accumulators or emit after a pending read completes. Transient poll errors remain retryable without unhandled background rejections.

Validation:

  • 34 focused subagent tests pass, including 10 new behavioral cases across both providers: overlap, late append/completion, split UTF-8 JSONL, transient error, and stop during I/O.
  • The same controlled burst tests fail against main: up to 52 concurrent range reads before, exactly one after; a late append requires two sequential reads. This is synthetic evidence, not a production CPU/FPS claim.
  • npm run typecheck, npm run test:contract, and git diff --check pass.
  • Reviewed refresh ownership, promise settlement, stop boundaries and per-provider correlation. Both full CI gates pass after the main rebase.

Plan committed before implementation: docs/superpowers/plans/2026-09-05-subagent-refresh-coalescing.md. No settings/protocol migration. Missing-rollout discovery remains separate (#803); follow-up #811 explicitly depends on this branch. No running agents or user working-tree files were changed.

Fixes #802

Current validation: rebased onto main f7507980 (toolkit #812 and MCP repair #818), head 51f47af4. Source changes from the earlier implementation are preserved; both required CI gates pass on this head (CI run). No merge is authorized.

Give each tracker one byte-offset owner across parent bursts and timer ticks. Coalesce pending triggers without dropping late appends or completion, and prevent in-flight reads from reviving stopped trackers.

Refs #802
@Juliusolsson05
Juliusolsson05 force-pushed the fix/subagent-refresh-coalescing branch from 689b110 to 51f47af Compare September 6, 2026 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(subagents): overlapping refreshes fold child transcript records repeatedly

1 participant