Repository navigation
Centralize coarse DIFC denial construction - #16755
Conversation
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
🟡 Changes recommended
The assert.EqualError at internal/guard/pipeline_test.go:338 is followed by more statements, violating the enabled testifylint require-error check and causing lint to fail.
1 open issue
What changed in this PR
Centralizes coarse DIFC denial construction in the guard package, addressing #16692 and reducing duplication between tool and prompt handlers.
Changes:
- Adds
guard.CoarseDenialError, reusing canonical error formatting. - Updates both server handlers while preserving audit logging and caller-specific responses; leaves the proxy unchanged.
- Adds regression coverage for denial fields and formatted errors.
| File | Description |
|---|---|
internal/server/prompt_call.go |
Uses the shared helper for coarse prompt denials. |
internal/server/backend_call.go |
Uses the shared helper while preserving tool error responses. |
internal/guard/pipeline.go |
Adds the shared denial-construction helper. |
internal/guard/pipeline_test.go |
Tests field preservation and canonical error formatting. |
Review effort: Max (adaptive)
|
@copilot address review feedback and fix failing ci lint check |
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Updated to |
🔒 mcpg Read-Only Stress — defaultSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: INCONCLUSIVE No write leaked on any surface. Part B gap: all 6 write-tool targets (star_repository, issue_write, add_issue_comment, create_branch, create_or_update_file, create_pull_request) were absent from the exposed 23-tool catalog, which confirms backend
|

Tool and prompt handlers duplicated coarse DIFC denial construction and formatting, risking drift from the canonical guard path.
guard.CoarseDenialError(pre)to construct the denial and reuseHandlePrePhaseErrorfor formatting.