Skip to content

fix(agents): keep empty tool allowlists allow-all when merging alsoAllow - #8

Merged
tomorrowflow merged 1 commit into
mainfrom
worktree-fix-tool-search-core-tools
Sep 29, 2026
Merged

tomorrowflow merged 1 commit into
mainfrom
worktree-fix-tool-search-core-tools

Conversation

@tomorrowflow

Copy link
Copy Markdown
Owner

Problem

Since 2026.9.7, every embedded-harness run (all Ollama models: heartbeats, cron jobs, dashboard chats) starts with only tool_search, tool_describe, and tool_call, and the catalog holds only MCP tools. Core tools (read, write, edit, exec, heartbeat_respond, …) are gone, so heartbeats cannot update memory/heartbeat-state.json and report "no file-write tool".

Live evidence: heartbeats on 2026.9.6 (0db687d) had 138–142 tools and called read/write/edit/ls; from the first 2026.9.7 (0e091da) run on 2026-09-25 17:18 Berlin every run has toolCount: 3, and tool_search for "read file" returns only MCP candidates.

Root cause

mergeAlsoAllowPolicy appended names to an empty allow list. An empty allow list means "allow everything not denied", so appending made it an allowlist of only the appended names. Default-on Tool Search (openclaw#154068) appends its three controls to every policy layer; with the live config's tools.allow: [] the global policy became allow: [tool_search, tool_describe, tool_call].

Fix

Leave an empty allow list untouched in mergeAlsoAllowPolicy; it already covers the extra names. Registered in docs/fork-features.txt so the sync keeps it until upstream ships an equivalent guard (no upstream fix or issue exists as of 0c6971d5e05).

Evidence

  • Regression keeps core tools when Tool Search controls join an empty allow-all list fails before the fix (read missing) and passes after. Cost: single test, file run ~19s wall (vitest run <file> -t), mostly transform.
  • Neighbouring suites pass: agent-tools.create-openclaw-coding-tools, tool-policy, agent-tools.policy, tool-search, harness/tool-surface-bridge (285 tests) and the other mergeAlsoAllowPolicy callers' suites (212 tests).
  • pnpm tsgo:core clean, check-fork-features 81 present.
  • Tooling note: scripts/run-vitest.mjs cannot build its worker in this fork because vitest-worker-build-entries.mts lists .github/workflows/plugin-npm-release.yml, which the fork removed; tests ran via pnpm exec vitest run.

🤖 Generated with Claude Code

mergeAlsoAllowPolicy appended names to an empty allow list, turning
"allow everything not denied" into an allowlist of only the appended
names. Default-on Tool Search (2026.9.7) appends its three control tools
to every policy layer, so a config with `tools.allow: []` left embedded
runs (all Ollama models, including heartbeats and cron jobs) with only
tool_search/tool_describe/tool_call and a catalog of MCP tools: no
read, write, exec, or any other core tool.

Leave an empty allow list untouched; it already covers the extra names.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@tomorrowflow

Copy link
Copy Markdown
Owner Author

Independent review: ship. All ~25 mergeAlsoAllowPolicy callers checked; none treats allow: [] as deny-all (profiles are non-empty or ["*"], config layers already treat [] as allow-all via tool-policy-match.ts / sandbox-tool-policy.ts, inherited policies drop empty allow, runtime [] deny-all never flows through this helper). Regression fails with the old helper swapped in (read missing, merge logged {allow:[],deny:["tts"]} + the three controls) and passes on the fix. Follow-up (pre-existing, not triggered here): resolveSubagentToolPolicyForSession (src/agents/agent-tools.policy.ts:117) has the same append-to-empty pattern for tools.subagents.tools.alsoAllow.

@tomorrowflow
tomorrowflow merged this pull request into main Sep 29, 2026
@tomorrowflow
tomorrowflow deleted the worktree-fix-tool-search-core-tools branch September 29, 2026 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant