Skip to content

[log] Add debug logging to IsSingularReadTool in tool_policy.go - #10692

Open
github-actions[bot] wants to merge 1 commit into
mainfrom
log-enhance-tool-policy-bbf8772d8f00d2ed
Open

[log] Add debug logging to IsSingularReadTool in tool_policy.go#10692
github-actions[bot] wants to merge 1 commit into
mainfrom
log-enhance-tool-policy-bbf8772d8f00d2ed

Conversation

@github-actions

@github-actions github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds debug logging to internal/server/tool_policy.go, following the project's logging guidelines from AGENTS.md.

Changes

  • Added a new logToolPolicy logger (server:tool_policy namespace via logger.ForFile()).
  • Added a debug log call in IsSingularReadTool reporting the tool name and the collection/singular classification decision, guarded by logToolPolicy.Enabled() to avoid unnecessary computation when debug logging is disabled.

This file previously had no logger and no debug visibility into how the DIFC filtering layer classifies GitHub MCP tool calls as singular-read vs. collection tools — a decision that directly affects response filtering behavior.

Validation

  • go build ./... — succeeds
  • go vet ./internal/server/... — clean
  • go test ./internal/server/... — all tests pass
  • Built the awmg binary successfully with the change included

Only this one file was modified; no test files or unrelated code were touched.

Generated by Go Logger Enhancement · auto · 103.9 AIC · ⊞ 12.4K ·

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added automation enhancement New feature or request labels Aug 4, 2026
@lpcox
lpcox marked this pull request as ready for review August 5, 2026 14:38
Copilot AI balanced review requested due to automatic review settings August 5, 2026 14:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds debug visibility into singular-versus-collection tool classification.

Changes:

  • Adds a file-derived server:tool_policy logger.
  • Logs classification decisions when debug logging is enabled.
Show a summary per file
File Description
internal/server/tool_policy.go Adds guarded debug logging without changing classification behavior.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Balanced

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

🔒 mcpg Read-Only Stress — default AWF

Surface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Isolation runtime: default AWF (normal container isolation)

Gateway tool inventory: 22 read-only tools exposed; all write tools absent at gateway level.

Part Surface Op Result Expected Status
A MCP reads (list_issues, list_pull_requests, get_file_contents, list_commits) data returned ALLOWED
B MCP writes (reaction/star/issue/comment/branch/file/PR) Error [-32602]: unknown tool BLOCKED
C CLI reads (list_issues, get_file_contents) data returned ALLOWED
D CLI REST writes (reaction/star/issue/comment/file) gh: no GH_TOKEN set BLOCKED
E CLI GraphQL mutations (addReaction/addStar/createIssue) gh: no GH_TOKEN set BLOCKED

Overall: PASS

Note on Part B enforcement: The gateway exposes only 22 read-only tools. Write tool calls return Error [-32602]: unknown tool — gateway-level enforcement (filtered tool registry), not merely backend config.

Note on Parts D/E: gh CLI is unauthenticated (no GH_TOKEN). The security boundary is: mcpg (read-only MCP) + unauthenticated gh.

References: §30961042701

🔒 mcpg read-only stress (default AWF runtime) by Read-Only Stress: default runtime

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

🔒 mcpg Read-Only Stress — docker-sbx

Surface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Isolation runtime: docker-sbx (KVM-isolated microVM)

Part Surface Op Result Expected Status
A MCP reads (issues/PRs/file/commits) data returned ALLOWED
B MCP writes (reaction/star/issue/comment/branch/file/PR) Error[-32602] unknown tool BLOCKED
C CLI reads (list issues via github CLI) data returned ALLOWED
D CLI REST writes (reaction/star/issue/comment/file) refused (no GH_TOKEN) BLOCKED
E CLI GraphQL mutations (addReaction/addStar/createIssue) refused (no GH_TOKEN) BLOCKED

Overall: PASS

Part B refusals are gateway-enforced (write tools absent from MCP tool list, Error[-32602]). Parts D/E blocked by unauthenticated gh CLI.

References: §30961042703

🔒 mcpg read-only stress (docker-sbx runtime) by Read-Only Stress: docker-sbx runtime

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant