Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

Summary

Fixed a bug where agents using base inheritance (like ask which extends exec) had no tools available despite claiming tools in the UI.

Root Cause

resolveToolPolicyForAgent only looked at the current agent's frontmatter.tools.add patterns, ignoring the base inheritance chain.

For example, the ask agent has:

base: exec
tools:
  remove:
    - file_edit_.*

It has no add patterns - it relies on inheriting add: [.*] from exec. The old code only saw an empty add list, so it created a policy that denied all tools.

Fix

Modified resolveToolPolicyForAgent to:

  1. Accept the full list of agents (including built-ins)
  2. Walk the inheritance chain using collectToolConfigs() (base first, then child)
  3. Apply each layer's add/remove patterns in order

Now for ask (base: exec):

  • Start with deny-all baseline
  • Process exec: enable .*, disable propose_plan, disable ask_user_question
  • Process ask: disable file_edit_.*

Result: All tools enabled except propose_plan, ask_user_question, and file_edit_.* - exactly as intended.

Testing

  • Updated existing tests to use new interface
  • Added tests for single-level and multi-level inheritance
  • All tests pass

Generated with mux • Model: anthropic:claude-opus-4-5 • Thinking: high

resolveToolPolicyForAgent was only looking at the current agent's
frontmatter.tools.add patterns, ignoring the base inheritance chain.

For example, ask (base: exec) has no add patterns - it relies on
inheriting add: [.*] from exec. The old code saw an empty add list
and created a policy denying all tools.

Now the function:
1. Accepts the full list of agents (including built-ins)
2. Walks the inheritance chain (base first, then child)
3. Applies each layer's add/remove patterns in order

This matches the existing agentHasTool() logic in agentInheritance.ts.
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

{
id: effectiveAgentId,
base: agentDefinition.frontmatter.base,
tools: agentDefinition.frontmatter.tools,
},

P1 Badge Include full agent list when resolving tool inheritance

resolveToolPolicyForAgent now walks the provided agents list to apply inherited add/remove rules, but allAgents is built from the built-ins and just the requested agent. Any agent that inherits from another workspace-defined agent (non built-in) will still resolve with a deny-all policy because its base is absent from this list, so the base tools.add patterns are never applied. Agents that rely on custom base definitions therefore continue to lose their tools.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@ammario ammario merged commit 634ca8b into main Dec 31, 2025
20 checks passed
@ammario ammario deleted the agent-tools-pe9t branch December 31, 2025 22:24
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.

2 participants