perf: carry callable presence through the tool run plan - #138024
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed September 4, 2026, 4:57 AM ET / 08:57 UTC. ClawSweeper reviewWhat this changesThe agent’s tool plan replaces temporary callable-name lists with a boolean, reducing transient work while preserving tool selection and empty-allowlist errors. Merge readiness✅ Ready for maintainer review No blocking findings. This remains useful cleanup: current main and the latest release retain the redundant list construction, and the inspected change preserves the existing guard decisions. Priority: P3 Review scores
Verification
How this fits togetherThe embedded agent runner prepares available tools and operator allowlists before submitting a model turn. Its tool plan supports direct tools, Tool Search, and OpenClaw Code Mode, while an empty-allowlist guard reports unusable tool selections. flowchart TD
A[Available tools and catalog] --> C[Build tool run plan]
B[Explicit allowlists] --> C
C --> D{Callable tools remain?}
D -->|Yes| E[Continue model turn]
D -->|No| F[Apply existing empty-allowlist error policy]
A -->|Catalog refresh| C
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -5, Tests 0. Total -5 across 6 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep the presence decision in the existing run-plan owner, with catalog refresh maintaining it and existing tool-selection and error policies preserved. Do we have a high-confidence way to reproduce the issue? Not applicable as a bug reproduction: the redundant allocation is directly visible in current main, and this PR proposes a behavior-preserving optimization. Is this the best way to solve the issue? Yes. Computing existence in the existing planner removes unnecessary representation at its owner; caching the synthetic lists or reconstructing them in the guard would retain needless work. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against be967f4a514f. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
f02c9e1 to
d138a59
Compare
|
Merged via squash.
|
Additional instructions
Maintainers can edit this branch.
What Problem This Solves
Each attempt built synthetic names for every catalog entry only to answer whether any callable tool remained. The explicit-allowlist guard then normalized that discarded list again.
Why This Change Was Made
Record callable presence in the run-plan owner and refresh it with the catalog. This removes the synthetic catalog/client list, duplicate normalization and refresh splice. The visible, replay, live and capability name sets keep their existing policies and identities; the boolean is private to the empty-allowlist check.
User Impact
Tool selection and allowlist errors stay the same with less temporary catalog work. Production LOC is +25/−30 (net −5); tests are +18/−18 (net 0). No configuration or protocol change.
Evidence
A fixed 180-case comparison of the actual original and candidate owners preserves all 1,440 guard decisions, four name sets and alias identities. The owners produced 91,836 synthetic catalog names before and zero afterward. All 21 existing owner tests and the targeted integration caller pass. The complete changed gate and fresh isolated Codex P0–P2 review pass.
Single functional test-process observations were 19.28 → 23.13 seconds and 1,890,304,000 → 1,884,700,672 peak RSS bytes. They establish no speed or process-memory improvement. Initial worktree dependency setup failures were resolved with one consistent existing donor; logs remain in local evidence.
The separate 500-tool real Gateway comparison is complete. Both the original baseline and a composed candidate containing this change completed one real OpenAI turn in Code Mode and one in Tool Search: discover 500 plugin tools, select and describe the designated tool, invoke it once with the expected integer argument, and verify the exact result and nested call history. Both gateways shut down normally; recorded processes and listener ports were gone afterward.
This single sequential pair is behavior proof under catalog pressure, not a per-PR performance estimate. Main-isolate catalog allocation samples were 370,367,384 → 371,463,040 bytes in Code Mode and 356,922,288 → 354,779,456 bytes in Tool Search, effectively flat. After the fixed idle period and two requested main-isolate GCs, heap used fell by about 3.0 and 2.3 MiB respectively, while whole-Gateway RSS rose by about 4.7 and 1.3 MiB. Sampling includes collected objects and is not an exact retained-byte count; these mixed results do not establish a general memory or speed improvement.