Repository navigation
perf(subagents): release settled run text from memory - #173548
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review in progressClawSweeper is reviewing this revision. This supersedes any previous blocked status. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3f19f828f0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cfed1522ad
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8aa841db28
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
* perf(subagents): release settled run text from memory * test(subagents): cover sliced terminal reply retention * fix(subagents): preserve compact read ownership and hydration readiness * test: prune obsolete mock export allowances * test(subagents): preserve durable payloads in integration fixtures * test(subagents): isolate scoped registry read fixtures
The lifecycle fixture gained durable persistence in f4f4b19 (#173548). Its first write starts SQLite idle-retirement and WAL-maintenance timers, contaminating the fresh-yield test fake clock even though the requester retry timer is cleared correctly. Initialize fixture storage before enabling fake timers. Preserve every timer-count and duplicate-wake assertion; no product behavior changes. Validation: reproduced the original failure under Bun and Node; all 291 lifecycle, retry, and requester-yield tests pass under each runtime. Targeted type-aware lint, format, diff checks, and Codex review pass.
The lifecycle fixture gained durable persistence in 1b8b54b (openclaw#173548). Its first write starts SQLite idle-retirement and WAL-maintenance timers, contaminating the fresh-yield test fake clock even though the requester retry timer is cleared correctly. Initialize fixture storage before enabling fake timers. Preserve every timer-count and duplicate-wake assertion; no product behavior changes. Validation: reproduced the original failure under Bun and Node; all 291 lifecycle, retry, and requester-yield tests pass under each runtime. Targeted type-aware lint, format, diff checks, and Codex review pass.
What Problem This Solves
Settled subagent runs retained full task and result strings in the live registry, persisted-row cache, and session-list indexes for the lifetime of retained history. Aggregate-only heap analysis identified 7,080 registry task holders (25.16 MiB), 6,635 completion result holders (33.70 MiB), and 704 pending-delivery task holders (2.93 MiB). Retainer paths overlap; these are not additive retained-size claims. No snapshot or user text was exported.
User Impact
Completed runs release large task/result payloads after cleanup and requester obligations settle. Full selected reads, later metadata writes, and restart recovery preserve durable text. Pending/suspended delivery, requester settlement, yielded work, and cancellation retain their payloads.
Why This Change Was Made
The existing registry keeps a detached 160-character task preview and hydrates selected payloads through its worker reader. FIFO mutations hydrate before planning, preventing later metadata writes from replacing durable text with a preview. Session-list indexes retain compact facts with the original runtime identity, preserving executor/reservation liveness. They compare ownership and displayed facts so progress-only publications do not invalidate projections.
No schema, stored format, durable-retention, or configuration change. Production delta: +159 lines net (+212/-53). The growth implements the required hydration boundary while preserving durable text and lifecycle ownership.
Scope: compact identity/status records remain resident for topology and authorization; this does not cap record count or total registry memory. Structured collector results, schemas, and diagnostic strings remain unchanged. Collector schemas also participate in synchronous request authorization. Visible terminal-reply evidence retains its existing 4,096-character bound.
Evidence
Measurement
Isolated Linux fixture uses the real registry writer, resident caches, session-list index, and forced GC: 6,000 completed runs across 5,000 child-session keys, in batches of 64. Each has independent 4,096-character task and 6,144-character result strings plus a retained 4,096-character visible reply. This is subsystem memory proof, not a whole-Gateway load test.
Retained heap falls 48.2%. RSS/time include the source loader, workers, and initialization; elapsed time is effectively neutral in this single paired run, with no throughput gain claimed. Earlier heap baselines varied by about 4.45 MiB; the table uses the conservative final paired result. A fixture without visible replies retained 79.13 → 23.79 MiB (13.19 → 3.97 MiB/1,000).
Representative observed retainers:
Object.runs -> SubagentRunMap.table -> array -> Object.task,SubagentRunIndex.latest -> Map.table -> array -> Object.task, session-listinMemoryRuns/inMemoryDisplayByChildSessionKey, andObject.completion -> Object.resultText.Validation
8dda2ed52038a9849597869c1644638d74b13687, including PostgreSQL conformance, changed tests, typechecks, lint, and the combined CI/security gate. The last review repair replaces a broad partial mock with an explicit isolated factory; all seven scoped-read cases and the mock-export ratchet pass. Earlier runs exposed the repaired fixture/readiness issues and one GitHub download timeout during setup; none are described as passing evidence. No Testbox/Crabbox lease was allocated under this lane's validation policy.