Approval Holds (-32099) & Retry
Cordum intercepts mutating tools/call invocations before the underlying handler runs. Depending on whether mcp.policy_gate_enabled is enabled (true in starter dev configs), Cordum returns JSON-RPC error -32099 with an approval reference and explicit retry_hint.
Policy Gate Flow (mcp.policy_gate_enabled: true)
Agent / Client Gateway MCPGate Reviewer (Distinct Principal)
│ │ │
│── tools/call (mutating tool) ───▶│ Evaluate policy + canonical hash │
│◀─ -32099 + edge_appr_... ────────│ Mint single-use hold (action_hash) │
│ │ │
│ │◀── POST /api/v1/edge/approvals/ │
│ │ {ref}/approve ──────────────│
│ │ (403 if same key or principal) │
│ │ │
│── tools/call + _approval_ref ───▶│ Verify status == approved, │
│ │ action_hash match & single-use CAS │
│◀─ tool result ───────────────────│ Execute handler once │
Wire Fields Returned on -32099
| Field | Value (policy_gate_enabled: true) | Legacy Mode (policy_gate_enabled: false) |
|---|---|---|
error.code | -32099 | -32099 |
data.retry_hint | "retry_with_approval_ref" | "retry_with_same_args" |
data.approval_ref | edge_appr_<...> (authoritative resume token) | Omitted |
data.approval_id | mcp_appr_<...> (correlation-only in policy gate mode) | mcp_appr_<...> (authoritative) |
| Approval Endpoint | POST /api/v1/edge/approvals/{approval_ref}/approve | POST /api/v1/mcp/approvals/{id}/approve |
| Retry Payload | Identical arguments plus "_approval_ref": "edge_appr_..." | Identical arguments (no _approval_ref) |
:::warning Do not approve approval_id when retry_hint is retry_with_approval_ref
When mcp.policy_gate_enabled is true, data.approval_id is recorded solely for correlation in the UI. Resuming requires approving data.approval_ref on /api/v1/edge/approvals/{approval_ref}/approve and retrying with "_approval_ref" set to that ref.
:::
Security Guarantees on Resume
- Argument & Policy Binding: The Gateway hashes the normalized tool arguments, tool name, and active policy snapshot before minting
edge_appr_*. Changing a flag or target on retry fails hash verification and triggers a fresh hold. - Atomic Single-Use Consumption: Consuming
_approval_refuses atomic claim semantics so two concurrent retries cannot execute the same approved mutation twice. - Self-Approval Guard: Approving a hold with the same API key hash or same principal ID that submitted the tool call fails with
403 Forbidden. - Canonical Argument Stripping:
_approval_refis stripped by the MCP hold layer before canonical hash verification and before invoking the tool handler, so tool schemas remain clean.
Upstream Proxy vs. Built-In Tools
- Built-in mutating tools (
cordum_create_workflow,cordum_install_pack,cordum_uninstall_pack,cordum_register_agent,cordum_set_agent_scope,cordum_update_policy_bundle,cordum_revoke_worker_session): always require human approval by default unless explicitly allow-listed inpreapproved_mutating_toolson the callingAgentIdentity. - Registered external MCP upstreams (
cordumctl mcp upstream add): can be classified as mutating/high-risk and routed through the same Gateway-32099approval hold when proxied through Cordum. Unregistered MCP servers called directly by an agent bypass Cordum unless governed via Cordum Edge hooks (cordumctl edge claude) or routed through the Gateway.
Verify in source →
core/mcp/approval_hold.go—_approval_refcanonical stripping & retry contractcore/controlplane/gateway/mcp_gate.go— Policy evaluation bridge intocore/policy/actiongatescore/controlplane/gateway/handlers_edge_approvals.go— Edge approval resolution & self-approval guardcore/controlplane/gateway/mcp_policy_wire.go— Production wiring & consume-once claim handling