Skip to content

fix(agent): bash/python/web_search absent from tool schemas on low-signal turns when workspace is set and tools are enabled #47

Description

@jdmanring

Bug

When a workspace is active and Shell Access and/or Web Search are enabled, the agent reports no access to `bash`, `python`, or `web_search` for vague or short opening messages.

Root Cause

`agent_loop.py` has a fast path for low-signal turns when a workspace is active. It builds `_relevant_tools` from scratch:

```python
_relevant_tools = set(ALWAYS_AVAILABLE)
_relevant_tools |= (_DOMAIN_TOOL_MAP["files"] & PLAN_MODE_READONLY_TOOLS)
```

`PLAN_MODE_READONLY_TOOLS` includes `web_search` and `web_fetch` but not `bash` or `python`. `_DOMAIN_TOOL_MAP["files"]` includes `bash` and `python` but not `web_search` or `web_fetch`. The intersection excludes all three.

The fast path never consults `disabled_tools`. The Shell Access and Web Search toggles only prevent tools from entering `disabled_tools` — they do not add tools to `_relevant_tools`. Since the fast path builds `_relevant_tools` from scratch and then skips RAG retrieval (the set is already non-empty), the domain-based additions that would normally include `web_search` never run.

Fix

Consult `disabled_tools` in the workspace fast path to include tools the user explicitly enabled:

```python
if "bash" not in disabled_tools:
_relevant_tools.add("bash")
if "python" not in disabled_tools:
_relevant_tools.add("python")
if "web_search" not in disabled_tools:
_relevant_tools.add("web_search")
_relevant_tools.add("web_fetch")
```

Steps to Reproduce

  1. Set a workspace path in the UI.
  2. Enable Shell Access and/or Web Search.
  3. Send a short or vague message: "help me", "what do we have here", "let's get started".
  4. The agent responds that it has no access to `bash`, `python`, or `web_search`.

Notes

PR #4398 (merged 2026-06-16) fixed the structurally identical problem for scheduled task agents. This fix follows the same pattern.

Bash/python verified. Web search/web_fetch unverified — issue remains open until confirmed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions