Repository navigation
fix(tool-search): add alwaysVisibleTools config to bypass catalog compaction - #118335
xiaoping1988 wants to merge 6 commits into
Conversation
…paction Add tools.toolSearch.alwaysVisibleTools config option to allow operators to keep frequently-used tools directly visible without requiring search. Changes: - src/config/types.tools.ts: Add alwaysVisibleTools field to ToolSearchConfig type - src/config/zod-schema.agent-runtime.ts: Add alwaysVisibleTools to ToolSearchSchema - src/config/schema.help.runtime.ts: Add help text for alwaysVisibleTools - src/config/schema.labels.ts: Add label for alwaysVisibleTools - src/config/schema.test.ts: Add test case for alwaysVisibleTools parsing - src/agents/tool-search-config.ts: Parse alwaysVisibleTools with normalizeTrimmedStringList and normalize tool names using normalizeToolName - src/agents/tool-search-types.ts: Add alwaysVisibleTools Set<string> to ToolSearchConfig - src/agents/tool-search-catalog.ts: Filter alwaysVisibleTools in applyToolCatalogCompaction - src/agents/code-mode.ts: Pass config parameter to applyToolCatalogCompaction - src/agents/code-mode-runtime.ts: Initialize alwaysVisibleTools as empty Set in toToolSearchConfig - src/agents/tool-search-directory.ts: Pass config parameter to applyToolCatalogCompaction - src/agents/tool-search-ranking.test.ts: Initialize alwaysVisibleTools as empty Set in test fixtures
|
Codex review: needs real behavior proof before merge. Reviewed August 4, 2026, 9:17 PM ET / August 5, 2026, 01:17 UTC. ClawSweeper reviewWhat this changesThe PR adds Merge readiness⛔ Blocked until real behavior proof is added - 14 items remain Keep open for maintainer product direction, but this exact head is incorrect: it can bypass Code Mode’s direct-tool boundary and the existing MCP lookalike trust gate. It also lacks public documentation and after-fix runtime proof. Priority: P2 Review scores
Verification
How this fits togetherTool Search compacts an agent’s tool catalog into a small direct surface plus deferred search. Generic Code Mode reuses the catalog machinery but owns a stricter direct-tool boundary for model safety. flowchart LR
A[Operator configuration] --> B[Tool surface planner]
B --> C{Code Mode active?}
C -->|Yes| D[Code Mode catalog]
C -->|No| E[Generic Tool Search]
E --> F[Visible tools and catalog]
D --> F
Decision needed
Why: This is a new core configuration contract rather than a repair of established behavior, and the repository policy sets a high bar for new config surfaces. Before merge
Findings
Agent review detailsSecurityNeeds attention: The direct-visibility branch bypasses established Code Mode and trusted-source tool-surface boundaries. PR surfaceSource +36, Tests +90. Total +126 across 13 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the existing default direct coding tools; only add a generic override if maintainers sponsor it, with caller-owned generic-surface gating, trusted source qualification, collision rules, Code Mode exclusion, public documentation, and runtime proof. Do we have a high-confidence way to reproduce the issue? Yes, from source: enable Code Mode with Tool Search mode set to Is this the best way to solve the issue? No: current generic Tool Search already exposes the stated core coding tools directly, while the proposed common helper bypasses Code Mode and trusted-source ownership boundaries. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against ed31a4dd79bf. LabelsLabel justifications:
EvidenceSecurity concerns:
What I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
…l surface
Code Mode has a strict trusted direct-tool boundary: only explicitly
required tools may remain directly visible to the model. The new
alwaysVisibleTools config was incorrectly promoting configured normal
tools onto Code Mode's direct model surface, bypassing that boundary.
Fix: skip alwaysVisibleTools filtering in Code Mode (mode='code').
The generic Tool Search modes ('tools' and 'directory') still honor
alwaysVisibleTools as intended.
Added regression test verifying:
- Code Mode ignores alwaysVisibleTools and catalogs those tools
- Non-Code Mode respects alwaysVisibleTools and keeps them direct
…cope The regression test for alwaysVisibleTools + Code Mode had two issues: 1. Used incorrect tool names (code_mode_exec/code_mode_wait) instead of the actual Code Mode control tool names. Fixed by using explicit isVisibleControlTool predicate and testing with fake tool names that don't conflict with real Code Mode tools. 2. Manually assigned catalogRef.current without the required counterScope field. Fixed by using a fresh catalogRef for the tools mode test, letting applyToolSearchCatalog initialize it properly. The test now correctly verifies: - Code Mode ignores alwaysVisibleTools (all non-control tools are cataloged) - Tool Search mode respects alwaysVisibleTools (configured tools stay direct)
… use applyToolCatalogCompaction 1. Removed unused OpenClawConfig import from tool-search-catalog.ts (it was only used indirectly through resolveToolSearchConfig) 2. Fixed the regression test to directly call applyToolCatalogCompaction instead of applyToolSearchCatalog, because the Code Mode simulation requires passing isVisibleControlTool which is internal to the generic compaction function. The test now correctly verifies that alwaysVisibleTools is ignored in Code Mode (mode='code'), keeping only control tools direct while cataloging all other tools including those in alwaysVisibleTools.
What Problem This Solves
Fixes an issue where operators cannot configure frequently-used tools to remain directly visible in the tool palette. When using Tool Search catalog compaction, all tools except control tools get hidden behind search, requiring extra steps to access common tools like read_file, write_file, or edit.
Why This Change Was Made
Adds a new tools.toolSearch.alwaysVisibleTools config option that accepts an array of tool names. These tools bypass the catalog compaction and remain visible alongside control tools. The solution normalizes tool names (handling case variations) and filters them during catalog application, keeping the most-used tools one-click accessible without breaking the compact catalog design.
User Impact
Operators can now configure their most-used tools to stay directly visible in the tool palette while still benefiting from catalog compaction for the remaining tools. For example, adding ["read", "write", "edit"] to alwaysVisibleTools keeps these core editing tools always accessible, reducing friction in daily workflows.
Configuration example:
{
"tools": {
"toolSearch": {
"enabled": true,
"mode": "tools",
"alwaysVisibleTools": ["read", "write", "edit", "exec"]
}
}
}
Evidence
TypeScript type definitions updated in src/config/types.tools.ts and src/agents/tool-search-types.ts
Zod schema validation added in src/config/zod-schema.agent-runtime.ts with test coverage in src/config/schema.test.ts
Runtime parsing implemented in src/agents/tool-search-config.ts using normalizeTrimmedStringList and normalizeToolName
Catalog compaction logic updated in src/agents/tool-search-catalog.ts to filter always-visible tools
Integration points covered in src/agents/code-mode.ts, src/agents/code-mode-runtime.ts, and src/agents/tool-search-directory.ts
Help text and labels added in src/config/schema.help.runtime.ts and src/config/schema.labels.ts