docs: clarify component vs access roles and add custom node roles recipe #985
All Vouch review confidence checks passed
Residual risk 0.29 = Change Risk (0.55) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.55 · 621 lines diff across 7 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.385
Shallow Review Depth
shallow_review_depth
0.344
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #985"
general
weight: 0.35
aojea
Closes #957
Problem
In Agent Mesh, the word "role" is used across two distinct architectural layers:
1. Component roles (
mesh:role:node,mesh:role:router), which describe infrastructure binary identities fixed at enrollment.2. Access roles (
caller,developer,analyst), which describe what services a member may call or publish.Because both concepts are named "role", users attempting to create a node bootstrap token with an access role (e.g.
agentmesh-one token create --role caller) hit unexpected failures during enrollment:agentmesh-nodealways requestsmesh:role:node(RequiredRole: api.RoleNode), and the control plane requires the requested role to match the bootstrap token's role. Furthermore, users who switch to policy bindings are often surprised when inspecting the enrolled node's Biscuit credential (/mesh/identityorX-Mesh-Roles), which still displays onlymesh:role:nodebecause custom roles are evaluated dynamically via distributed Datalog rules rather than baked into the Biscuit.Changes
This PR implements the recipe and fail-fast validation requested in #957:
1. Documentation & Recipe
guides/custom-node-roles.md) explaining how to:1. Mint a bootstrap token with
mesh:role:node.2. Enroll and run
agentmesh-node.3. Obtain the node's PeerID (
12D3KooW...) from startup logs, debug CLI (agentmesh-node debug mesh-info), or the local API (GET /debug/mesh-info).4. Grant a custom access role by adding
{"role": "caller", "members": ["node:<peer-id>"]}to policy bindings and posting toPOST /policies(merging into existing policies).5. Understand policy propagation (within the 0–90 second sync jitter window without restarts) and how effective permissions derive from Datalog authorizer evaluation rather than roles listed in the Biscuit.
6. Verify allowed and denied calls via
call_remote_tooland the HTTP proxy path.policy.md(concise distinction linking to guide),headless-enrollment.md,control-plane.md,agentmesh-one.md, andagentmesh-node.mdto reference the component role requirements and cross-link to the new guide.concepts/identity.mdwith component vs. access role distinctions and evaluation details.2. Fail-Fast Bootstrap Token Role Validation
agentmesh-one token create --role: Validates that--roleis eithermesh:role:nodeormesh:role:router. If an arbitrary role is passed (e.g.,caller), it immediately returns a descriptive error:invalid role "caller": bootstrap tokens only enroll component types (mesh:role:node or mesh:role:router); custom access roles must be granted via policy bindingsHandleAdminBootstrapTokens(POST /admin/bootstrap-tokens) andHandleUserBootstrapTokens(POST /user/bootstrap-tokens) validate thatroleis eitherapi.RoleNodeorapi.RoleRouter, returning HTTP 400 Bad Request with the same explanatory message.--roleinagentmesh-one token createto explicitly name(mesh:role:node or mesh:role:router).internal/controlplane/egress_test.goto enroll nodes usingmesh:role:nodeand grant custom roles through policy bindings (node:<peer-id>).Files Changed
site/content/docs/guides/custom-node-roles.md(new step-by-step recipe)site/content/docs/guides/_index.md(guides directory index)site/content/docs/guides/headless-enrollment.md(bootstrap token minting role clarification)site/content/docs/reference/policy.md(concise role definition and guide link)site/content/docs/reference/control-plane.md(bootstrap tokens endpoint description)site/content/docs/reference/agentmesh-one.md(token create command description)site/content/docs/reference/agentmesh-node.md(bootstrap-token-path flag description)site/content/docs/concepts/identity.md(bootstrap token role and policy binding clarification)cmd/agentmesh-one/admin.go(role validation and updated CLI flag help text)cmd/agentmesh-one/admin_test.go(unit tests for role flag validation)internal/controlplane/server.go(role validation in bootstrap token creation handlers)internal/controlplane/server_test.go(unit tests for bootstrap token role validation)internal/controlplane/egress_test.go(alignment with component role enrollment and policy bindings)Validation Performed
make build: All binaries built cleanly.golangci-lint: 0 issues found.deadcode: 0 dead code detected across the repository.go test -race ./cmd/agentmesh-one/... ./internal/controlplane/...): Passed without race conditions.go test -p 1 -v ./tests/integration -run TestSilentEphemeralMembersAreForgotten): Passed.git diff --check.