fix(go-kernel): accept pre-normalized ActionContext in evaluate command#1000
Merged
fix(go-kernel): accept pre-normalized ActionContext in evaluate command#1000
Conversation
…nd (closes #957) The evaluate command previously only accepted raw Claude Code tool call format {"tool":"...","input":{...}}, causing it to return "default deny" for all actions when callers passed a pre-normalized ActionContext like {"action":"file.write","target":"foo.ts"}. Changes: - Extract parseActionInput() helper that detects input format by checking for an "action" field (ActionContext) vs "tool" field (raw tool call) - Pre-normalized ActionContext is passed directly to the evaluator - Raw tool call payloads are normalized first (existing behavior preserved) - Document the "pack:" limitation in the runEvaluate comment - Add 6 unit tests for parseActionInput covering both formats and pipeline This enables the normalize | evaluate pipeline: {tool,input} | agentguard normalize | agentguard evaluate --policy p.yaml Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Mar 26, 2026
Collaborator
Author
🟢 LOW — Audit ReceiptAudit: Merged PR Audit Report 2026-03-27 Risk Score: LOWAll CI checks passed. No protected file changes. No immediate action required. See consolidated audit issue: #1066 |
This was referenced Mar 27, 2026
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.
Closes #957
Implementation Summary
What changed:
parseActionInput()helper ingo/cmd/agentguard/main.gothat detects input format by checking for anactionfield (pre-normalizedActionContext) vstoolfield (raw Claude Code tool call)ActionContextpayloads (e.g.,{"action":"file.write","target":"foo.ts"}) are passed directly to the evaluator — no re-normalization{"tool":"Write","input":{...}}) continue to be normalized (existing behavior preserved)runEvaluatedocumenting both input formats and thepack:limitationgo/cmd/agentguard/main_test.gowith 6 unit tests covering both formats and thenormalize | evaluatepipelinego/test/smoke.shwith 2 new tests: pre-normalized format and the pipelineHow to verify:
Tier C scope check:
Tier C implementation by copilot-cli — AgentGuard three-tier governance