Repository navigation
fix(agents): prevent registry stalls during large fan-outs - #116286
Conversation
|
@clawsweeper review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: found issues before merge. Reviewed July 30, 2026, 3:37 AM ET / 07:37 UTC. ClawSweeper reviewWhat this changesThis PR changes the subagent-run registry so hot lifecycle mutations persist and cache only the named changed or removed runs instead of repeatedly rewriting the full retained registry. Merge readinessKeep this PR open for maintainer review. The incremental persistence design targets the reported large-fan-out stall and has focused regression coverage plus stress evidence, but the branch still adds a normal-PR entry to release-owned Priority: P2 Review scores
Verification
How this fits togetherThe subagent registry tracks active and retained agent runs while lifecycle code registers, completes, cleans up, and resumes them. Its SQLite persistence bridge and in-process read cache feed later gateway and agent lifecycle decisions. flowchart LR
A[Agent and subagent lifecycle events] --> B[Subagent run registry]
B --> C[Changed or removed run IDs]
C --> D[SQLite exact-row persistence]
C --> E[In-process read cache]
D --> F[Durable subagent state]
E --> G[Gateway lifecycle readers]
Decision needed
Why: The patch changes the durability boundary for agent lifecycle state; focused tests are present, but acceptance requires maintainer judgment over the complete lifecycle ownership surface. Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +114, Tests +103, Docs +1. Total +218 across 23 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Keep exact-row persistence for hot mutations, preserve full-snapshot replacement only at restore and reset boundaries, remove the release-owned changelog entry, and complete a maintainer audit of the lifecycle callers that now supply run IDs. Do we have a high-confidence way to reproduce the issue? Yes, at source level: the linked report specifies a production persistence-harness path that grows and terminalizes retained registry runs, and the PR body supplies before/after stress measurements. I did not independently execute that harness in this read-only review. Is this the best way to solve the issue? Yes, provisionally: exact-row persistence is the narrow owner-boundary fix because full replacement remains available for explicit restore and reset boundaries. The remaining review need is confirmation that every changed lifecycle path provides authoritative run IDs. Full review comments:
Overall correctness: patch is correct AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 7c47e4ad0e53. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
c4fd934 to
0ffe66b
Compare
|
ClawSweeper follow-up:
The remaining risk is a future mutation caller omitting its run ID; the centralized boundary and exact-row/cache regressions make that contract visible and testable. |
…n-dedupe * origin/main: (25 commits) fix(qqbot): use Gateway timezone for reminders (#116294) test(openai): cover out-of-order named mark acks docs(openai): clarify cumulative playback marks test(openai): cover sustained unnamed mark acknowledgements fix(openai): preserve playback acknowledgement order test(openai): verify bounded playback acknowledgements fix(openai): bound realtime playback marks test(agents): mock incremental registry persistence (#116307) fix(memory-core): MEMORY.md compaction deletes user notes written under a promotion-style heading (#116180) feat(reply): annotate recent history images (#100866) chore(ios): refresh native i18n inventory fix(ios): isolate capability router handlers docs(ios): cut 2026.7.22 release notes docs(hooks): document validation responses test(qa): assert hook account rejection reasons fix(gateway): validate hook delivery accounts perf(gateway): bound prepared runtime startup work (#116261) fix(agents): prevent registry stalls during large fan-outs (#116286) fix(sqlite): preserve replaced snapshot targets on Windows (#116284) fix(ci): load frozen shard runner without repository fetch (#116273) ...
…116286) * fix(agents): persist subagent registry mutations incrementally * chore(agents): leave release notes to release process
…n-dedupe * origin/main: (25 commits) fix(qqbot): use Gateway timezone for reminders (openclaw#116294) test(openai): cover out-of-order named mark acks docs(openai): clarify cumulative playback marks test(openai): cover sustained unnamed mark acknowledgements fix(openai): preserve playback acknowledgement order test(openai): verify bounded playback acknowledgements fix(openai): bound realtime playback marks test(agents): mock incremental registry persistence (openclaw#116307) fix(memory-core): MEMORY.md compaction deletes user notes written under a promotion-style heading (openclaw#116180) feat(reply): annotate recent history images (openclaw#100866) chore(ios): refresh native i18n inventory fix(ios): isolate capability router handlers docs(ios): cut 2026.7.22 release notes docs(hooks): document validation responses test(qa): assert hook account rejection reasons fix(gateway): validate hook delivery accounts perf(gateway): bound prepared runtime startup work (openclaw#116261) fix(agents): prevent registry stalls during large fan-outs (openclaw#116286) fix(sqlite): preserve replaced snapshot targets on Windows (openclaw#116284) fix(ci): load frozen shard runner without repository fetch (openclaw#116273) ...
Closes #116227
What Problem This Solves
Fixes an issue where large agent and subagent fan-outs repeatedly rewrote and deep-cloned every retained registry run for each lifecycle mutation, blocking the Gateway event loop and creating substantial transient memory churn.
Why This Change Was Made
Hot registry mutations now name the exact changed or removed run IDs. The SQLite owner upserts those rows and deletes exact absent IDs in one transaction, while the in-process read cache updates the same entries incrementally.
Explicit restore and test-reset boundaries retain complete-snapshot replacement and pruning. The schema, serialized record shape, rollback behavior, and persistence notifications are unchanged.
User Impact
Large concurrent fan-outs spend substantially less synchronous time persisting registrations, terminal transitions, cleanup, steering, and idle bookkeeping. Unrelated retained runs no longer multiply the work for each transition.
Evidence
Stress matrix
A throwaway production-module harness exercised:
The embedded registry returned to zero active runs and settled every waiter at 100-way concurrency. The dominant defect was durable subagent registry persistence.
Same-process before/after measurements on 100-run waves:
The wall-clock improvement was 13.0x for the growing wave and 3.9x for the terminal wave in that run. An earlier baseline run produced the same superlinear shape with lower absolute times, confirming normal host variance rather than a one-off ordering artifact.
Narrow regressions
Validation
Blacksmith Testbox:
tbx_01kyry1spj2tm24hy9y1t3t06nnode scripts/check-changed.mjs -- <changed files>Autoreview:
Not tested