Skip to content

run: question tool schema is sent to the model although the session denies it #147

Closed

Description

@byapparov

Context

run denies the question, plan_enter and plan_exit tools through session permission rules (cli/cmd/run.ts:443-459, passed to session.create). But the tool list sent to the model is filtered only by the agent's permission:

  • session/llm.ts:258-266 resolveTools: PermissionNext.disabled(tools, input.agent.permission)
  • The build agent explicitly allows question and plan_enter (agent/agent.ts:88-95).
  • QuestionTool is registered because AICTRL_CLIENT defaults to "cli" (flag/flag.ts, tool/registry.ts:117).
  • The session ruleset is only checked when a tool is executed (session/prompt.ts:803).

Problem

Proposal

Choose one:

  1. Merge the session ruleset into the disabled() computation in llm.ts (PermissionNext.merge(agent.permission, session.permission)), so that tools denied with * are removed from the request. This is the general fix, and it also covers other session-level denies.
  2. Also set AICTRL_CLIENT=headless in run, so QuestionTool is never registered.

Acceptance

  • The request tools in a headless run don't include question, plan_enter or plan_exit (asserted on the request built in llm.test.ts).
  • Interactive and attach behaviour is unchanged.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions