Implement ResolveRisk and Authorizer.AuthorizeTool in pkg/intent - #53742
Merged
pelikhan merged 2 commits intoAug 18, 2026
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update formal model and test suite for intent attribution governance
Implement ResolveRisk and Authorizer.AuthorizeTool in pkg/intent
Aug 18, 2026
pelikhan
marked this pull request as ready for review
August 18, 2026 16:36
pelikhan
deleted the
copilot/formal-spec-intent-attribution-agent-governance
branch
August 18, 2026 16:36
Contributor
There was a problem hiding this comment.
Pull request overview
Implements intent risk classification and tool authorization APIs, with formal tests and documentation updates.
Changes:
- Adds risk metadata and deterministic
ResolveRisk. - Adds deny/allow-list enforcement via
Authorizer. - Adds formal coverage and API documentation.
Show a summary per file
| File | Description |
|---|---|
pkg/intent/governance.go |
Implements risk resolution and authorization. |
pkg/intent/governance_formal_test.go |
Tests governance invariants and edge cases. |
pkg/intent/resolver.go |
Adds classification fields to intent records. |
pkg/intent/README.md |
Documents the new APIs. |
specs/intent-attribution-agent-governance.md |
Updates implementation status. |
Review details
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 5/5 changed files
- Comments generated: 2
- Review effort level: Balanced
| if slices.Contains(policy.DeniedTools, tool) { | ||
| return ErrToolDenied | ||
| } | ||
| if policy.AllowedTools != nil && !slices.Contains(policy.AllowedTools, tool) { |
| ### `Authorizer.AuthorizeTool` Implementation Audit | ||
|
|
||
| The `AuthorizeTool` function as specified in this section is **not yet implemented** in the Go orchestrator. The following table documents which fields of `ExecutionPolicy` are wired to runtime enforcement and which remain unused. | ||
| `Authorizer.AuthorizeTool` and `ResolveRisk` are implemented in `pkg/intent` (see `pkg/intent/governance.go`), but neither is yet called by the Go orchestrator. The following table documents which fields of `ExecutionPolicy` are wired to runtime enforcement and which remain unused. |
Contributor
|
🎉 This pull request is included in a new release. Release: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
specs/intent-attribution-agent-governance.mdspecifies aResolveRiskrisk-classification function and anAuthorizer.AuthorizeToolenforcement point, but neither existed inpkg/intent—PolicyCompiler.Compileremained purely advisory with no tool-level gate.Risk classification
Domains []string,Priority string,Risk stringfields toIntentRecord(kept separate fromLabels, whichPolicyConditionstill matches against).ResolveRisk(rec IntentRecord) stringin newpkg/intent/governance.go: explicitRiskalways wins; otherwise derives from domains/priority (security+criticalorproduction→high,infrastructure→medium,documentation→low, elseunknown).Tool authorization
Authorizerstruct withAuthorizeTool(policy ExecutionPolicy, tool string) error:DeniedToolsalways wins, even if the tool also appears inAllowedTools(ErrToolDenied).nilAllowedToolsmeans unrestricted; a non-nil, emptyAllowedToolsdenies every tool — this nil-vs-empty distinction had to be preserved rather than a naiveslices.Containscheck (ErrToolNotAllowed).Tests & docs
pkg/intent/governance_formal_test.gocovering the full behavioral coverage map from the issue (explicit-override precedence, each risk tier, deny/allow-list semantics, fail-closed compilation forunlinked/ambiguous, and edge cases for empty/nil inputs).pkg/intent/README.mdwith the new public API and clarifiedPolicyConditionmatchesIntentRecord.Labels, not the new dedicated fields.Authorizer.AuthorizeToolImplementation Audit to reflect the implementation status; wiring it into the orchestrator's execution path remains a follow-up, as noted in the spec itself.