Repository navigation
perf(agents): prepare exact tool names once per catalog batch - #139267
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 5, 2026, 2:17 PM ET / 18:17 UTC. ClawSweeper reviewWhat this changesPrepare normalized execution allowlists once per tool-catalog batch, reducing repeated name matching while preserving tool availability. Merge readiness✅ Ready for maintainer review No blocking findings. This remains a useful, bounded optimization absent from the inspected main revision; the patch preserves exact-name matching and execution-check lifetimes. Priority: P3 Review scores
Verification
How this fits togetherThe agent tool catalog determines which tool descriptions and dependent capabilities reach the model. It combines tool definitions with execution restrictions before handing callable tools to the runtime. flowchart TD
A[Tool definitions] --> C[Catalog preparation]
B[Execution allowlist] --> D[Normalize exact names once]
D --> C
C --> E[Callable tools and descriptions]
E --> F[Agent runtime]
B --> G[Current execution checks]
F --> G
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +12, Tests +89. Total +101 across 4 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep exact-name preparation batch-local while preserving live execution checks and shared alias normalization. Do we have a high-confidence way to reproduce the issue? Not applicable as a bug reproduction: this is a behavior-preserving optimization, and source confirms repeated normalization in the existing batch paths. Is this the best way to solve the issue? Yes. The shared exact-name matcher fits the two synchronous consumers; reusing glob/group matchers would change semantics, while retaining a cache would conflict with mutable execution caps. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 717f824924fe. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
* commit '911d7d5b0c107f7274f2415ca9655dcc6105f0e8': (867 commits) fix(skills): deliver pending Workshop approval controls (#139248) fix(gateway): deliver loopback ask_user prompts to the originating channel (#138831) docs: keep root agent instructions focused on repository policy (#139258) fix(matrix): exclude archived state roots from scans and selection (#112329) perf(agents): prepare exact tool names once per catalog batch (#139267) fix: preserve Swarm progress and simplify owner plumbing (#139269) fix(tailscale): release claims after gateway process-group exit (#139261) refactor(cli): simplify lazy command registration (#139108) test(ui): retain synthetic widget failure evidence (#139229) fix(buzz): keep implicit replies at thread root (#138879) test(diagnostics): await graceful Gateway shutdown before cleanup (#139247) fix(ci): unblock releases with different tooling package managers (#139259) feat(ui): add social preview links for private sessions (#139250) fix(codex): retain failed conversations for guarded continuation (#139246) chore(ui): refresh control ui locales (#139200) fix(ci): run browser checks for real-gateway inputs (#139256) fix(llama-cpp): reconcile managed router state before requests (#136363) chore(i18n): refresh native locales (#139237) refactor(worker): unify inference payload handling (#139245) refactor(terminal): replay wrapped prefixes in one pass (#139240) ...
What Problem This Solves
Preparing a prompt tool catalog repeatedly normalizes the same execution allowlist for every tool. Larger populated allowlists pay that repeated work in both catalog gating and callable-tool preparation.
Why This Change Was Made
Prepare exact normalized names once per synchronous batch and share that matcher through the existing owner. The matcher does not escape those synchronous operations. Later execution checks keep reading the current allowlist; no persistent cache or authority rule changes.
This also removes the intermediate callable-map tuple allocation while retaining the existing filter-before-prepare ordering. Production: +25/−13 (+12); tests: +89. The growth separates synchronous prepared facts from live execution checks, rather than making a retained cache serve both lifetimes.
User Impact
No intended change to available tools, aliases, literal wildcard/group names, denied-tool metadata, winner order, or mutable-cap behavior. Populated synthetic prompt-policy workloads improve in both measurement orders. This does not establish an end-to-end Gateway or cold-start speedup.
Evidence
426ca0d50f303c7cbec46741be7ff51e99145a18: the same eight complete files pass all 162 current cases, and the full normal changed-file gate passes. Main changed four skill-policy case names/assertions since the historical pair; those inventories are not claimed identical. The newer refusal wording is preserved.8797856260efeb94b71d88029850409416d7f74c; the operation is preserved in the current composition, but the old timings were not relabeled as a current-base cohort. Original lint failures and their corrections are retained.Focused verification:
The focused checks exercise the actual policy/catalog owner boundaries. No built CLI, live provider turn, or before/after Gateway timing was run with this patch; campaign live observations from another candidate are not reused as its proof. This bounded behavior-neutral refactor uses focused checks proportional to its unchanged contract.