Repository navigation
perf(agents): reuse unchanged catalog executor entries - #137703
Conversation
|
Codex review: blocked before merge. Reviewed September 4, 2026, 2:03 AM ET / 06:03 UTC. ClawSweeper reviewWhat this changesThe PR reuses unchanged Tool Search catalog entry descriptors when their IDs and executor objects match, while cloning and rebinding entries when an executor changes. Merge readiness⛔ Blocked before merge - 3 items remain Keep open. The introduced optimization preserves the existing same-run behavior and current main still allocates the discarded descriptors; this maintainer-authored, protected PR needs exact-head CI completion and a maintainer landing decision. Priority: P3 Review scores
Verification
How this fits togetherTool Search turns an agent run’s callable tools into a catalog used by Tool Search and OpenClaw Code Mode. The shared compactor registers that catalog before the runtime resolves an entry and invokes its current executor. flowchart LR
A[Agent run tools] --> B[Shared catalog compactor]
C[Existing run catalog] --> D{Fingerprint, IDs, and executors match?}
B --> D
D -->|Yes| E[Reuse entry descriptors]
D -->|Executor changed| F[Clone and rebind entries]
E --> G[Tool Search runtime]
F --> G
G --> H[Current tool execution]
Decision needed
Why: Source review finds no semantic regression, but accepting internal performance complexity and landing a protected maintainer PR requires maintainer disposition. Before merge
Agent review detailsSecurityNone. PR surfaceSource 0. Total 0 across 1 file. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the shared exact-identity fast path and the existing clone-and-rebind fallback, then land only after exact-head CI passes and a maintainer accepts the allocation-only optimization. Do we have a high-confidence way to reproduce the issue? Not applicable: this is an allocation optimization rather than a report of broken user behavior; source inspection establishes the unchanged and rebound execution paths. Is this the best way to solve the issue? Yes. The shared compactor is the canonical owner, and exact executor identity preserves the old retained state while avoiding copies; differing executors still take the established rebind path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against bd4c647ccff7. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
68a3b54 to
3583560
Compare
|
Investigated the current compact-large1 failure at head A local Node 26.8.1 run of that exact fixture passed all 14 cases. Temporary timing observations localized its cold cleanup delay to the Browser cleanup call in One controlled composition with all nine exact files from #137671 at Both arms passed all 14 cases. The driver's child-and-process-group interval fell from 90.853 to 26.567 seconds; this excludes the later source rehash, temporary-runtime removal and receipt publication. Cold Browser cleanup fell from 63,019.545 to 2,699.558 ms; the three warm calls fell from 1,026–1,048 ms to 133–139 ms. During the cold call, process RSS growth was 1,394,982,912 bytes before and 168,755,200 bytes with the Browser patch; heapUsed growth was 445,662,632 and 169,214,296 bytes respectively. These are local Vitest-process snapshots, without forced GC. They are not retained-heap or live-Gateway measurements, and the local fixture passing in both arms does not prove the exact hosted Linux timeout's cause. The replacement case itself took 2,247 ms before and 1,333 ms with the composition. No request timeout was increased and no assertion was weakened. The Browser fix already has its own PR and will be reused rather than duplicated here. The comparison's source hashes stayed stable; both supervised processes joined and their process groups and temporary runtimes were absent afterward. Hosted CI remains required, including the separately failing npm advisory audit. A separate bounded observation run checked the candidate's actual execution path, because cleanup warnings can otherwise be swallowed. All four Browser calls entered the candidate maintenance surface, selected zero tracked tabs in the candidate registry, and returned normally with |
3583560 to
a5066a8
Compare
a5066a8 to
957db4c
Compare
|
Maintainer decision under the user-authorized performance campaign: land the same-run descriptor reuse. Exact catalog IDs and tool object identity remain mandatory; any changed executor retains complete rebinding. No new cache, stored state or public surface is introduced. Exact-head CI run 33842286598 passed all selected gates; 134 successful,42 skipped,1 neutral checks and none failed or pending in the terminal snapshot. Advisory clearance was not obtained: the inspected security job ended three audit attempts with HTTP503 and continued under the existing availability policy. No security/test gate was changed or waived here. |
|
Merged via squash.
|
What Problem This Solves
Tool Search catalog reuse rebuilt every entry record even when its fingerprint, exact IDs and executor functions were unchanged. Those copies were discarded on the common unchanged path.
Why This Change Was Made
Check executor identity against the existing entries first and reuse the entry array when no binding changed. Changed executors still trigger the existing complete rebind, so fresh tool implementations are never hidden by catalog reuse.
User Impact
Repeated preparation of an unchanged catalog avoids copying all entry records. Tool schema, order, policy and execution semantics are preserved.
Evidence
Fourteen public-owner scenarios and 24 execution dispatches matched before and after. A 128-entry catalog reused 25 times eliminated 3,200 discarded row copies. The existing reuse subset passed 15 tests, with another 23 tests covering catalog lifetime and prompt-policy siblings. Independent Codex review found no actionable P0–P2 issue; the full changed gate passed in 297.76 seconds with unchanged source and verified cleanup.
Production +12/−12, net zero; tests unchanged. No new cache, public API, configuration or persistence policy. Timing and RSS from the functional probe are not performance claims.
Combined live verification
The final isolated twenty-change composite passed ten admitted real OpenAI Gateway turns across Code Mode and Tool Search, with web fetches, exact synthetic file reads, bounded Unicode output, four persisted-history checks and clean unforced shutdown. Independent audit accepted all fourteen stages, fifty memory observations and sixty saved command captures. One fixed run per revision showed post-idle RSS of 492.375 MiB (Code Mode) and 478.297 MiB (Tool Search), versus baseline 497.453125 and 481.53125 MiB. Main-isolate heap differed by only −107,976 and −264,016 bytes. Against the earlier twelve-change composite, Code Mode RSS rose 7.4375 MiB; sampled allocation results were mixed. These observations describe the composition and do not establish per-PR or consistent overall memory savings. The individual owner proofs above carry the effect claim. Exact-head required CI remains a landing gate.