Context
Implement the approval timeout policy system defined in DESIGN_SPEC §12.4. When an action requires human approval (per autonomy level in §12.2), the agent must wait. The framework provides configurable timeout policies that determine what happens when a human doesn't respond.
All policies implement a TimeoutPolicy protocol. The policy is configurable per autonomy level and per action risk tier.
Task park/resume: During any wait, the agent parks the blocked task (saving its full serialized AgentContext state) and picks up other available tasks. When approval arrives, the agent resumes the original context exactly where it left off.
Policies (§12.4)
Policy 1: Wait Forever (Default for Critical Actions)
Action stays in human queue indefinitely. Agent works on other tasks while waiting.
Policy 2: Deny on Timeout
All unapproved actions auto-deny after configurable timeout. Agent receives denial reason and can retry with a different approach.
Policy 3: Tiered Timeout
Different timeout behavior based on action risk level:
- Low-risk (file edits, tests): auto-approve after short wait
- Medium-risk (git push, architecture): auto-deny after longer wait
- High-risk (deployment, database admin): wait forever
Policy 4: Escalation Chain
On timeout, approval request escalates to next human in configured chain (direct manager → department head → CEO). If entire chain times out, action denied.
Acceptance Criteria
Protocol Interface
Implementations
Task Park/Resume Mechanism
Common Requirements
Dependencies
Design Spec Reference
- §12.4 — Approval Timeout Policy (4 policies behind TimeoutPolicy protocol, task park/resume)
- §12.2 — Autonomy levels (determines when approval is needed)
Design Decisions Finalized
- D1 — Action Types:
category:action hierarchy used by risk tier classification for timeout policies.
- D19 — Risk Tier Classification: Pluggable
RiskTierClassifier protocol. Initial: configurable YAML mapping (RiskTierMapping with dict[str, ApprovalRiskLevel]). Sensible defaults. Unknown action types → HIGH (fail-safe).
- D20 — Context Serialization: Pydantic JSON via persistence backend.
ParkedContext model with metadata columns (execution_id, agent_id, task_id, parked_at) + context_json blob. ParkedContextRepository protocol. Conversation stored verbatim.
- D21 — Resume Injection: Tool result injection. Approval request modeled as tool call; approval decision returned as
ToolResult. Fallback: system message for engine-initiated parking.
Common pattern: All strategies use pluggable protocol interfaces with one initial implementation. Alternative strategies are documented in DESIGN_SPEC.md for future.
Context
Implement the approval timeout policy system defined in DESIGN_SPEC §12.4. When an action requires human approval (per autonomy level in §12.2), the agent must wait. The framework provides configurable timeout policies that determine what happens when a human doesn't respond.
All policies implement a
TimeoutPolicyprotocol. The policy is configurable per autonomy level and per action risk tier.Task park/resume: During any wait, the agent parks the blocked task (saving its full serialized
AgentContextstate) and picks up other available tasks. When approval arrives, the agent resumes the original context exactly where it left off.Policies (§12.4)
Policy 1: Wait Forever (Default for Critical Actions)
Action stays in human queue indefinitely. Agent works on other tasks while waiting.
Policy 2: Deny on Timeout
All unapproved actions auto-deny after configurable timeout. Agent receives denial reason and can retry with a different approach.
Policy 3: Tiered Timeout
Different timeout behavior based on action risk level:
Policy 4: Escalation Chain
On timeout, approval request escalates to next human in configured chain (direct manager → department head → CEO). If entire chain times out, action denied.
Acceptance Criteria
Protocol Interface
TimeoutPolicyprotocol defined with standard operations (check_timeout, apply_policy, get_risk_tier)approval_timeout.policy: "wait" | "deny" | "tiered" | "escalation")Implementations
Task Park/Resume Mechanism
AgentContextserialization for task parking (full state: conversation, progress, cost, turn count)AgentContextSnapshot(compact telemetry model)Common Requirements
Dependencies
Design Spec Reference
Design Decisions Finalized
category:actionhierarchy used by risk tier classification for timeout policies.RiskTierClassifierprotocol. Initial: configurable YAML mapping (RiskTierMappingwithdict[str, ApprovalRiskLevel]). Sensible defaults. Unknown action types → HIGH (fail-safe).ParkedContextmodel with metadata columns (execution_id, agent_id, task_id, parked_at) +context_jsonblob.ParkedContextRepositoryprotocol. Conversation stored verbatim.ToolResult. Fallback: system message for engine-initiated parking.Common pattern: All strategies use pluggable protocol interfaces with one initial implementation. Alternative strategies are documented in DESIGN_SPEC.md for future.