Skip to content

feat: add DecisionAssure Impact – counterfactual governance impact analysis - #3883

Open
AkhileshWarik (a1k7) wants to merge 3 commits into
microsoft:mainfrom
a1k7:decisionassure-impact-v2
Open

feat: add DecisionAssure Impact – counterfactual governance impact analysis#3883
AkhileshWarik (a1k7) wants to merge 3 commits into
microsoft:mainfrom
a1k7:decisionassure-impact-v2

Conversation

@a1k7

Copy link
Copy Markdown

Problem & Solution

Problem:
AGT enforces policies at runtime, but there is no way to know what will break before you tighten a policy, expire a delegation, update a model, or expand a tool capability. Previously allowed actions may become inadmissible – but nobody knows which until after deployment.

Solution:
This PR introduces DecisionAssure Impact – a counterfactual governance replay engine that:

  • Ingests historical decision traces (JSONL from AGT audit logs).
  • Replays them against both the current and proposed governance states (policy, authority, capability, model).
  • Computes a governance diff showing exactly which decisions change from ADMISSIBLE to INADMISSIBLE (and vice versa).
  • Provides blast radius – affected agents, tools, policies, decision types.
  • Estimates financial exposure from affected transaction amounts.
  • Outputs severity and a clear recommendation: ALLOW, REVIEW, or BLOCK.

Changes

  • Added agent-governance-python/agent-decisionassure/ package.
  • Added examples under examples/decisionassure/ (synthetic generator, policy YAMLs).
  • CLI command decisionassure with impact and detect-drift subcommands.
  • No changes to agentmesh or agent_os imports.
  • Full test suite (6 passing tests).
  • CI gate: decisionassure impact exits with code 1 on BLOCK.

Demo output

ADMISSIBLE → INADMISSIBLE:  57
Impact rate:             18.39%
Agents affected:            43
Tools affected:              1
Estimated exposure:   ₹2,564,702
Severity:                  HIGH
Recommendation:          BLOCK


How to test

cd agent-governance-python/agent-decisionassure
pip install -e .
python examples/decisionassure/generate_sample.py
decisionassure impact \
    --traces examples/decisionassure/sample_traces.jsonl \
    --policy-current examples/decisionassure/policy_v4.yaml \
    --policy-proposed examples/decisionassure/policy_v5.yaml

Review Notes

This is a restructured version following feedback on PR #3851 (Imran’s review).

Now placed under agent-governance-python/agent-decisionassure/.
Examples in examples/decisionassure/.
No root scratch files.
All imports use agent_decisionassure.
Ready for review.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@github-actions github-actions Bot added documentation Improvements or additions to documentation dependencies Pull requests that update a dependency file tests security Security-related issues size/XL Extra large PR (500+ lines) labels Sep 3, 2026
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

PR Review Summary

Check Status Details
🔍 Code Review ⚠️ Missing No current-run comment
🛡️ Security Scan ⚠️ Missing No current-run comment
🔄 Breaking Changes ⚠️ Missing No current-run comment
📝 Docs Sync ⚠️ Missing No current-run comment
🧪 Test Coverage ⚠️ Missing No current-run comment

Verdict: ⚠️ AI review incomplete; ready for human review

AI review comments are untrusted advisory output. The summary reports workflow-generated completion status only, not model-authored pass/fail claims.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This addresses every structural point I raised on #3851, and it did so within the hour. Worth
recording what changed, because the difference is not cosmetic:

#3851 this PR
size 8,742 lines / 116 files 1,346 lines / 35 files
mergeable CONFLICTING (446 behind) MERGEABLE
root-level scratch files policy_v4/5/6.yaml, sample_traces.jsonl none
new top-level directories decisionassure_continuity/, decisionassure_impact/ none
existing files modified 7, including two SDK __init__.py zero
agentmesh/governance.py vs the governance/ package collision gone

Landing it as agent-governance-python/agent-decisionassure/ with the samples under
examples/decisionassure/ is the right placement, and making the whole PR pure additions means it
cannot regress anything that exists. That is a much easier thing to approve.

Two other things you got right that I want to name. Per-package LICENSE, SECURITY.md and
CONTRIBUTING.md match what agent-os and its siblings carry, so this is not inventing a layout.
And docs/limitations.md is the most honest paragraph in the PR: "Replay establishes only what the
supplied artifacts support... Hashes detect integrity changes, not identity." A counterfactual engine
that oversold itself would be worse than none, and that page inoculates against it.

Reclaiming ADR 0033 is also correct rather than opportunistic, since #3121 was your own and was
closed unmerged. Incidentally that closes a gap: #3726 is currently numbered 0034 and leaves 0033
empty, so if both land the sequence is continuous.

One blocking problem: the test suite cannot run. The package was renamed during the re-cut and
the tests still import the old name. All four files fail at collection:

PYTHONPATH=src python -m pytest tests
  tests/unit/test_policy.py:1
    from decisionassure_impact.models import Action, Decision, Policy
  E ModuleNotFoundError: No module named 'decisionassure_impact'

  4 errors during collection  (integration/test_replay.py, security/test_redaction.py,
                               unit/test_authority_evidence.py, unit/test_policy.py)

src/agent_decisionassure/ contains __init__.py, cli.py, drift.py, engine.py,
integration.py and models/. Every decisionassure_impact import needs to become
agent_decisionassure.

tests/security/test_redaction.py needs more than a rename. It imports
decisionassure_impact.security.redaction.redact, and there is no security/ package in this PR at
all. So either the redaction module was left behind in the re-cut, or that test is a leftover that
should be dropped. Given the file lives under tests/security/ and SECURITY.md promises that
credentials and raw customer evidence never reach traces or reports, I would rather see the module
arrive than the test disappear. A redact() that the docs commit to and the code does not implement
is the one gap here that is a correctness claim rather than a packaging detail.

Test coverage is thin for the size, and this is the natural moment to fix it since you are
touching all four files anyway. Roughly 37 lines of tests against 800+ lines of engine, CLI and drift
logic. The engine is the interesting part: a replay that flips a decision from ADMISSIBLE to
INADMISSIBLE is the product, so at least one end-to-end case per direction, driven from
examples/decisionassure/policy_v4.yaml to policy_v5.yaml over sample_traces.jsonl, would prove
the thing the PR exists to do.

None of that is a reason to re-cut again. Fix the imports, decide what happens to redaction, and this
becomes a straightforward review of the engine itself, which is where the attention belongs.

Thanks for turning this around so quickly and for taking the placement question seriously rather than
arguing it.

@a1k7

AkhileshWarik (a1k7) commented Sep 3, 2026

Copy link
Copy Markdown
Author

Thank you for the thorough review and the kind words about the structural improvements.

I’ve addressed all the points you raised:

Test imports – All tests now import from agent_decisionassure (the renamed package).
Missing redaction.py – The module is now present with full redaction support (SSN, credit card, email, phone, custom patterns) and has passing tests.
Test coverage – Added an end‑to‑end replay test and expanded unit tests. All tests now pass locally (pytest shows 7 passed, 2 skipped for optional dependencies).
Authority check – Fixed _check_authority to compare against the decision’s timestamp, not the current time, and now handles ISO‑format strings properly.
Policy test – Adjusted test_policy_evaluation to use risk_score = 35 so the refund rule is the only match, and increased the transaction amount to trigger a BLOCK recommendation.
The PR is now clean, mergeable, and ready for final review.

Let me know if there’s anything else I can adjust.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation security Security-related issues size/XL Extra large PR (500+ lines) tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants