contest_action
Records a principal's dispute against an already logged action in a dated, hash-chained journal, including the reason and an operator response deadline.
Instructions
Record that a principal contests an action an agent already performed.
Use it when an act logged with log_action was not wanted: the registry keeps a dated, chained record that the act was disputed, and when, so silence is not the only trace. One contest per action; it cannot be withdrawn or edited.
The contesting principal is the mandate's principal (default) or the principal of any mandate above it in the delegation chain. If that principal has a registered key, the contest must carry its signature: build the bytes with prepare_contest_signature, sign them, pass principal_signature and signed_at. With AMR_REQUIRE_PRINCIPAL_SIGNATURE, every contest must be signed.
response_days sets respond_by = contested_at + response_days. It is the operator's own deadline (for example the delay its counsel gives before keeping or using what was ordered could be read as ratifying it): AMR computes no legal deadline and asserts none. list_action_contests reminds it.
A contest does not undo the action, does not revoke the mandate (call revoke_mandate for that) and changes no hash already recorded.
Args: mandate_id: UUID of the mandate the action was logged under. action_id: action_id returned by log_action. reason: Why the act is contested (1 to 500 characters). Example: "order placed above the agreed quantity" response_days: Days until respond_by, 1 to 365. Example: 14 contested_by: The contesting principal. Default: the mandate's principal. principal_signature: Base64url Ed25519 signature of the contest payload. signed_at: The signed_at placed in the payload (ISO 8601 with timezone).
Returns: JSON string with keys: status ("contested"), mandate_id, action_id, action_chain_hash, contested_by, reason, response_days, contested_at, reminder ({respond_by, days_left, deadline_passed}), principal_signature ({key_id, signed_at} or null), chain_hash. On error: {"error": "...", "code": "..."} with code invalid_input, mandate_not_found, action_not_found, contester_not_in_chain, action_already_contested or a principal signature code.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| reason | Yes | ||
| action_id | Yes | ||
| signed_at | No | ||
| mandate_id | Yes | ||
| contested_by | No | ||
| response_days | Yes | ||
| principal_signature | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |