Monitoring activities
Every mutation is an activity. This workflow resumes one by id, casts a vote on it, and reads who voted. Resuming never resubmits the original command.
Reference
- activities:
activitycommand records and exit codes. - secrets: the two commands that are rerun rather than resumed.
Rules
- Resume by activity id. The only mutations that are rerun are
secret export,secret env, andsession provision, which detect their own pending work. - Before approving, verify the target: the organization, the activity type,
and the parameters (for a key registration, the target
userId, thepublicKey, and the lifetime). Target tags are not policy-visible, so the approver is the check that the target is the intended agent. - Rejection is final. A rejected activity cannot be approved later; the submitter runs a new one.
- Approve as the intended approver identity. A root approval also satisfies the root quorum and proves nothing about the policy.
Instructions
Inputs: the activity id from the pending record, and the approver's profile
(approver). The submitter's profile is agent.
Find the activity. Any identity in the organization.
<!-- example: activities.get -->tk --profile approver --message-format json activity get --id ACTIVITY_IDstatusis the record status;data.activity.statusthe raw value (ACTIVITY_STATUS_CONSENSUS_NEEDEDwhile approvals are outstanding).data.activity.typeanddata.activity.intentdescribe the request.Without an id, page through recent activities:
<!-- example: activities.list -->tk --profile approver --message-format json activity list --limit 50 tk --profile approver --message-format json activity list --limit 50 --cursor ACTIVITY_IDdata.items[]is one page, newest first;data.nextCursoris the id to pass as--cursorfor the next page, ornullon the last page. Filter bystatusandtypelocally; the command has no filters.Approve or reject. Approver.
<!-- example: activities.vote -->tk --profile approver --message-format json activity approve --id ACTIVITY_ID tk --profile approver --message-format json activity reject --id ACTIVITY_IDapprovereturnscommand: "activity.approve"withstatuscompleted, orpendingwhen more votes are needed.rejectreturnsstatus: "rejected". Both name the target underactivity.id.Wait as the submitter.
<!-- example: activities.wait -->tk --profile agent --message-format json activity wait --id ACTIVITY_ID --timeout 60Exit
0withstatus: "completed"ends the wait; the result is underdata.activity.result. Exit1withcode: "wait_timeout"means run the same command again. Exit1withcode: "api_error"anddetails.activity.statusofACTIVITY_STATUS_REJECTEDor_FAILEDis final; report it and stop.Reconcile an unknown outcome. When a mutation failed with
submission_unknownornetwork_uncertain, list activities as in step 1, match bydata.items[].typeand the intent's parameters, and continue with step 3 on the match. Resubmit only when no matching activity exists.Hand off. Report the activity id, its final status, and any result ids under
data.activity.result. Apendinghandoff names who still has to vote. Stop.
Verified by
| Examples | Test |
|---|---|
| activities.get, activities.list, activities.vote, activities.wait | activities::monitoring_activities_approve_reject_wait |
| activities.get, activities.wait | activities::activity_list_paginates_and_get_and_wait_inspect_a_completed_activity |
Troubleshooting
activity approvefails withunauthorized: this identity is not selected by the policy's consensus, or the activity is no longer pending. Checkdata.activity.votesand the consensus expression.activity approvereturnspending: the policy requires more approvers than this vote.policy evaluations --activity-id ACTIVITY_IDshows which clause is unsatisfied.activity waitreturnswait_timeoutrepeatedly: the activity is waiting for a human. Report the id and the missing approver; do not resubmit.activity getfails withnot_found: the id belongs to another organization or was mistyped. Check--profileand the id.- A
secret exportorsecret envis pending: do notactivity waitit to completion and expect the value. Approve it, then rerun the samesecretcommand from the same credential and home directory.
Related Skills
- managing-policies: read the policy behind a pending or denied activity.
- managing-secrets: finish a pending export after approval.
- managing-identities: approve a key registration, then let the user switch to it.