#21280: fix(exec): reflect configured exec host in tool schema default (#11150)
agents
size: S
Fixes openclaw/openclaw#11150.
When ools.exec.host is configured (e.g. "gateway"), parameter-filling models often send host: "sandbox" because the exec tool schema default was static. This causes avoidable failed tool calls.
Changes:
- Make exec schema default host dynamic and derived from effective config.
- Add regression test for schema defaults.
- Document tools.exec host/security/ask defaults in schema help.
AI-assisted: yes.
Testing:
- pnpm check
- pnpm vitest run src/agents/bash-tools.exec.schema.test.ts
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Fixed parameter-filling models sending disallowed `host` values by making the exec tool schema default dynamic based on effective configuration. When `tools.exec.host` is configured (e.g., "gateway"), the schema now reflects this as the default instead of hardcoding "sandbox", preventing unnecessary failed tool calls.
**Changes:**
- Converted static `execSchema` to `createExecSchema()` function that accepts `defaultHost` parameter
- Updated `createExecTool` to pass configured host value to schema generator
- Maintained backward compatibility by exporting default `execSchema` instance
- Added regression tests verifying schema defaults match configuration
- Documented `tools.exec.host`, `tools.exec.security`, and `tools.exec.ask` defaults in schema help
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk
- The implementation is straightforward, well-tested, and maintains backward compatibility. The change only affects the tool schema default value shown to models, making it align with the actual configuration. The old `execSchema` export is preserved, tests cover both configured and unconfigured cases, and the documentation accurately describes the new behavior.
- No files require special attention
<sub>Last reviewed commit: 1c9a4c9</sub>
<!-- greptile_other_comments_section -->
<sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#11185: fix #11150 - [Bug]: Exec tool schema host default ignores tools.exe...
by Lucky-Lodhi2004 · 2026-02-07
87.0%
#21509: fix: show requestedHost instead of configuredHost in exec host erro...
by sleitor · 2026-02-20
80.7%
#21820: fix(exec): show requested host in disallowed host hint
by AlexAnys · 2026-02-20
80.1%
#21562: fix: exec host error message shows configuredHost instead of reques...
by TopangaLudwitt · 2026-02-20
80.1%
#15983: feat(exec): support env field in tools.exec config
by Imccccc · 2026-02-14
77.4%
#11854: fix: resolve per-agent tools.exec config in pi-tools
by Yida-Dev · 2026-02-08
77.4%
#4897: fix: config logic issues (#4689, #4654)
by lailoo · 2026-01-30
76.3%
#9200: Fix: Strip dangerous env vars from baseEnv in host execution
by vishaltandale00 · 2026-02-05
75.4%
#11300: feat(exec): make shell configurable via tools.exec.shell
by imjszhang · 2026-02-07
75.2%
#4767: fix(agents): handle read alias required schema
by RomeroYang · 2026-01-30
75.0%