Add governance policy framework (RFC-MACP-0012)#28
Merged
ajit-zer07 merged 10 commits intomainfrom Apr 8, 2026
Merged
Conversation
Implement policy registry, evaluation, and gRPC lifecycle RPCs for governance policies. Policies are resolved at SessionStart and evaluated at commitment time across all standard modes. Migrate proto management from vendored files to the macp-proto crate dependency.
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.
Summary
src/policy/module withpolicy registry, rule types (per-mode JSON schemas), evaluators, and default
policy. Policies are resolved at
SessionStartviapolicy_versionandevaluated at commitment time in all five standard modes (decision, proposal,
task, handoff, quorum).
RegisterPolicy,UnregisterPolicy,GetPolicy,ListPolicies, andWatchPoliciesserver-streaming endpointson the gRPC service, with
PolicyRegistryCapabilityadvertised inInitialize.proto/directory andbuf.yaml/buf.lock. Proto definitions are now sourced from themacp-protocrate viaDEP_MACP_PROTO_PROTO_DIRinbuild.rs. CI jobslint-protobufandproto-syncare removed; Makefile targetssync-protos,sync-protos-local,and
check-protosare removed.UnknownPolicyVersion,PolicyDenied,InvalidPolicyDefinitionadded toMacpError.check_commitment_authorityintosrc/mode/util.rs, used by all modes for consistent initiator-only commitmentchecks with policy-driven
designated_rolesoverride.policy_definition: Option<PolicyDefinition>toSession,populated at start and re-resolved during replay.
commitment time (e.g., voting algorithm for decision, quorum thresholds,
proposal acceptance criteria, task completion requirements, handoff implicit
accept timeout).
Test plan
cargo test— unit tests pass, including new policy evaluation testsin each mode module and error variant coverage
cargo clippy/cargo fmt— no warnings or formatting issuescargo build— successful build with macp-proto crate dependency(
integration_tests/tests/tier1_protocol/test_policy_registry.rs)make test-integration-grpc— Tier 1 gRPC tests pass with new policy RPCs