fix: surface empty AgentMesh policy state at startup - #4066
Ricky Gummadi (Ricky-G) merged 4 commits into
Conversation
PR Review Summary
Verdict: AI review comments are untrusted advisory output. The summary reports workflow-generated completion status only, not model-authored pass/fail claims. |
MohammadHaroonAbuomar
left a comment
There was a problem hiding this comment.
- agent-governance-python/agent-mesh/src/agentmesh/server/sidecar.py:62 The sidecar's
/readyand/readyzstill return 200 withpolicies_loaded: 0(verified), while the policy-server now returns 503 for the same state. Flip the sidecar too or say why the two should differ; #4061 asks for the probe to distinguish the empty state. - agent-governance-python/agent-mesh/CHANGELOG.md: no entry, yet 503-on-empty is deployment-visible: a policy-server with an empty directory, which safely denies everything today, will never become Ready and drops out of its Service. Document it and the new
load_warnings/startup_warningsfields. - Minor:
.cspell.json:70adds a term towords; the repo convention is.cspell-repo-terms.txt..gitignore:23.DS_Storeis unrelated and comes from #3441's commit 2f269c1. In sidecar.py the fieldstartup_warningsand the "Startup validation" message also fire onPOST /api/v1/policy/reload;load_warningswould match the policy-server and the actual trigger.
9c9ea17 to
99f7c51
Compare
|
Round two at 68e0cca: asks 1 and 3 through 8 are verified in code (trailer on every commit and #3441 credited; sidecar and policy-server both return 503 with zero effective rules; What is left is the order against #4071. This branch now carries #4071's missing-directory raise byte for byte, but Two minor items you can fold into that rebase, neither blocking: |
Expose startup warnings in policy-server and sidecar status responses, fail the policy-server readiness probe when no policies are loaded, and preserve the existing policy-load generation metadata. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Signed-off-by: Ricky Gummadi <ricky.gummadi@outlook.com> Co-authored-by: sakunaharinda <sakunaj1996@gmail.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Signed-off-by: Ricky Gummadi <ricky.gummadi@outlook.com> Co-authored-by: sakunaharinda <sakunaj1996@gmail.com>
Return not-ready responses for policy sets without enabled rules, expose effective rule counts and load warnings, and make policy-server readiness registration explicit. Update tests, changelog, and repository spell-check configuration. Signed-off-by: Ricky Gummadi <ricky.gummadi@outlook.com> Co-authored-by: sakunaharinda <sakunaj1996@gmail.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Co-authored-by: sakunaharinda <sakunaj1996@gmail.com>
Build the trust-policy regression fixture through the AgentMesh model so the v4 removal ratchet does not classify its YAML shape as legacy policy language. Signed-off-by: Ricky Gummadi <ricky.gummadi@outlook.com> Co-authored-by: sakunaharinda <sakunaj1996@gmail.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
68e0cca to
bb1475d
Compare
MohammadHaroonAbuomar
left a comment
There was a problem hiding this comment.
Approving at bb1475d. The rebase onto #4071 is clean: the duplicated missing-directory block is gone, the range-diff shows no change beyond the rebase, and the combined behaviour was probed end to end (empty dir, missing dir, mode-000 dir, rules: [], one enabled rule, unreadable file on reload). Both servers report 503 with zero effective rules, the fail-closed startup and 409 reload paths from #4071 hold, and readiness is unchanged when a reload is rejected. sakunaharinda is credited on every commit. 108 tests pass, CI green.
Two notes carried as follow-ups, not blockers: effective_rule_count is summed per file, so two files sharing a policy name overcount against the engine (sidecar dedupes), and the policy-server /readyz payload includes policy_dir. Keep the co-author trailer in the squash message.
Summary
Make AgentMesh readiness fail closed when no enabled policy rules are loaded. The policy server and governance sidecar now expose the empty-policy state consistently through HTTP 503 readiness responses and structured load diagnostics.
Problem
The policy server and governance sidecar could start with an empty or ineffective policy set while reporting readiness. The policy server also replaced the shared readiness route by mutating FastAPI's route list at import time, and its tests duplicated global-state save/restore logic.
Changes
agent-governance-python/agent-mesh/src/agentmesh/server/__init__.py/readyzroute without mutating the router.agent-governance-python/agent-mesh/src/agentmesh/server/policy_server.py503 Not Readywhen no effective rules are loaded, reporteffective_rulesandload_warnings, count enabled governance/trust rules, and fail closed for a missing policy directory.agent-governance-python/agent-mesh/src/agentmesh/server/sidecar.py503 Not Readyresponses from/readyand/readyz, track effective rules, and exposeload_warningsin generation/status responses.agent-governance-python/agent-mesh/src/agentmesh/governance/trust_policy.pyagent-governance-python/agent-mesh/tests/test_server.pymonkeypatchfor isolated policy-server state and cover empty, disabled, trust, and missing-directory policy states.agent-governance-python/agent-mesh/tests/test_sidecar.pyagent-governance-python/agent-mesh/CHANGELOG.md.cspell-repo-terms.txtreadyzendpoint term using the repository convention.Closes #4061.
Related to #3538.
Attribution & Prior Art
This change incorporates the empty-policy readiness implementation and regression-test approach from #3441. Credit to
sakunaharindais included in every branch commit withCo-authored-by: sakunaharinda <sakunaj1996@gmail.com>.Testing
PYTHONPATH=agent-governance-python/agent-mesh/src python -m pytest agent-governance-python/agent-mesh/tests/test_server.py agent-governance-python/agent-mesh/tests/test_sidecar.py agent-governance-python/agent-mesh/tests/test_trust_policy.py -q— 95 passed, 1 skipped.PYTHONPATH=agent-governance-python/agent-mesh/src python -m pytest agent-governance-python/agent-mesh/tests/test_otel_bootstrap.py -q— 33 passed.python -m ruff check --select E,F,W --ignore E501on changed AgentMesh files — passed.git diff --check— passed.