Repository navigation
perf(agents): index subagent recovery ownership - #119793
Conversation
2ef3096 to
88b146c
Compare
|
Maintainer reconciliation: ClawSweeper run https://github.com/openclaw/clawsweeper/actions/runs/31062375377, shard 8, completed its exact-head review of |
|
Merged via squash.
|
* perf(agents): benchmark indexed recovery ownership * perf(agents): index recovery owner lookups
…cope * origin/main: (24 commits) fix(backup): skip transient gateway lock databases (openclaw#119782) test(agents): use canonical auth session fixtures (openclaw#119821) fix(memory): keep QMD file hints after stale docid misses (issue openclaw#113041) (openclaw#113515) test(doctor): align fast-path repair contracts (openclaw#119812) perf(agents): index subagent recovery ownership (openclaw#119793) fix(gateway): keep chat startup off catalog discovery (openclaw#119742) fix(test): keep TUI PTY suites in their owner lane (openclaw#119787) docs: correct dashboard auth precedence (openclaw#119785) docs: document control ui owner handoff fix: grant host-authorized control ui owner access fix(worktrees): preserve registered roots during orphan cleanup (openclaw#119709) fix(matrix): prevent shared client key collisions (openclaw#119667) fix(diagnostics-otel): propagate exported span context (openclaw#112283) fix(worker): isolate state observer failures (openclaw#117507) fix(qa): attest realized profile executions (openclaw#119761) fix(gateway): finish successful sessions after timestamp races (openclaw#119752) fix(agents): fence restart recovery lifecycle (openclaw#119776) fix(ui): preserve chat history and active run timing (openclaw#119729) improve(ollama): reduce inactive startup cost (openclaw#119745) improve(gateway): defer inactive plugin runtime imports (openclaw#119733) ...
What Problem This Solves
Resolves an operational performance problem where restart recovery sweeps repeatedly scanned the entire live subagent registry to determine ownership for each row. Large recovery sets therefore paid quadratic ownership-check cost while the registry already maintained a child-session index.
Why This Change Was Made
Base SHA:
a20746e3abf7378462448c456eaa7098b85aab48The child-session index in
subagent-registry-memory.tsis the architectural owner for live generations of one child session. This change threads that existing lookup into restart recovery and durable kill reconciliation, removing five full-registry scans: one in the recovery coordinator and four in durable kill ownership/task checks.Ownership is re-read at the existing await boundaries. Recovery currency is target-aware across source rows, accepted remaps, settlement, receipt clearing, and resume, so a stale generation cannot mutate a newer owner.
Independent best-fix review compared the owner boundary and sibling recovery paths. It confirmed that reusing the canonical child-session index is preferable to adding a recovery-local cache or downstream guards.
There are no config, schema, persistence-format, scheduling, protocol, or public API changes.
Complexity and size
Kownership checks change fromO(K*N)full-registry work toO(K*G), whereGis the live generation count for that child session and is normally 1.O(K*N^2)toO(K*N*G); the existingO(N log N)sweep ordering remains.+41/-42, net-1.+108/-16, net+92.+10/-5, net+5.User Impact
Operators with large retained subagent recovery sets get substantially lower restart-recovery sweep latency without changing recovery semantics, configuration, stored data, or required actions.
Evidence
Same-lease benchmark
Exact command:
Environment: Node
v24.19.0, AMD EPYC, 4 CPUs. Baseline and final ran sequentially on the same Testbox lease. Both invariant sets were green and identical.The 32-row final p99 is one scheduler outlier; its p50 and p95 both improved. The post-benchmark lint amendment only introduced a type alias and test deferred helper; TypeScript emitted runtime JavaScript remained byte-identical.
Race proofs
Verification
29 + 19 + 8 + 2 + 7).git diff --checkpassed.check:changedpassed with lanescore, coreTests, scripts, tooling.No changelog entry: this is an internal performance and ownership repair with no new user-visible surface or operator action, and
CONTRIBUTING.mdleaves changelog edits to the landing maintainers.AI-assisted implementation; the code, race behavior, benchmark methodology, and final proof were reviewed directly.