Skip to content

feat(workflow): formal test suite for intent-attribution-agent-governance spec (P1–P11 + safety invariant) - #49171

Closed
pelikhan with Copilot wants to merge 2 commits into
mainfrom
copilot/formal-spec-intent-attribution-agent-governance
Closed

feat(workflow): formal test suite for intent-attribution-agent-governance spec (P1–P11 + safety invariant)#49171
pelikhan with Copilot wants to merge 2 commits into
mainfrom
copilot/formal-spec-intent-attribution-agent-governance

Conversation

Copilot AI commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Formalizes specs/intent-attribution-agent-governance.md as an executable Go test suite, encoding 11 core predicates and a cross-cutting safety invariant. Since the real attribution resolver doesn't exist yet (Phase 2+), the file ships self-contained stubs that directly encode the spec semantics and are marked for replacement.

New file: pkg/workflow/intent_attribution_governance_formal_test.go

Stub types (replace with real impl when Phase 2+ lands):

  • pullRequestData — resolver inputs (explicit intent, closing issues, labels)
  • formalIntentRecord — normalized output with Status, Source, Key, Risk, Priority, Domains
  • formalExecutionPolicy — governance output with autonomy, write scope, approval/merge/attempt constraints

Stub functions encoding the spec directly:

  • formalResolve — attribution-resolution order: explicit metadata → single closing issue → multi-issue ambiguous → label fallback → unlinked
  • formalSafestPolicy — fail-closed floor: propose_only / none / human_approval_required: true / auto_merge_allowed: false / max_attempts: 1
  • formalDerivePolicy — indeterminate statuses (unlinked, ambiguous, suggested, unmapped) always return formalSafestPolicy()
  • formalResolveRisk — explicit risk wins; else derived from domain+priority (security+critical→high, production→high, infrastructure→medium, documentation→low, unknown→unknown)
  • formalPolicyPrecedenceLevelagent_request(0) < workflow(1) < intent(2) < repository(3) < organization(4)

Predicates tested:

Test Predicate
P1 Explicit intent overrides ambiguous closing-issue candidates
P2 Single closing issue → mapped / closing_issue
P3 2+ closing issues → ambiguous, order-independent (3 orderings)
P4 No closing issues + labels → artifact_label fallback
P5 No source at all → unlinked
P6 ambiguous ≠ mapped for authorization purposes
P7 Indeterminate statuses always yield safest policy (4 cases)
P8 Identical inputs always produce identical policy (determinism)
P9 Risk derivation order with explicit override and 6 domain cases
P10 Precedence ordering including non-adjacent org > agent_request check
P11 Unlinked/ambiguous attribution never grants elevated autonomy, auto-merge, or max-attempts > 1
SAFETY Ambiguous always fails closed unconditionally

…P1-P11 + safety invariant)

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Formalize model and test suite for intent attribution agent governance feat(workflow): formal test suite for intent-attribution-agent-governance spec (P1–P11 + safety invariant) Jul 30, 2026
Copilot AI requested a review from pelikhan July 30, 2026 16:35
@github-actions

Copy link
Copy Markdown
Contributor

Warning

threat detection engine error
The threat detection engine encountered an error and could not complete analysis. This is a tooling failure, not a security finding.

Details

The threat detection engine failed to produce results.

Review the workflow run logs for details.

✅ Contribution Aligned

Thanks for formalizing the intent-attribution governance spec into an executable test suite! This is exactly what Phase 1 needs — a crystal-clear set of predicates (P1–P11) plus the safety invariant encoding the spec semantics.

What looks great:

  • Comprehensive predicate coverage — all 11 core predicates plus the cross-cutting safety invariant are present and well-documented
  • Clear stub marking — stubs are explicitly marked for replacement in Phase 2+, making it easy for implementers to see what's placeholders and what's spec-defined behavior
  • Determinism and fail-closed guarantees — safety-critical checks like ambiguous attribution always yielding the safest policy are front and center
  • Well-organized test table — predicates are easy to scan and understand at a glance

The PR is focused, documented, and ready for merge. Looking forward to Phase 2+ when the real resolver ships and these stubs get replaced with live implementations! 🎯

Generated by ✅ Contribution Check · auto · 55.7 AIC · ⊞ 8.7K ·

@github-actions

Copy link
Copy Markdown
Contributor

PR Triage

Category: test - Risk: low - Score: 40/100

Impact Urgency Quality
16 8 16

Recommended action: batch_review (batch: spec-docs-20260730)

New self-contained Go test file (+476/-0) encoding governance spec predicates with explicit stub types marked for future replacement. No production code touched, draft, CI pending. Batch with #49177 and #49174 for combined review. Confirm stubs are clearly marked for Phase 2+ replacement before merge.

Generated by 🔧 PR Triage Agent · auto · 46.2 AIC · ⌖ 7.96 AIC · ⊞ 7.9K ·

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.

[formal-spec] intent-attribution-agent-governance.md — Formal model & test suite — 2026-07-30

2 participants