Skip to content

perf(sessions): reduce child-owner resolution cost - #183531

Merged
steipete merged 10 commits into
mainfrom
steipete/coldload-list-partition-refilter
Oct 25, 2026
Merged

steipete merged 10 commits into
mainfrom
steipete/coldload-list-partition-refilter

Conversation

@steipete

@steipete steipete commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Child-owner resolution repeats membership and descendant-topology work while agent run-state rows change, adding CPU and allocation to session-list preparation.

User Impact

Session-list preparation spends less CPU and allocation resolving child owners. The controlled mixed-load comparison observed lower server list-handler mean, CPU, GC time and event-loop p99 in both orders, with equal completed turns. No UI, configuration, schema, durable-record or authority change.

Non-claim: parent-selection fan-out reduction is unproven. The canonical harness recorded no parent selections, and running-candidate selections were about seven per list with mixed order deltas. Those counters do not reproduce the target production fan-out.

Production confirmation: openclaw_session_row_selections_total by kind / openclaw_sessions_list_requests_total before vs after deploy. The lead will assess those counters after deployment; this PR performs no deployment.

Why This Change Was Made

The existing registry owner now retains unchanged child/requester membership on status-only row replacement. Descendant closures retain child membership and resolve current canonical rows through the retained child index; actual link/generation changes invalidate topology. This removes repeated owner-index reconstruction and redundant child-owner resolution while preserving latest-generation/revocation semantics and observable child ordering. Gateway selection callers are unchanged.

Application runtime grows by 10 LOC across six owner files. The requested non-test/non-doc aggregate is +316 (390 insertions, 74 deletions): runtime +10 and owner benchmark +306. The small runtime growth preserves membership reuse together with generation/link invalidation and child iteration ordering.

Evidence

Owner microbench: AWS cbx_ecd65a6972ff, c7a.4xlarge, 16 observed CPUs / approximately 31 GiB RAM, Node 26.12.1. Eleven counterbalanced timing triples plus eleven separate allocation triples, main / earlier owner candidate / incremental candidate, 66 accepted processes. Each process exercises 48 parents × 200 children, 8,000 measured run-state updates and 240 resolution passes after warmup, through real registry writes, claims, publication and resolution with a prepared in-memory source adapter. All checksums agree.

Medians [Q1, Q3]; each of eleven paired CPU/allocation/GC deltas favors the incremental candidate against both controls. Owner benchmark source: main 60cde0098c78c21d22acedcd775982ba0c206502, the earlier candidate is that base plus the supplied owner patch, and measured incremental candidate a459fce76ef3ecd091430d0d15a6b375f5b0e1c6. Subsequent lint cleanup and the retained-read correctness repair are not included in those timing figures.

Owner metric Main Earlier candidate Incremental candidate
Resolution CPU, ms/pass 3.904 [3.846, 3.946] 3.612 [3.572, 3.714] 1.091 [1.042, 1.126]
Sampled allocation, KB/update 168.046 [167.808, 168.896] 161.480 [161.125, 161.735] 46.544 [46.065, 46.892]
Natural GC, ms/update 0.008603 [0.007941, 0.008664] 0.008270 [0.007741, 0.008336] 0.001378 [0.001349, 0.001585]
Captured-topology rebuilds / 240 passes 240 240 0
Owner benchmark paired deltas

Candidate minus control. Timing and allocation triples are separate experiments; row numbers identify the corresponding counterbalanced run within each experiment. Allocation uses decimal KB. All deltas below are negative.

pair,resolution_ms_vs_main,resolution_ms_vs_earlier,allocation_KB_vs_main,allocation_KB_vs_earlier,GC_ms_per_update_vs_main,GC_ms_per_update_vs_earlier
1,-2.750167,-2.587425,-120.846187,-114.416253,-0.007391929,-0.006007130
2,-2.876692,-2.383783,-121.559625,-115.248491,-0.007025578,-0.006596576
3,-3.098733,-2.746721,-121.389251,-113.551157,-0.006181479,-0.002286907
4,-2.769217,-2.375933,-122.291951,-114.785951,-0.007278967,-0.007089272
5,-2.645342,-2.510892,-121.764748,-115.680420,-0.006432420,-0.006644804
6,-2.704713,-2.545196,-122.219030,-114.898045,-0.005732238,-0.006991401
7,-2.783900,-2.482250,-123.586905,-115.299711,-0.007259404,-0.006855564
8,-2.850100,-2.656725,-120.896003,-114.409386,-0.006425990,-0.006714335
9,-2.922121,-2.573646,-120.989935,-115.270477,-0.007227040,-0.006939082
10,-3.321079,-2.514775,-123.957910,-115.884249,-0.003041084,-0.007125117
11,-2.577325,-2.815325,-121.184889,-114.855630,-0.007542136,-0.003090403

Canonical mixed load: AWS run, lease cbx_b845487cc57b, fixed c7a.4xlarge, 16 observed CPUs / approximately 31 GiB RAM, Node 26.12.1. Both revisions had independent frozen installs and full builds. Both 30-second smoke windows passed. Frozen base 150134610a43deb46ce17ef427184403f711d9c2, measured candidate/tooling a62be43869bd52c7efcdf1e3d2ca6c0a20321c9b; no rebase/source/build changes during comparison.

AB and BA, ten measured minutes plus one warmup minute per window: 10,800 synthetic sessions, 65 clients, four concurrent foreground mock-provider turns, 40 enabled plugins and 128 MiB transcripts. Timing only; allocation is covered by the owner benchmark. The controller requires --pairs 2 --mode timing --minutes 10 for both orders, forty measured minutes. Every window completed 40 foreground turns. All 160 Prometheus scrapes were collected; server handler and request-counter deltas agree at 1,173 per window.

Mixed-load metric, base → candidate AB BA
Server list-handler mean, ms 17.091 → 15.910 16.514 → 15.985
Server list-handler estimated p90, ms 36.481 → 35.299 36.397 → 35.725
Main-thread CPU, seconds/window 62.855 → 60.873 62.248 → 61.752
Main-thread GC, ms/window 2358.142 → 2206.929 2303.604 → 2272.329
Minor GC count / total ms 593 / 1555.918 → 579 / 1493.168 589 / 1506.671 → 585 / 1501.002
Major GC count / total ms 20 / 774.044 → 19 / 687.420 18 / 769.925 → 18 / 747.245
Event-loop p99, ms 37.716 → 36.635 37.913 → 36.700
Main-thread stalls 0 → 0 0 → 0
Server agent admission mean, ms 4.063 → 4.162 4.311 → 4.200
Completed foreground turns 40 → 40 40 → 40
Running-candidate selections/list (non-claim) 6.795 → 6.996 7.714 → 7.396

No earlier-candidate-style mixed-load GC regression was observed: GC time and event-loop p99 were lower in both orders. These are two controlled orders, not an eleven-pair significance claim. Server histogram p90 is bucket-interpolated over the first-to-last scrape interval; CPU/GC/event-loop and turn totals cover the measured window. Parent selection series were absent in all four windows; no reduction is claimed. Parent-selection fan-out remains unproven.

Retained-read correctness: the existing captured read-index contract survives a caller clearing its source Map. CI exposed a defect in the earlier candidate's input-Map lookup; cached child keys now resolve through the existing retained child index. The repair keeps one Map lookup, adds no container or runtime LOC, and extends the existing read-context test with descendant-list coverage. The numerical performance tables above describe their recorded measured revisions, before this repair.

Validation

Final source head: c7d4c4bc8488bc8e0f3f48eac86df1c053fe75a7, rebased onto 38753ff3b97dcd388165b063f32d4788324e2a08. Main's narrower worker-telemetry loader fix (#183579) replaces the PR's superseded generic resolver, test and documentation. All eleven remaining changed files—the six application owner modules, owner benchmark and four test files—are byte-identical to the complete broad-tested checkpoint 515af4e5e936123c4aec29c9751043e2ea11f08c.

Complete broad-domain proof, reused for that unchanged content: AWS validation run, lease cbx_b1d9135b50b2, c7a.4xlarge, Node 26.12.1. Full registry: 87 files across six test projects, 1,567 passed / one existing benchmark case skipped (977.21 s wall). Full session-list/selection: 43 files, 333 passed / three skips (235.38 s). Full list/read/active-run methods: 17 files, 132 passed / three skips (160.74 s). The seven skipped cases are six existing opt-in benchmark files; no skip or expected-failure policy changed. These are checkpoint results, not a claim of rerunning all broad suites on the rebased head.

Fresh integration proof on the final head: AWS run, lease cbx_a158264efdab, fixed c7a.4xlarge, 16 observed CPUs / approximately 31 GiB RAM, Node 26.12.1. Independent frozen install and full build passed. Seven affected owner/list files passed 109 tests (108.06 s wall); upstream stress tooling passed six tests (4.05 s). pnpm test src/agents/subagents/registry/subagent-registry-read-context.test.ts --maxWorkers=1 passed all five tests (42.44 s). The real isolated Gateway smoke passed with 108 synthetic sessions, 1 MiB transcripts and no warmup, using main's canonical loader. The owner checksum remained 51836 over 8,000 updates and 240 resolution passes, with zero topology rebuilds. Smoke/checksum results are setup/correctness proof, not a new timing comparison.

Earlier changed-test wall times (pnpm test <file> --maxWorkers=1): registry memory 44.55 s, registry queries 45.32 s, navigation lineage 63.74 s. They are earlier pinned-head figures; the fresh affected group and focused retained-read results are reported separately above.

pnpm check:changed --base 38753ff3b97dcd388165b063f32d4788324e2a08 --head c7d4c4bc8488bc8e0f3f48eac86df1c053fe75a7 --timed completed in 915.37 s without skip flags. Core, all 29 core-test shards and scripts typechecks passed; formatting, lint and every other guard passed. The command exits 1 solely for global unused exports: one script and ten full-tree findings; production exports pass. The same scan on independently installed current main d754f7c3ae79e50de4471c60cfb115665bd9db45 also exits 1 with the identical eleven findings, zero candidate-only findings.

Inherited unused exports, identical on candidate and main
full-tree: extensions/reef/src/transport.test-helpers.ts: signing
full-tree: src/claws/packages.boundary.test-support.ts: rollbackStatelessClawPackages
full-tree: src/infra/device-auth-store.test-support.ts: readOriginDeviceTokenReadOnlyForTest
full-tree: src/infra/provider-usage.test-support.ts: ProviderUsageAuth
full-tree: src/infra/provider-usage.test-support.ts: loadUsageWithAuth
full-tree: ui/src/test-helpers/control-ui-projection-fixture-contract.ts: CoreProjectionFamily
full-tree: ui/src/test-helpers/control-ui-projection-fixture-contract.ts: SdkAvatarFamily
full-tree: ui/src/test-helpers/control-ui-projection-resource-probe.ts: ProjectionScanCounts
full-tree: ui/src/test-helpers/control-ui-projection-resource-probe.ts: ProjectionSourceCounts
full-tree: ui/src/test-helpers/control-ui-projection-resource-probe.ts: createProjectionResourceProbe
script: .agents/skills/telegram-e2e-userbot/scripts/run-mock-sut-user-e2e.mjs: createScenarioCommandEnvironment

Fresh detached autoreview of the complete final candidate against its pinned base is clean through P2, with no accepted/actionable findings. Final source verification passed. No source changes followed that review.

Exact-head CI: run 40204128638 is green on c7d4c4bc8488bc8e0f3f48eac86df1c053fe75a7: 69 successful checks, 54 skipped, one neutral; no failures or pending checks. No CI reruns were used to chase green. An earlier head's retained-source-Map regression was fixed as described above; its authentication diagnostic also passes on the broad-tested checkpoint and final CI.

All owned leases have been stopped and provider cleanup is confirmed complete. Production fan-out confirmation remains open; this PR neither changes Gateway selection callers nor deploys to production.

@clawsweeper

clawsweeper Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime scripts Repository scripts agents Agent runtime and tooling size: L labels Oct 25, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 25, 2026
@clawsweeper

clawsweeper Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR reuses unchanged subagent memberships and descendant links to reduce session-list CPU and allocation.

Example: A session list is refreshed while 48 parents with 200 children each receive run-status updates.

  • Before: Status changes rebuild relationship data; recorded owner resolution costs 3.904 ms per pass.
  • After: Unchanged relationships are retained; the measured candidate costs 1.091 ms per pass while resolving current rows.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, correct optimization with shipped Gateway evidence and green exact-head CI; reported performance gains remain bounded to the measured workloads and revisions.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): Recorded output covers real isolated Gateway sessions.list traffic in both comparison orders and a final-head Gateway smoke, supported by owner checksums and regression suites; timings predate the disclosed retained-index repair, and production parent-selection fan-out remains outside the claim.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Large, changing subagent registries add avoidable CPU and allocation to session-list preparation.
Reason: The maintainer-authored direction has measured owner and Gateway benefits with limited runtime growth; new flags belong only to the isolated benchmark.

Merge readiness

✅ Ready for maintainer review

Keep this PR open for landing: the focused optimization has measured value, addresses the earlier review request, and has no actionable correctness findings.

Priority: P2
Reviewed head: c7d4c4bc8488bc8e0f3f48eac86df1c053fe75a7

Before merge

None.

Findings

None.

Agent review details

How this fits together

The subagent registry maintains run membership and topology; Gateway session-list preparation consumes those facts to resolve child relationships while checking current execution ownership.

flowchart TD
  A[Run status publications] --> B[Registry membership indexes]
  B --> C[Retained descendant keys]
  C --> D[Current canonical rows]
  D --> E[Gateway child owner resolution]
  F[Live execution ownership] --> E
  E --> G[Session list response]
Loading

Technical review

Best possible solution:

Land the existing-owner optimization with its bounded performance claims and preserve production fan-out confirmation as a deployment follow-up.

Do we have a high-confidence way to reproduce the issue?

Source shows unconditional relationship invalidation and remove/add index maintenance on status replacements; the PR supplies controlled owner and Gateway measurements, which this read-only review did not rerun.

Is this the best way to solve the issue?

The patch removes repeated work inside existing owners, preserves generation invalidation and iteration order, and avoids redundant retained-state reads for durable native lineage.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 981699fb940d.

Provenance checked

  • Registry index maintenance and collector ordering keeps the original intent (d8e684e: Consolidate mutation-owned indexes; subsequent recorded-owner work preserved collector membership and replacement ordering.)
  • Descendant closure reuse keeps the original intent (f809da5: Reuse relationship traversal while preserving latest-generation membership and live-run semantics.)
  • Captured membership topology keeps the original intent (570c7bc: Share immutable topology through the existing mutation-maintained lookup without replacing live authority checks.)
  • Durable native lineage and current controller keeps the original intent (4e26493: Keep native parent relationships readable after run retention expires while leaving current execution control separate.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Pinned patch and current main: Reviewed the introduced merge-base-to-head diff; fetched main retains the original behavior in the affected registry and Gateway owners. (src/agents/subagents/registry/subagent-registry-read-topology.ts:118, c7d4c4bc8488)
  • Invalidation and retained-read correctness: Generation or grouping changes invalidate descendant membership; status-only replacements resolve through the retained latest-child index, including after the source Map is cleared. (src/agents/subagents/registry/subagent-registry-read-context.test.ts:165, c7d4c4bc8488)
  • Ownership checks preserved: The existing owner-qualified registry index supplies candidates; Gateway controller resolution still checks live execution or reservation and the current session incarnation. (src/gateway/session-utils-core.ts:180, c7d4c4bc8488)
  • Earlier review request addressed: The complete PR body records both Gateway AB/BA orders with lower list-handler mean, CPU, GC time and event-loop p99, equal completed turns, and an explicit non-claim for parent-selection fan-out. The final-head Gateway smoke and owner checksum are reported separately from earlier timing measurements. (c7d4c4bc8488)
  • Exact-head CI: The linked workflow completed successfully on the reviewed head; complete paginated check results contain 74 successes, 65 skips, one neutral result, and no unfinished or failed checks. (c7d4c4bc8488)
  • Feature history and original contracts: History across the registry file moves identifies Peter Steinberger's membership/topology work and Vincent Koc's earlier high-fanout indexes; the recorded-owner and durable-parent contracts remain intact. (src/agents/subagents/registry/subagent-registry-memory.ts:731, 981699fb940d)

Likely related people:

  • Peter Steinberger: Raw commit 44c9551 adds src/agents/subagents/registry/subagent-registry-read-topology.ts:11 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 44c955105b16; files: src/agents/subagents/registry/subagent-registry-read-topology.ts)
  • Vincent Koc: Raw commit 01f75d1 adds src/agents/subagent-registry-memory.ts:112 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 01f75d186f5a; files: src/agents/subagent-registry-memory.ts)

PR surface

Source +10, Tests +148, Other +306. Total +464 across 11 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 6 84 74 +10
Tests 4 148 0 +148
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 306 0 +306
Total 11 538 74 +464

Review metrics

Metric Value Why it matters
Runtime and validation growth Application runtime +84/-74; regression tests +148; owner benchmark +306 The small runtime increase retains membership without adding a competing owner; the separate benchmark makes the measured workload repeatable.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P2: This improves session-list preparation under large retained registries without changing configuration or user-visible contracts.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-25T10:58:07.887Z sha 3b72f73 :: needs maintainer review before merge. :: none

Reviewed October 25, 2026, 11:56 AM ET / 15:56 UTC (Revision 2).

@steipete
steipete force-pushed the steipete/coldload-list-partition-refilter branch from 3b72f73 to a62be43 Compare October 25, 2026 11:27
@steipete steipete closed this Oct 25, 2026
@steipete steipete reopened this Oct 25, 2026
@steipete steipete changed the title experiment(control-ui): incremental child-owner memberships [do not merge] perf(sessions): reduce child-owner resolution cost Oct 25, 2026
@steipete
steipete marked this pull request as ready for review October 25, 2026 12:46
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-25T14:58:39.925245Z c7d4c4b New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@steipete
steipete force-pushed the steipete/coldload-list-partition-refilter branch from a62be43 to 515af4e Compare October 25, 2026 13:18
@steipete
steipete force-pushed the steipete/coldload-list-partition-refilter branch from 515af4e to c7d4c4b Compare October 25, 2026 14:50
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@steipete
steipete merged commit 11de7dd into main Oct 25, 2026
143 checks passed
@steipete
steipete deleted the steipete/coldload-list-partition-refilter branch October 25, 2026 15:56
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Oct 25, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 26, 2026
Child-owner resolution sits under every sessions.list via per-owner running-candidate and per-parent child-link selections. On Team those run about 57 and 47 times per list call (row-selection counters). Each run-state update rebuilt or reallocated index state.

The registry run index now updates a run's buckets in place:
- one update(previous, next) call instead of remove + add;
- singleton buckets are retained on status updates.

The read topology also changes:
- its descendant cache holds child keys rather than run records, so status-only updates no longer clear it;
- rows resolve from the live index at read time;
- membership or generation changes still clear the cache.

resolveSessionChildOwners decides `keep` for native lineage without loading the display run. getLatestLiveSubagentRunByChildSessionKey uses the live child/agent index directly. Owner matching is unchanged: the owner is derived from the child key, and unqualified keys still yield no owner.

Evidence. Microbench (11 triples: main / prior candidate / this):
- resolution CPU 3.904 / 3.612 / 1.091 ms per pass;
- allocation 168.0 / 161.5 / 46.5 KB per update;
- GC 0.0086 / 0.0083 / 0.0014 ms per update;
- all pairs favor this change.

Team-shape stress harness (real tool turns + native subagents; AB and BA, 40 turns each):
- server list-handler mean 17.09 -> 15.91 ms and 16.51 -> 15.98 ms;
- CPU, GC time and event-loop p99 lower in both orders;
- completed turns equal.

Not claimed: a reduction in parent-selection fan-out per list call. The harness produces no parent selections; this will be checked on Team via openclaw_session_row_selections_total by kind / openclaw_sessions_list_requests_total before and after the deploy.

Runtime +10 LOC. 2,032 broad tests pass; exact-head CI green.
steipete added a commit that referenced this pull request Oct 26, 2026
…184698)

Row presentation resolved each child session's controller by iterating that child's runs through the registry (iterator, closure and owner tuples per call), and countActiveDescendantRuns walked descendant runs on every list. On Team these were among the top selection-side allocation families (getSubagentRunsForChildSession, resolveSessionChildController, countDescendantRuns).

The incremental registry run index (#183531) now keeps the latest matching controller per child session current through its existing update path, so presentation reads it directly. Descendant reads iterate the prepared buckets without per-call allocation, rebased on #184566, which already passes prepared descendants into countDescendantRuns. Results are identical; property tests cover status transitions, replacement runs and agent mismatches.

Evidence, 11 interleaved pairs on AWS c7i.4xlarge: owner-resolution allocation 8.551 -> 1.645 MB/pass (-80.8%, 11/11), descendant reads 292.1 -> 72.8 KB (-75.1%, 11/11), whole-list allocation 4.446 -> 4.299 MB (-3.3%, 10/11); CPU inconclusive. Team-shape harness (20 measured minutes): handler mean 16.67 -> 16.88 ms, main CPU 12.49% -> 12.55%, GC flat, 40/40 turns, zero RPC errors; no regression under the rule. 174 tests pass. Runtime +45 LOC.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 27, 2026
…penclaw#184698)

Row presentation resolved each child session's controller by iterating that child's runs through the registry (iterator, closure and owner tuples per call), and countActiveDescendantRuns walked descendant runs on every list. On Team these were among the top selection-side allocation families (getSubagentRunsForChildSession, resolveSessionChildController, countDescendantRuns).

The incremental registry run index (openclaw#183531) now keeps the latest matching controller per child session current through its existing update path, so presentation reads it directly. Descendant reads iterate the prepared buckets without per-call allocation, rebased on openclaw#184566, which already passes prepared descendants into countDescendantRuns. Results are identical; property tests cover status transitions, replacement runs and agent mismatches.

Evidence, 11 interleaved pairs on AWS c7i.4xlarge: owner-resolution allocation 8.551 -> 1.645 MB/pass (-80.8%, 11/11), descendant reads 292.1 -> 72.8 KB (-75.1%, 11/11), whole-list allocation 4.446 -> 4.299 MB (-3.3%, 10/11); CPU inconclusive. Team-shape harness (20 measured minutes): handler mean 16.67 -> 16.88 ms, main CPU 12.49% -> 12.55%, GC flat, 40/40 turns, zero RPC errors; no regression under the rule. 174 tests pass. Runtime +45 LOC.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant