Skip to content

fix(permissions): hide denied tools from API schema#317

Open
panDing19 wants to merge 1 commit into
HKUDS:mainfrom
panDing19:fix-denied-tools-schema
Open

fix(permissions): hide denied tools from API schema#317
panDing19 wants to merge 1 commit into
HKUDS:mainfrom
panDing19:fix-denied-tools-schema

Conversation

@panDing19

@panDing19 panDing19 commented Jun 26, 2026

Copy link
Copy Markdown

Summary

  • Problem: permission.denied_tools only blocked tools at execution time. The query loop still sent every registered tool schema to the model, so denied tools stayed visible and the model could select tools that would immediately be rejected by PermissionChecker.

  • Change: ToolRegistry.to_api_schema() now accepts an optional denied_tools filter, PermissionChecker exposes its denied tool names as a read-only tuple, and run_query() applies that filter before sending tool schemas to the API. Execution-time permission checks remain unchanged as the enforcement backstop.

  • Added regression coverage for both the registry filter and the query engine request payload, and added an Unreleased changelog entry for the user-visible permissions behavior change.

Validation

  • uv run ruff check src tests scripts
  • uv run pytest -q1155 passed, 6 skipped when run with inherited ANTHROPIC_AUTH_TOKEN / ANTHROPIC_BASE_URL cleared so auth tests are not biased by the local Codex session environment.
  • cd frontend/terminal && npx tsc --noEmit — not applicable; no frontend files touched.

Notes

  • Related issue: N/A
  • Follow-up work: None.

@panDing19 panDing19 force-pushed the fix-denied-tools-schema branch from 7bc821f to d100174 Compare June 26, 2026 22:00
@panDing19 panDing19 changed the title fix: hide denied tools from API schema fix(permissions): hide denied tools from API schema Jun 26, 2026
@panDing19 panDing19 marked this pull request as ready for review June 26, 2026 22:00
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