pdp: send invocation_id so the platform verdict attributes to the turn - #409
Conversation
initializ-mk
left a comment
There was a problem hiding this comment.
Review — send invocation_id so the platform verdict attributes to the turn
Correct, minimal, test-backed. CI all green (Build ×6, Integration, Lint, Test).
- Same-source attribution verified. The new
InvocationID: hctx.CorrelationIDin the decide request is the identical sourceemitPDPDecisionuses for the agent-sidepdp_decisionevent (CorrelationID: hctx.CorrelationID), so the platformtool_call_decidedand this agent's record carry the sameinvocation_idand group in the console timeline — fixing the "unattributed events" bucket. - No enforcement change. Purely additive to the request body; the fail-closed logic, deny/defer paths, and single-retry from #399/#401 are untouched. Wire field is
invocation_id,omitempty(matches security-next#30), and the test now assertsinvocation_id=corr-1+session=task-1.
Non-blocking note: the go.work.sum additions are unrelated to the 2-line resolver change — all 18 are /go.mod checksum lines (no h1: content hashes), i.e. plain go work sync housekeeping that doesn't select or change any module version. Harmless, just noise here; ideally it'd be a separate housekeeping commit (or a line in the PR body noting it's sync output) so it doesn't read as a dependency change.
LGTM from my side.
| // Same source as the sibling pdp_decision event (emitPDPDecision uses | ||
| // hctx.CorrelationID) so the platform tool_call_decided and this agent's | ||
| // pdp_decision carry an IDENTICAL invocation_id and group together. | ||
| InvocationID: hctx.CorrelationID, |
There was a problem hiding this comment.
Verified this is the same source emitPDPDecision stamps on the agent-side pdp_decision (CorrelationID: hctx.CorrelationID), so the platform verdict and the agent record share an identical invocation_id and group together — exactly the attribution fix intended. No change to the fail-closed enforcement path. 👍
The PDP resolver didn't send the turn's correlation id, so the platform-written tool_call_decided event (security-next) had no invocation_id and the console's invocation timeline dropped it into "unattributed events" — while this agent's own pdp_decision for the same call was attributed. Send InvocationID = hctx.CorrelationID (the SAME source emitPDPDecision uses for the pdp_decision event), so the platform verdict and the agent-side record carry an identical invocation_id and group together. Test: assert the decide request carries invocation_id + session.
c4efe72 to
352d21f
Compare
|
Dropped the unrelated |
initializ-mk
left a comment
There was a problem hiding this comment.
Re-review — amended to 352d21f. The go.work.sum note is addressed; CI all green (Build ×6, Integration, Lint, Test).
The unrelated go work sync churn is dropped — the PR is now exactly the two files that matter (pdp_resolver.go + pdp_resolver_test.go), and the workspace-level Build across all six platforms stays green, confirming those checksum lines weren't needed.
The core attribution fix is unchanged and intact: InvocationID: hctx.CorrelationID on the decide request (same source as emitPDPDecision's pdp_decision), wire field invocation_id,omitempty, with the test asserting invocation_id=corr-1 + session=task-1.
LGTM — good to merge from my side.
Issue 2 of 2 (forge half)
The platform-written
tool_call_decidedevent (security-next) landed in the console's "unattributed events" bucket, because it had noinvocation_id— while this agent's ownpdp_decisionfor the same call was attributed.Root cause: the PDP resolver's decide request didn't carry the turn's correlation id, so security-next had nothing to stamp.
Fix
Send
InvocationID = hctx.CorrelationIDin the decide request — the same sourceemitPDPDecisionuses for the agent-sidepdp_decisionevent — so the platform verdict and the agent-side record carry an identicalinvocation_idand group together in the console's invocation timeline.Pairs with
PDPDecideRequest.invocation_id+writePDPAuditstamps it on the event.Test
TestPDPResolver_Allownow asserts the decide request carriesinvocation_id(corr-1, the hook correlation id) +session(task-1).go build/vet/runtimetests green.