openapi: "3.1.0" info: title: Agent Task Editor API version: "1.0.0" servers: - url: http://localhost:8080/api/v1 components: schemas: NeedsMeResponse: type: object required: [items, approved_by_policy] properties: items: type: array items: { $ref: "#/components/schemas/NeedsMeItem" } approved_by_policy: type: array description: Tasks the autonomy policy approved in the last 24 hours (newest first), for the Inbox "Approved for you" section. Always present. items: { $ref: "#/components/schemas/PolicyApprovalItem" } PolicyApprovalItem: type: object required: [task_id, task_title, repo_id, workflow_id, label, gate_label, approved_at, note, decision_id, undoable] properties: task_id: { type: string } task_title: { type: string } repo_id: { type: string } workflow_id: { type: string } label: { type: string, description: "The task's current label." } gate_label: { type: string, description: The gate the policy approved the task off. } approved_at: { type: string, format: date-time } note: { type: string, description: "The Auto-approved label-history note." } decision_id: { type: string } pr_url: { type: string, description: "Set when a pull request was already opened." } undoable: type: boolean description: True when POST /tasks/{id}/autonomy/undo would currently be accepted (last gate exit by policy, not merged). changed: type: object required: [files, additions, deletions] description: Diff size when the branch diff could be computed. properties: files: { type: integer } additions: { type: integer } deletions: { type: integer } NeedsMeItem: type: object required: [task_id, task_title, repo_id, workflow_id, label, reason, since] properties: task_id: { type: string } task_title: { type: string } repo_id: { type: string } workflow_id: { type: string } label: { type: string } reason: type: string enum: [waiting_human, change_set_partial, pr_conflict, human_gate, auto_approving] message: type: string description: Waiting run feedback or notes text, when present. due_at: type: string format: date-time description: When the pending auto-approval fires. auto_approving items only. decision_id: type: string description: The pending autonomy decision. auto_approving items only. run_id: type: string description: Set when reason is waiting_human. escalation_reason: type: string enum: [agent_question, auth_required, repeated_failure, rework_loop, cost_budget, cost_unknown, provider_missing, runtime_prep, max_turns, transient_exhausted, no_outcome, rejected_transition, verify_error] description: >- Why the waiting run escalated to a human (the run's escalation_reason). Present only when reason is waiting_human and a code was recorded; runs from before the column existed omit it. since: type: string format: date-time description: When the task started needing a human; the list is sorted by this ascending. risk_flags: type: array items: { $ref: "#/components/schemas/RiskFlagCode" } description: >- Review-brief flag codes; present only for human_gate and auto_approving items whose branch diff could be computed and raised at least one flag. summary: type: string description: One-line agent summary from the review brief. human_gate and auto_approving items only, when the brief could be built and an agent summary exists. changed: type: object required: [files, additions, deletions] description: Diff size. human_gate and auto_approving items only, when the branch diff could be computed. properties: files: { type: integer } additions: { type: integer } deletions: { type: integer } cost_usd: type: number format: double description: Cost so far across the task's runs. human_gate and auto_approving items only, when the review brief could be built. cost_unknown: type: boolean description: True when some run had unknown cost. human_gate and auto_approving items only, when the review brief could be built. verification: type: string enum: [pass, fail, timeout, error, not_run] description: Latest verify result. human_gate and auto_approving items only, when the review brief could be built. preview_count: type: integer description: Images in the latest preview capture. human_gate and auto_approving items only, when the review brief could be built; omitted when 0. change_set: $ref: "#/components/schemas/NeedsMeChangeSet" NeedsMeChangeSetPR: type: object required: [task_id, title, repo_id, state] properties: task_id: { type: string, description: The child task } title: { type: string } repo_id: { type: string } pr_url: { type: string } state: { type: string, enum: [pr_merged, pr_closed, land_failed], description: "pr_merged = merged; pr_closed = closed unmerged; land_failed = the PR never landed (push/PR creation failed for good)" } NeedsMeChangeSet: type: object description: change_set_partial items only. Which PRs of the change set merged and which did not. required: [merged, failed] properties: merged: type: array items: { $ref: "#/components/schemas/NeedsMeChangeSetPR" } failed: type: array items: { $ref: "#/components/schemas/NeedsMeChangeSetPR" } LabelAutonomy: type: object properties: mode: { type: string, enum: [ask, on_flags, auto] } ask_on: type: array items: { $ref: "#/components/schemas/RiskFlagCode" } hold_seconds: { type: integer, minimum: 0, description: "Hold window before an auto-approval fires; a person can Hold it meanwhile. 0 approves immediately." } max_cost_usd: { type: number, nullable: true, description: "Hard stop when the task's total cost exceeds this; null = no cap." } required: [mode, ask_on, hold_seconds] AutonomyReason: type: object properties: code: { type: string, description: "mode_ask, always_ask, verify_failed, cost_exceeded, no_diff, flag_raised, undone, ask_rule, auto_policy or no_blocking_flags." } rule_id: { type: string, description: The matching ask rule (code ask_rule only). } detail: { type: string } required: [code, detail] AutonomyBacktest: type: object required: [total, evaluated, unknown, would_skip, would_ask, rejected, escaped, truncated, timed_out, passes, rules] properties: total: { type: integer } evaluated: { type: integer } unknown: { type: integer } would_skip: { type: integer } would_ask: { type: integer } rejected: { type: integer, description: "Evaluated passes a person rejected (PR-feedback sync moves, actor pr-feedback-sync, are excluded)" } escaped: { type: integer, description: Rejected passes the setting would have skipped } truncated: { type: boolean } timed_out: { type: boolean } passes: type: array description: Oldest first items: type: object required: [task_id, title, at, outcome, flags, would_skip, unknown] properties: task_id: { type: string } title: { type: string } at: { type: string, format: date-time } outcome: { type: string, enum: [approved, rejected] } flags: { type: array, items: { type: string } } would_skip: { type: boolean, nullable: true } unknown: { type: boolean } rules: nullable: true description: Present when extra_rules was sent. How many recent policy approvals at the gate (max 500) the draft rules would have stopped. type: object required: [policy_approvals, evaluated, unknown, would_stop, stopped] properties: policy_approvals: { type: integer } evaluated: { type: integer } unknown: { type: integer } would_stop: { type: integer } stopped: type: array items: type: object required: [task_id, title, at, rule_indexes] properties: task_id: { type: string } title: { type: string } at: { type: string, format: date-time } rule_indexes: { type: array, items: { type: integer }, description: Indexes into extra_rules. } AskRule: type: object description: >- An ask rule forces a human decision at a gate when a task matches ALL of its set conditions. Rules are never deleted automatically; renaming a label leaves rules pointing at the old name. required: [id, repo_id, workflow_id, label, path_globs, task_type, min_changed_lines, created_by, source_task_id, created_at, hit_count, last_hit_at, summary] properties: id: { type: string } repo_id: { type: string, nullable: true, description: Null = all repos. } workflow_id: { type: string } label: { type: string, nullable: true, description: Null = all gates of the workflow. } path_globs: { type: array, items: { type: string }, description: Lesson glob syntax; any glob matching any changed file satisfies the condition. } task_type: { type: string, nullable: true } min_changed_lines: { type: integer, nullable: true, description: Additions plus deletions of the task diff must be at least this. } created_by: { type: string } source_task_id: { type: string, nullable: true } created_at: { type: string, format: date-time } hit_count: { type: integer, description: Real (non-backtest) evaluations the rule forced to ask. } last_hit_at: { type: string, format: date-time, nullable: true } summary: { type: string } AskRuleInput: type: object description: Rule conditions. At least one of path_globs, task_type, min_changed_lines is required. properties: path_globs: { type: array, items: { type: string }, maxItems: 20 } repo_id: { type: string, nullable: true, description: Only used by backtest extra_rules to limit a draft to one repo. } task_type: { type: string, nullable: true } min_changed_lines: { type: integer, minimum: 1, nullable: true } AutonomyGlobSuggestion: type: object required: [glob, kind, files] properties: glob: { type: string } kind: { type: string, enum: [dir, ext] } files: { type: integer } AutonomySuggestions: type: object required: [task_id, workflow_id, repo_id, label, policy_approved, decision_id, diff_available, changed_files, changed_lines, path_globs, task_type, min_changed_lines] properties: task_id: { type: string } workflow_id: { type: string } repo_id: { type: string } label: { type: string, description: The gate the policy approved the task at, else the task's current label. } policy_approved: { type: boolean } decision_id: { type: string, nullable: true } diff_available: { type: boolean } changed_files: { type: integer } changed_lines: { type: integer } path_globs: { type: array, items: { $ref: "#/components/schemas/AutonomyGlobSuggestion" } } task_type: { type: string, nullable: true } min_changed_lines: { type: integer, nullable: true } AutonomyEscape: type: object required: [id, task_id, task_title, source, decision_id, actor, note, rule_id, created_at, counted] properties: id: { type: string } task_id: { type: string } task_title: { type: string } source: { type: string, enum: [undo, should_have_asked, rejected_later, reopened] } decision_id: { type: string, nullable: true } actor: { type: string, nullable: true } note: { type: string, nullable: true } rule_id: { type: string, nullable: true } created_at: { type: string, format: date-time } counted: { type: boolean, description: Still counts toward the step-down threshold. } AutonomyChange: type: object required: [id, workflow_id, label, from_mode, to_mode, actor, reason, created_at] properties: id: { type: string } workflow_id: { type: string } label: { type: string } from_mode: { type: string, enum: [ask, on_flags, auto] } to_mode: { type: string, enum: [ask, on_flags, auto] } actor: { type: string, description: '"policy" for an automatic step-down.' } reason: { type: string } created_at: { type: string, format: date-time } AutonomyHistory: type: object required: [workflow_id, label, current_mode, changes, escapes, step_down] properties: workflow_id: { type: string } label: { type: string } current_mode: { type: string, nullable: true, enum: [ask, on_flags, auto], description: Null when the label no longer exists. } changes: { type: array, items: { $ref: "#/components/schemas/AutonomyChange" } } escapes: { type: array, items: { $ref: "#/components/schemas/AutonomyEscape" } } step_down: type: object required: [escapes_counted, threshold, window_days] properties: escapes_counted: { type: integer } threshold: { type: integer } window_days: { type: integer } AutonomySettings: type: object required: [step_down_escapes, step_down_window_days] properties: step_down_escapes: { type: integer, minimum: 0, maximum: 100, description: Distinct escapes within the window that lower a gate one notch; 0 = never step down. } step_down_window_days: { type: integer, minimum: 1, maximum: 365 } proposal_provider_config_id: type: string nullable: true description: >- Provider config that model-proposed ask rules run on (ADR 0040). Null = proposals are off. On PUT, absent keeps the stored value and null or "" turns proposals off. proposal_interval_hours: type: integer minimum: 0 maximum: 720 description: How often a scheduled proposal run covers each non-ask gate; 0 = only on demand. On PUT, absent keeps the stored value. updated_at: { type: string, format: date-time } RuleProposalEvidence: type: object required: [task_id, title, kind, source] properties: task_id: { type: string } title: { type: string } kind: { type: string, enum: [escape, rejected] } source: { type: string, description: Escape source (undo, should_have_asked, rejected_later, reopened); empty for a rejection. } RuleProposal: type: object description: >- A model-proposed ask rule for one gate (ADR 0040). Inert until accepted; accepting creates a normal ask rule scoped to the gate. The counts are recomputed by the server, not claimed by the model. required: [id, workflow_id, label, repo_id, path_globs, task_type, min_changed_lines, summary, rationale, evidence, caught, evidence_total, cost, clean_approvals, unknown, status, run_id, provider_config_id, accepted_rule_id, decided_by, decided_at, created_at, updated_at] properties: id: { type: string } workflow_id: { type: string } label: { type: string } repo_id: { type: string, nullable: true } path_globs: { type: array, items: { type: string } } task_type: { type: string, nullable: true } min_changed_lines: { type: integer, nullable: true } summary: { type: string } rationale: { type: string, description: The model's one-line reason. Untrusted text. } evidence: { type: array, items: { $ref: "#/components/schemas/RuleProposalEvidence" }, description: The escapes and rejections the rule would have caught. } caught: { type: integer, description: Escapes and rejections in the window the rule would have stopped. } evidence_total: { type: integer, description: Escapes and rejections in the window. } cost: { type: integer, description: Clean policy approvals in the window the rule would also have stopped. } clean_approvals: { type: integer } unknown: { type: integer, description: Tasks whose diff could not be recomputed for a path or size condition. } status: { type: string, enum: [proposed, accepted, dismissed] } run_id: { type: string, nullable: true } provider_config_id: { type: string, nullable: true } accepted_rule_id: { type: string, nullable: true } decided_by: { type: string } decided_at: { type: string, format: date-time, nullable: true } created_at: { type: string, format: date-time } updated_at: { type: string, format: date-time } RuleProposalFlagIdea: type: object required: [idea, rationale] properties: idea: { type: string } rationale: { type: string } RuleProposalRun: type: object required: [id, workflow_id, label, trigger, actor, status, provider_config_id, evidence_count, proposal_count, flag_ideas, error, cost_usd, input_tokens, output_tokens, started_at, finished_at] properties: id: { type: string } workflow_id: { type: string } label: { type: string } trigger: { type: string, enum: [schedule, manual] } actor: { type: string } status: { type: string, enum: [running, succeeded, failed, skipped] } provider_config_id: { type: string, nullable: true } evidence_count: { type: integer } proposal_count: { type: integer, description: Proposals created or refreshed by this run. } flag_ideas: { type: array, items: { $ref: "#/components/schemas/RuleProposalFlagIdea" }, description: Suggested new review-brief checks, for a person to read. Never applied. } error: { type: string, description: Why the run failed or was skipped. } cost_usd: { type: number } input_tokens: { type: integer } output_tokens: { type: integer } started_at: { type: string, format: date-time } finished_at: { type: string, format: date-time, nullable: true } LessonDistillRun: type: object required: [id, repo_id, trigger, actor, status, provider_config_id, evidence_count, proposal_count, error, cost_usd, input_tokens, output_tokens, started_at, finished_at] properties: id: { type: string } repo_id: { type: string } trigger: { type: string, enum: [schedule, manual] } actor: { type: string } status: { type: string, enum: [running, succeeded, failed, skipped] } provider_config_id: { type: string, nullable: true } evidence_count: { type: integer } proposal_count: { type: integer, description: Proposed lessons stored by this run. } error: { type: string, description: Why the run failed or was skipped. } cost_usd: { type: number } input_tokens: { type: integer } output_tokens: { type: integer } started_at: { type: string, format: date-time } finished_at: { type: string, format: date-time, nullable: true } ShouldHaveAskedRequest: type: object properties: rule: { $ref: "#/components/schemas/AskRuleInput" } scope_repo: { type: boolean, description: Limit the rule and lesson to the task's repo. } label_scope: { type: string, enum: [this_gate, all_gates], default: this_gate } send_back_note: { type: string, description: Send the task back through its failure path with this note (not when done). } lesson: type: object required: [body] properties: body: { type: string, maxLength: 300 } kind: { type: string, default: trap } ShouldHaveAskedResponse: type: object required: [escape, rule, lesson, sent_back, step_down, task] properties: escape: { $ref: "#/components/schemas/AutonomyEscape" } rule: { allOf: [{ $ref: "#/components/schemas/AskRule" }], nullable: true } lesson: { allOf: [{ $ref: "#/components/schemas/RepoLesson" }], nullable: true } sent_back: { type: boolean } send_back_error: { type: string } step_down: { allOf: [{ $ref: "#/components/schemas/AutonomyChange" }], nullable: true } task: { $ref: "#/components/schemas/Task" } AutonomyDecision: type: object description: >- A decision recorded when a task landed on a gate. An approve decision carries an outcome (pending until its hold window ends); ask decisions have no outcome. properties: id: { type: string } task_id: { type: string } workflow_id: { type: string } label: { type: string } run_id: { type: string, nullable: true } mode: { type: string, enum: [ask, on_flags, auto] } decision: { type: string, enum: [approve, ask] } reasons: type: array items: { $ref: "#/components/schemas/AutonomyReason" } created_at: { type: string, format: date-time } outcome: type: string nullable: true enum: [pending, approved, held, superseded, skipped, failed, undone, null] hold_seconds: { type: integer, nullable: true } due_at: { type: string, format: date-time, nullable: true } note: { type: string, nullable: true, description: "The Auto-approved note, or skip/failure detail." } outcome_at: { type: string, format: date-time, nullable: true } outcome_actor: { type: string, nullable: true } required: [id, task_id, workflow_id, label, mode, decision, reasons, created_at] AutonomyUndoResponse: type: object required: [task, pr_left_open, message] properties: task: { $ref: "#/components/schemas/Task" } pr_left_open: { type: boolean, description: "True when a pull request had already been opened; undo leaves it as is." } message: { type: string } RiskFlagCode: type: string enum: [migration, auth_or_security, dependencies, tests_removed, ci_config, large_change, outside_plan_scope] description: >- Deterministic, advisory risk flag computed from the task's branch diff. migration - a migrations/ path, a .sql file named like schema, or DDL (CREATE/ALTER/DROP TABLE|INDEX|VIEW|TRIGGER) in a .sql file. auth_or_security - path contains auth, oauth, token, secret, middleware, crypto, password, credential, jwt, csrf, cors, permission, security or session, or a .env* file. dependencies - manifests/lockfiles (go.mod, package.json, requirements*.txt, Cargo.*, ...) or a Dockerfile FROM change. tests_removed - a test file deleted, net test functions removed, or skip/only markers added. ci_config - .github/workflows, .gitea/workflows or .gitlab-ci.yml. large_change - more than 800 changed lines (lockfiles/generated excluded) or more than 25 files. outside_plan_scope - the plan in agent_notes lists files and the diff touches others (skipped when the plan has no file list). RiskFlag: type: object required: [code, reason, files] properties: code: { $ref: "#/components/schemas/RiskFlagCode" } reason: { type: string, description: Human-readable explanation of why the flag fired. } files: type: array items: { type: string } description: Offending files (at most 10); empty for large_change. ReviewBrief: type: object description: >- Deterministic summary shown above the diff when a task is waiting on a human. No LLM is involved; flags are advisory and never approve anything. required: [human_gate, changed, risk_flags, verification, runs, agent_summary, diff_available, truncated, computed_at] properties: human_gate: type: boolean description: Whether the task's label is currently a human gate. changed: type: object required: [files, additions, deletions, top_files] properties: files: { type: integer } additions: { type: integer } deletions: { type: integer } top_files: type: array description: Up to 10 files with the most churn. items: type: object required: [path, status, additions, deletions] properties: path: { type: string } status: { type: string, enum: [added, modified, deleted, renamed] } additions: { type: integer } deletions: { type: integer } risk_flags: type: array items: { $ref: "#/components/schemas/RiskFlag" } verification: nullable: true description: Latest verify-command result; null when none ran. type: object required: [status, command, exit_code, duration_ms, output_tail, truncated, created_at] properties: status: { type: string } command: { type: string } exit_code: { type: integer, nullable: true } duration_ms: { type: integer } output_tail: { type: string, description: Last ~20 lines (at most 2000 chars) of output. } truncated: { type: boolean } created_at: { type: string, format: date-time } runs: type: object required: [total, failed, rework_loops, cost_usd, cost_unknown] properties: total: { type: integer } failed: { type: integer } rework_loops: { type: integer, description: Transitions into a label the task already visited. } cost_usd: { type: number } cost_unknown: { type: boolean, description: True when some run's cost could not be priced. } agent_summary: nullable: true description: >- Latest store_info from a run (first 1500 chars), else the tail of agent_notes; null when both are empty. type: object required: [source, run_id, agent_name, text, truncated] properties: source: { type: string, enum: [stored_info, agent_notes] } run_id: { type: string } agent_name: { type: string } text: { type: string } truncated: { type: boolean } diff_available: type: boolean description: False when the task has no branch or it cannot be resolved. truncated: type: boolean description: The diff exceeded the size limit; numbers are best effort. computed_at: { type: string, format: date-time } ProviderConfig: type: object description: > The provider/model/API-key (env vars) triple, split out of AgentConfig so it can be shared/reused by chat sessions and agent configs alike. properties: id: type: string name: type: string provider: type: string enum: [claude, opencode, qwen_code, codex_cli] description: > The `anthropic` and `llm` (alias `openai`) providers were removed in v0.17.0. POST/PATCH using either returns 400. Legacy rows that still reference them are kept (never deleted) and may be returned by GET/list endpoints as these raw strings; runs of such configs fail at dispatch (the task escalates to waiting_human with a "provider X was removed" message) and GET /health/providers reports an error check `removed_provider_`. model: type: string env: type: string description: > JSON object of environment variables (e.g. API keys) merged into the provider CLI's environment. **Write-only.** Every read (GET/list, and everywhere this schema is embedded — AgentConfig.provider_config, ChatSession's provider_config) returns each key with its value replaced by the literal string `"***"`; key names are preserved, real values are never returned. On write (POST/PUT), a value of `"***"` means "keep the currently stored value for that key"; any other value (including `""`) overwrites it; a key present in the stored env but omitted from the request body's `env` object is deleted. Omitting `env` from the request body entirely (rather than sending an empty object) means "leave env unchanged". This is response redaction only, not encryption — values remain in cleartext in the underlying SQLite database and in `GET /backup` snapshots. created_at: type: string updated_at: type: string required: [id, name, provider, model, env, created_at, updated_at] ChatSession: type: object properties: id: type: string repo_id: type: string provider_config_id: type: string title: type: string provider_session_id: type: string description: Provider-side conversation id, resumed between turns; empty until the first turn completes worktree_path: type: string created_at: type: string updated_at: type: string required: [id, repo_id, provider_config_id, title, provider_session_id, worktree_path, created_at, updated_at] PossibleDuplicate: type: object properties: id: { type: string } title: { type: string } label: { type: string } score: { type: number } required: [id, title, label, score] IntakeAssistantSettings: type: object properties: enabled: { type: boolean } auto_check: { type: boolean, description: Also check tasks created on a parked (agent_ignore) label } provider_config_id: { type: string, nullable: true } required: [enabled, auto_check, provider_config_id] IntakeCheck: type: object properties: task_id: { type: string } status: { type: string, enum: [running, done, failed] } trigger: { type: string, enum: [manual, auto] } verdict: { type: string, enum: ["", ready, needs_detail] } questions: { type: array, items: { type: string }, maxItems: 3 } suggested_type: { type: string } suggested_workflow_id: { type: string } duplicate_ids: { type: array, items: { type: string } } error: { type: string } provider_config_id: { type: string, nullable: true } cost_usd: { type: number } input_tokens: { type: integer } output_tokens: { type: integer } started_at: { type: string, format: date-time } finished_at: { type: string, format: date-time, nullable: true } required: [task_id, status, trigger, verdict, questions, suggested_type, suggested_workflow_id, duplicate_ids, error, cost_usd, input_tokens, output_tokens, started_at] ChangeSetParent: type: object required: [task_id, title, repo_id, label, rolled_up_cost_usd] properties: task_id: { type: string } title: { type: string } repo_id: { type: string } label: { type: string } rolled_up_cost_usd: { type: number, format: double } ChangeSetChild: type: object required: [task_id, title, repo_id, foreign, label, branch, git_state, pr_url, merge_status, verification, changed, auto_merge, merge_position] properties: task_id: { type: string } title: { type: string } repo_id: { type: string } foreign: { type: boolean, description: "In a different repo than the parent." } label: { type: string } branch: { type: string } git_state: { type: string } pr_url: { type: string } merge_status: { type: string } verification: type: string enum: [pass, fail, timeout, error, not_run] changed: nullable: true type: object properties: files: { type: integer } additions: { type: integer } deletions: { type: integer } auto_merge: nullable: true type: object properties: state: { type: string, enum: [waiting, merging] } reason: { type: string } message: { type: string } merge_position: nullable: true type: integer description: 1-based position in the merge order; null when the family has no child-to-child dependency edge. ChangeSet: type: object required: [multi_repo, merge_order, children] properties: multi_repo: { type: boolean } parent: { $ref: "#/components/schemas/ChangeSetParent" } merge_order: type: array items: { type: string } children: type: array items: { $ref: "#/components/schemas/ChangeSetChild" } CreatedChildTask: type: object description: A child created together with its parent by POST /tasks (ADR 0041). required: [id, repo_id, repo_name, title, label] properties: id: { type: string } repo_id: { type: string } repo_name: { type: string } title: { type: string } label: { type: string, description: "The workflow's human-gate (agent_ignore) label the child landed on." } Task: type: object properties: id: { type: string } title: { type: string } description: { type: string } type: { type: string, enum: [feature, bug, chore, spike] } label: { type: string } repo_id: { type: string } workflow_id: { type: string } current_agent_run_id: { type: string, nullable: true } active_agent_run_id: { type: string, nullable: true } agent_notes: { type: string } attachments: type: array items: { type: string } description: > Relative paths of files uploaded with the task (served under /uploads/). Emitted as an array; empty when the task has none. The filename portion is always "", where is derived from the sniffed image MIME type at upload time (.png/.jpg/.gif/.webp) rather than the client-supplied filename's extension. branch: { type: string, description: "Per-task git branch (empty until first dispatch)" } worktree_path: { type: string, description: "Path to the task's git worktree" } base_ref: { type: string, description: "Ref the branch forked from" } paused: { type: boolean, description: "If true, the task is never auto-picked-up by the dispatcher" } archived: type: boolean description: > If true, the task is hidden from the default board view (GET /tasks excludes it unless archived=all|only), skipped by the GitHub PR status sweep, and never picked up by the dispatcher. Independent of the task's label. git_state: { type: string, enum: ["", pushed, pr_open, pr_merged, pr_closed] } pr_url: type: string description: > URL of the GitHub pull request opened for this task's branch (via POST /tasks/{id}/pr, or discovered by the GitHub PR status sweep). Empty until a PR exists. pr_mergeable: type: string enum: ["", mergeable, conflicting, unknown] description: > GitHub's verdict on whether this task's pull request still merges cleanly into its base branch, refreshed by the GitHub PR status sweep (and by GET /tasks/{id}/github-status). Empty until the task has a PR that has been checked; "unknown" while GitHub is still computing the test merge, which it does asynchronously after every push to either branch. When it flips to "conflicting", the sweep also appends a resolve-the-conflict note to the task's current agent run feedback. transient_retry_count: type: integer description: > Number of consecutive automatic retries this task has had for transient provider errors (rate limits, network blips, upstream 5xx). Reset to 0 on a genuine failure or a successful run. next_retry_at: type: string format: date-time nullable: true description: > If set, the task is in a backed-off auto-retry state and will not be picked up by the dispatcher again until this time. source: type: string description: > Where the task was imported from ("github" for the GitHub Issues importer, "gitea" for the Gitea Issues importer against a self-hosted instance, "webhook" for an intake webhook endpoint, "github_pr"/"gitea_pr" for a review-only PR task, whose source_ref is owner/repo#N). Empty for manually created tasks. source_ref: type: string description: > External item the task was imported from, unique within source (e.g. "owner/repo#123"). Empty for manually created tasks. source_state: type: string enum: ["", gone] description: > Reconciliation state set by the importer's sweep. Empty (default) means the source item was present in the last sweep's fetch; 'gone' means it closed or no longer matches the repo's issue_sync_label filter. See GET /tasks/{id}/source-comments and docs/task-sources.md. Never set for manually created tasks. source_state_at: type: string format: date-time nullable: true description: Timestamp of the last source_state change. Null until set. matched_rule_id: type: string nullable: true description: > The intake rule (see IntakeRule, docs/task-sources.md) that matched and shaped this task at creation, if any. Null for manually created tasks and for imported/scheduled tasks that didn't match any enabled rule. Surfaced so "why did this task land here with this label/priority" is answerable from the task itself. matched_rule_name: type: string nullable: true description: > Display name of the intake rule referenced by matched_rule_id, resolved at read time. Only populated on GET /tasks/{id} (not on list responses). Absent/null when matched_rule_id is null or the rule was since deleted. blocked_by_count: type: integer description: > Derived (read-time) count of this task's dependency blockers whose edges are still unsatisfied. A task with any unsatisfied blocker is never picked up by the dispatcher. A blocker is satisfied once it reaches a terminal label or is archived; a blocker that is a subtask must also have landed: in the parent's repo it must be merged back (merge_status merged or merge_conflict); in another repo (ADR 0041) its PR must be open or merged and its latest verify passed. Zero when the task has no unsatisfied blockers. blocking_count: type: integer description: > Derived (read-time) count of tasks that depend on this task (i.e. this task is a blocker for that many other tasks). parent_task_id: type: string nullable: true description: > Parent task id when this task is a subtask (Mechanism 2), else null. A subtask branches off its parent's branch and merges back on terminal; the parent isn't dispatched until every child finishes. created_by_run_id: type: string nullable: true description: The agent run that created this subtask (provenance). merge_status: type: string enum: ["", pending, merged, merge_conflict, pr_open, pr_closed] description: > A subtask's branch merge-back state into its parent's branch. Empty for non-subtasks and until the child reaches a terminal label. For a foreign child (a subtask in a different repo than its parent, ADR 0041) it follows the child's own PR: pending until the PR exists, then pr_open, merged or pr_closed. subtask_total: type: integer description: "Derived: number of this task's direct children (0 if not a parent)." subtask_done: type: integer description: "Derived: children currently on a terminal label." subtask_conflicts: type: integer description: "Derived: children whose merge-back is in conflict." change_set_repo_count: type: integer description: > Derived: distinct repos across a multi-repo parent and its non-archived children (always >= 2), or 0 for every other task. foreign_child: type: boolean description: "Derived: true when this task is a child whose repo differs from its parent's (a change-set member)." rolled_up_cost_usd: type: number format: double description: > Only on GET /tasks/{id}, for a task with children: the task's own cost plus the cost of every child's runs (archived children included). No cap is enforced (ADR 0041). Omitted otherwise. file_scope: type: array items: { type: string } description: > A subtask's declared file globs (repo-relative); empty when unscoped. Used for the sibling overlap guard and a post-run out-of-scope warning. pr_review: type: object nullable: true description: > Source PR state for a review-only PR task (source github_pr or gitea_pr); null for every other task. Such tasks have no Create PR action: they never push or open pull requests. properties: pr_url: { type: string } pr_number: { type: integer } pr_state: { type: string, enum: [open, closed, merged] } head_sha: { type: string, description: "Current head commit of the PR as last seen" } reviewed_sha: { type: string, description: "Head commit covered by the last posted review; empty until one is posted" } review_posted: { type: boolean, description: "A review has been posted on the PR" } last_posted_at: { type: string, format: date-time, nullable: true } stale: { type: boolean, description: "head_sha differs from reviewed_sha (new commits since the review, or none posted yet)" } integration_status: type: string enum: ["", pending, done] description: > A parent's integration state: pending once every subtask finished and merged back (the parent's agent then runs an integration pass), done after that run succeeds. Empty otherwise. max_cost_usd: type: number format: double description: > Advisory per-task cost budget cap in USD, checked by the dispatcher before each sweep-dispatch against the task's cumulative recorded run cost (across every run, any status). 0 disables the cap (unlimited). If the matched agent config also has a nonzero max_cost_usd, the effective budget is the lower of the two. On providers with a mid-run cost watchdog (claude, qwen_code — see AgentConfig.max_cost_usd), this cap is also enforced as a kill switch against an in-flight run, not just the next dispatch. See docs/agents.md#cost-budgets. priority: type: integer enum: [-1, 0, 1, 2] description: > Dispatch priority: -1=low, 0=normal (default), 1=high, 2=urgent. ListAgentPickupTasks orders eligible tasks by priority DESC, then created_at ASC, so higher-priority tasks are dispatched first when there are more eligible tasks than free workers (MAX_WORKERS). queue_position: type: integer nullable: true description: > Derived, read-time 0-based position in the current agent-pickup queue (priority DESC, created_at ASC) among tasks eligible for dispatch, computed only when the worker pool has no free slot (all MAX_WORKERS busy). Null/absent when the task is not currently pickup-eligible (e.g. blocked, paused, archived, or not on an agent-triggerable label) or when the pool has idle capacity and the task would be dispatched immediately. cumulative_cost_usd: type: number format: double description: > Task's lifetime recorded cost across every run regardless of status (matching how the dispatcher's cost-budget guard counts spend). Only populated on GET /tasks/{id}; omitted (0) on list responses. Needed because GET /tasks/{id}/runs is paginated, so a client-side sum over a single page of runs would undercount once a task has more runs than fit on one page. block_reason: allOf: - $ref: '#/components/schemas/BlockReason' nullable: true description: > Derived, read-time explanation of why this task isn't currently being dispatched (see BlockReason). Computed on every GET /tasks and GET /tasks/{id} response by re-evaluating the same predicates the dispatcher itself uses, in the same order, so it never drifts from actual dispatch behavior and never goes stale. Only the FIRST reason the dispatcher would hit is reported — clearing it may simply expose the next one, so this is not an exhaustive list. Absent/null when the task isn't currently a dispatch candidate at all (e.g. archived, already running, or not on an agent-triggerable label), or when it IS a candidate but has no active block (i.e. it's simply next in line — see queue_position, a separate, unrelated concern). active_run_status: type: string enum: [pending, running, waiting_human] description: > Derived, read-time status of the run holding the task's re-dispatch lock (active_agent_run_id). That lock intentionally stays set for waiting_human runs (and for synthetic escalation runs such as cost-cap), so clients use this field to tell an agent that is actually working (pending/running) from a task that needs a human (waiting_human). Computed on GET /tasks and GET /tasks/{id}; absent when the task has no active run. side_effects: type: array items: { $ref: '#/components/schemas/TaskSideEffect' } description: > Outstanding post-transition side effects (branch push, PR creation, source-issue write-back) from the durable outbox: rows that are waiting, being retried after a failure, or failed for good. Populated on GET /tasks and GET /tasks/{id}; always an array, empty when nothing is outstanding or on mutation responses. possible_duplicates: type: array items: { $ref: '#/components/schemas/PossibleDuplicate' } description: > Open, non-archived tasks in the same repo with a similar title/description. Deterministic, computed on read (never stored); populated on GET /tasks/{id} and task create, empty elsewhere. Creation is never blocked by it. intake_verdict: type: string enum: ["", ready, needs_detail] description: > Latest finished intake assistant verdict, empty when none. Advisory; not counted in needs-you. auto_merge: nullable: true type: object description: > Latest auto-merge evaluation of the task's open PR when the repo's auto_merge_mode is when_green. null when it does not apply. properties: state: { type: string, enum: [waiting, merging], description: "waiting = blocked (see reason/message); merging = merge queued" } reason: { type: string, description: "Blocking code, e.g. checks_pending, checks_failed, conflict, changes_requested, draft, always_ask, paused, active_run, no_checks, merge_refused, change_set_order (a predecessor in the change set has not merged yet), change_set_sibling_failed (a sibling PR in the change set is closed or failing); empty when merging" } message: { type: string, description: Human-readable explanation of reason } required: [state, reason, message] merge_order_pending: type: array description: > Change-set predecessors (ADR 0041) whose PR has not merged yet, set only on a foreign child whose own PR is open. Advisory: manual merges are never blocked; the board shows a warning. Always an array, empty when none. items: type: object required: [task_id, title, pr_url] properties: task_id: { type: string } title: { type: string } pr_url: { type: string } source_pending_update: nullable: true allOf: - $ref: '#/components/schemas/TaskSourcePendingUpdate' description: > An edit to the source issue that the sync importer held back because a human had already approved the task (it passed a human gate). Null when none is pending. Apply or discard it via /tasks/{id}/source-update. Populated on GET /tasks and GET /tasks/{id} and the source-update responses. always_ask: { type: boolean, description: "Per-task override: when true the autonomy policy always asks a human at gates (a hard stop). Set via PATCH /tasks/{id}/always-ask." } created_at: { type: string, format: date-time } updated_at: { type: string, format: date-time } required: [id, title, description, type, label, repo_id, workflow_id, created_at, updated_at] TaskSourcePendingUpdate: type: object description: > Issue text held for a human to apply or discard, stored exactly as the importer would have written it to the task. properties: title: { type: string } description: { type: string } type: { type: string } created_at: { type: string, format: date-time, description: When this edit was first held } required: [title, description, type, created_at] TaskSideEffect: type: object description: > One outstanding row of the side-effect outbox. A label transition records the work it owes (pushing the branch, opening a PR, updating the source issue) in the same transaction as the move; a background worker runs it with exponential backoff. Rows are deleted on success, so only unfinished work is listed. A pending row with attempts > 0 and a last_error is "failed, retrying"; status failed means the attempt budget is exhausted and it needs a manual retry. properties: kind: type: string enum: [terminal, create_pr, leave_not_ready, auto_merge, pr_review_post, review_reply, change_set_links] description: > auto_merge = merge the task's PR through the forge (repo auto-merge policy; a forge refusal fails it at once, no retries); terminal = push the branch and tear down the worktree (or merge a subtask back); create_pr = push and open a pull request; leave_not_ready = apply the in-progress signal to the source issue; pr_review_post = post the agent's review on the source pull request (review-only PR tasks; idempotent via a hidden marker in the body). review_reply = reply on the forge review thread of an ingested comment the agent resolved. change_set_links = update the "Part of change set" section in this task's PR body, or post one fallback comment. status: type: string enum: [pending, running, failed] attempts: { type: integer, description: Failed attempts so far } next_at: { type: string, format: date-time, description: When the next attempt is due } last_error: { type: string, nullable: true, description: Error from the most recent failed attempt } required: [kind, status, attempts, next_at] BlockReason: type: object description: > Explains why a pickup-eligible task is not currently being dispatched. Mirrors the non-dispatch paths in the agent dispatcher (see docs/agents.md#dispatch): a task paused, the server's global daily/monthly spend ceiling tripped (halting ALL dispatch, not just this task), its repo at its concurrency limit, no enabled agent config matching its label, every matching config rate-limited, its own cost budget exhausted, the target label's WIP limit full, an unmet dependency, transient-retry backoff, or its label excluded via agent_ignore. properties: code: type: string enum: - paused - cost_budget_global - agent_ignore - dependency - retry_backoff - no_config - repo_concurrency - rate_limited - cost_budget - wip_limit description: > Stable machine-readable reason code. See the "code" list above; evaluated in this exact order, so an earlier code always takes precedence over a later one when several apply simultaneously. cost_budget_global is checked second (right after paused) because — unlike every other code here, which is specific to this task — it applies identically to every dispatch-eligible task at once: see GET /dashboard's global_cost_budget for the underlying daily/monthly spend-ceiling status this mirrors. message: type: string description: Human-readable, already-formatted explanation. clears_at: type: string format: date-time nullable: true description: > When this reason is expected to clear on its own (rate-limit reset, next_retry_at). Null for reasons with no natural expiry (e.g. paused, cost_budget, cost_budget_global, wip_limit) — those require a human/config action to clear. detail: nullable: true description: > Reason-specific structured context (e.g. blocking task ids/ titles for "dependency", where each item may carry waiting_on = merge_back|awaiting_pr|pr_closed|verify_failed for a terminal subtask that has not landed; limit vs. current count for "repo_concurrency"/"wip_limit"; spent vs. budget for "cost_budget"/"cost_budget_global"). Shape varies by code; treat as opaque/optional in generic UI and only key off it for known codes. required: [code, message] DependencyEdge: type: object description: One end of a task dependency edge (a blocker or a dependent). properties: task_id: { type: string, description: "The other task in the edge" } title: { type: string } label: { type: string } archived: { type: boolean } satisfied: type: boolean description: > For a blocker: whether the edge is satisfied (the blocker is terminal or archived; a subtask blocker in the parent's repo must also be merged/merge_conflict; a subtask in another repo (ADR 0041) must have its PR open or merged and its latest verify passed - no verify configured counts as passed). Not meaningful for dependents (always false there). required: [task_id, title, label, archived, satisfied] TaskDependencies: type: object description: Both directions of a task's dependency edges. properties: blocked_by: type: array items: { $ref: '#/components/schemas/DependencyEdge' } description: Tasks this task depends on (its blockers), newest first. blocking: type: array items: { $ref: '#/components/schemas/DependencyEdge' } description: Tasks that depend on this task, newest first. blocked_by_count: { type: integer, description: "Count of unsatisfied blockers" } blocking_count: { type: integer, description: "Count of dependents" } required: [blocked_by, blocking, blocked_by_count, blocking_count] Skill: type: object description: > An Agent Skills folder (SKILL.md with name + description frontmatter, plus optional files) in the provider-neutral skills library. Trusted admin config: only the normal API token can read or write it, never an MCP sidecar scoped token. Enabled skills attached to an agent config or its repo are copied into the run's worktree. properties: id: { type: string } name: { type: string, description: "Unique slug from the SKILL.md frontmatter" } description: { type: string, description: "From the SKILL.md frontmatter" } enabled: { type: boolean } created_at: { type: string, format: date-time } updated_at: { type: string, format: date-time } skill_md: { type: string, description: "SKILL.md contents (GET /skills/{id} only)" } files: { type: array, items: { type: string }, description: "Relative file paths (GET /skills/{id} only)" } agent_config_ids: { type: array, items: { type: string }, description: "Attached agent config ids (GET /skills list only)" } repo_ids: { type: array, items: { type: string }, description: "Attached repo ids (GET /skills list only)" } required: [id, name, description, enabled, created_at, updated_at] SkillIDs: type: object properties: skill_ids: { type: array, items: { type: string } } required: [skill_ids] TaskTemplate: type: object description: > Reusable pre-filled title/description/type for recurring shapes of work (e.g. "upgrade dependency X", "fix flaky test"). Applied in the new-task form; creating a task from a template just pre-fills fields. properties: id: { type: string } name: { type: string, description: "Unique display name" } title: { type: string } description: { type: string } type: { type: string, enum: [feature, bug, chore, spike] } created_at: { type: string, format: date-time } updated_at: { type: string, format: date-time } recipe_id: { type: string, description: "Automation recipe id this object was created by; empty = not from a recipe." } required: [id, name, title, description, type, created_at, updated_at] RepoMapConfig: type: object description: Per-repo repo map opt-in and refresh policy (off by default). properties: enabled: { type: boolean } provider_config_id: { type: [string, "null"] } refresh_interval_hours: { type: integer, description: "Scheduled refresh cadence in hours (default 168); 0 = manual only" } min_commits_behind: { type: integer, description: "A scheduled refresh needs the default branch to be more than this many commits ahead (or the top-level layout to have changed); default 20" } required: [enabled, provider_config_id, refresh_interval_hours, min_commits_behind] RepoMapConfigUpdate: type: object description: Partial update; omitted fields keep their value. properties: enabled: { type: boolean } provider_config_id: { type: string, description: "Empty string clears it" } refresh_interval_hours: { type: integer, minimum: 0, maximum: 8760 } min_commits_behind: { type: integer, minimum: 0, maximum: 100000 } RepoMapPage: type: object properties: slug: { type: string, enum: [overview, layout, build-test-run, key-flows, conventions] } title: { type: string } body: { type: string, description: Markdown, at most 5000 characters } commit_sha: { type: string, description: Commit the page was generated from } required: [slug, title, body, commit_sha] RepoMapRun: type: object properties: id: { type: string } repo_id: { type: string } trigger: { type: string, enum: [schedule, manual] } actor: { type: string } status: { type: string, enum: [running, succeeded, failed, skipped] } commit_sha: { type: string } provider_config_id: { type: [string, "null"] } page_count: { type: integer } char_count: { type: integer } error: { type: string } cost_usd: { type: number } input_tokens: { type: integer } output_tokens: { type: integer } started_at: { type: string, format: date-time } finished_at: { type: [string, "null"], format: date-time } required: [id, repo_id, trigger, actor, status, commit_sha, provider_config_id, page_count, char_count, error, cost_usd, input_tokens, output_tokens, started_at, finished_at] RepoMap: type: object description: A repo's current map (latest successful run) plus staleness. properties: config: { $ref: "#/components/schemas/RepoMapConfig" } pages: { type: array, items: { $ref: "#/components/schemas/RepoMapPage" } } commit_sha: { type: string, description: "Commit the map was generated from; empty when there is no map" } generated_at: { type: [string, "null"], format: date-time } head_sha: { type: string, description: "Current tip of the default branch" } commits_behind: { type: [integer, "null"], description: "Commits the default branch has moved since commit_sha; null when unknown or no map" } layout_changed: { type: boolean, description: "The top-level files/directories differ from commit_sha" } stale: { type: boolean, description: "The scheduled-refresh rule (more than min_commits_behind commits, or layout changed) holds right now" } running: { type: boolean } last_run: { oneOf: [{ $ref: "#/components/schemas/RepoMapRun" }, { type: "null" }] } required: [config, pages, commit_sha, generated_at, head_sha, commits_behind, layout_changed, stale, running, last_run] RepoMapSettings: type: object description: Global repo map injection settings. properties: inject_labels: { type: array, items: { type: string }, description: "Workflow labels whose agent runs get the REPO MAP prompt section (default [plan])" } excluded_agent_ids: { type: array, items: { type: string }, description: "Agent configs that opted out of the section" } required: [inject_labels, excluded_agent_ids] RepoLesson: type: object description: > Short curated lesson injected into agent prompts (REPO LESSONS section). repo_id null means the lesson applies to every repo. Only status=active lessons are injected, filtered by stages (empty = all agents) and path_globs (empty = always; otherwise matched against the files the task branch changed vs base). properties: id: { type: string } repo_id: { type: string, nullable: true } kind: { type: string, enum: [convention, trap, command, decision, preference] } body: { type: string, maxLength: 300 } path_globs: { type: array, items: { type: string } } stages: { type: array, items: { type: string } } citations: { type: array, items: {}, description: "Reserved for citation checks in a later phase." } source: { type: string, enum: [human, agent, distiller] } source_task_id: { type: string, nullable: true } status: { type: string, enum: [proposed, active, stale, retired] } injected_count: { type: integer } created_at: { type: string, format: date-time } updated_at: { type: string, format: date-time } last_checked_at: { type: string, format: date-time, nullable: true } required: [id, repo_id, kind, body, path_globs, stages, citations, source, source_task_id, status, injected_count, created_at, updated_at, last_checked_at] RepoLessonCreate: type: object required: [kind, body] properties: kind: { type: string, enum: [convention, trap, command, decision, preference] } body: { type: string, maxLength: 300 } path_globs: { type: array, items: { type: string } } stages: { type: array, items: { type: string } } citations: { type: array, items: {} } status: { type: string, enum: [proposed, active, stale, retired], default: active } source: { type: string, enum: [human, agent, distiller], default: human } source_task_id: { type: string } RepoLessonUpdate: type: object description: Partial update; omitted fields are kept. repo_id cannot change. properties: kind: { type: string, enum: [convention, trap, command, decision, preference] } body: { type: string, maxLength: 300 } path_globs: { type: array, items: { type: string } } stages: { type: array, items: { type: string } } citations: { type: array, items: {} } status: { type: string, enum: [proposed, active, stale, retired] } source: { type: string, enum: [human, agent, distiller] } source_task_id: { type: string } TaskSchedule: type: object description: > Recurring instantiation of a task_template against a repo on a cron expression. A sweep fires due, enabled schedules and creates a task (source="schedule"), skipping firing while an open task from a prior firing of the same schedule still exists. target_label defaults to the repo workflow's human-gate label — the lowest sort_order agent_ignore label, or the first label if none ("not_ready" in the default workflow) — so a human promotes the created task; setting it to a live agent label instead makes the schedule fully unattended — pair with a cost budget on the template's agent config as a safety net. properties: id: { type: string } template_id: { type: string } repo_id: { type: string } cron_expr: { type: string, description: "Standard 5-field cron: minute hour day-of-month month day-of-week" } target_label: { type: string, description: "Label the created task starts on. Empty defaults to the repo workflow's human-gate label (lowest sort_order agent_ignore label, else the first label; 'not_ready' in the default workflow)." } enabled: { type: boolean } last_run_at: { type: string, format: date-time, nullable: true } created_at: { type: string, format: date-time } updated_at: { type: string, format: date-time } recipe_id: { type: string, description: "Automation recipe id this object was created by; empty = not from a recipe." } required: [id, template_id, repo_id, cron_expr, target_label, enabled, last_run_at, created_at, updated_at] IntakeRule: type: object description: > A match->apply intake routing rule, evaluated first-match-wins (by sort_order) at task-creation time for the 'issue' (issue import) and 'schedule' sources (see internal/intake and docs/task-sources.md). Subsumes the deprecated per-repo issue_sync_label filter, which narrowed only the fetch; rules shape the resulting task (template, priority, target label, workflow, cost budget) after fetch/creation. Every match_* field left empty/absent matches "any"; every apply_* field left empty/absent means "leave the caller's default". Landing a task on a non-agent_ignore apply_target_label bypasses the human-review gate that protects against untrusted imported issue content, so it is only permitted when match_author_assoc is restricted to OWNER/MEMBER/COLLABORATOR — the API rejects a rule that doesn't satisfy this with 400 Bad Request. properties: id: { type: string } name: { type: string } enabled: { type: boolean } sort_order: { type: integer, description: "Lower sorts first; first-match-wins evaluation order among enabled rules." } match_source: { type: string, enum: ['', manual, issue, schedule, webhook, subtask], description: "Empty = any. Only 'issue', 'schedule' and 'webhook' are currently evaluated by any code path." } match_repo_id: { type: string, nullable: true, description: "Null = any repo." } match_labels: { type: array, items: { type: string }, description: "ANY-of, case-insensitive. Empty = any." } match_title_pattern: { type: string, description: "Go regexp (unanchored substring search unless anchored). Empty = any." } match_body_pattern: { type: string, description: "Go regexp. Empty = any." } match_author_assoc: { type: array, items: { type: string, enum: [OWNER, MEMBER, COLLABORATOR, CONTRIBUTOR, NONE] }, description: "ANY-of. Empty = any. Required (restricted to OWNER/MEMBER/COLLABORATOR) when apply_target_label is not the workflow's human-gate label." } apply_template_id: { type: string, nullable: true, description: "Template supplies type and prepends its description; the issue/schedule's own title always wins." } apply_priority: { type: integer, nullable: true, description: "-1 (low), 0 (normal), 1 (high), or 2 (urgent). Null = leave default." } apply_target_label: { type: string, description: "Empty = leave default (the workflow's human-gate label)." } apply_workflow_id: { type: string, nullable: true, description: "Overrides the repo's default workflow for this task. Null = use the repo's own workflow." } apply_max_cost_usd: { type: number, format: double, nullable: true, description: "Null = leave default (no per-task override)." } stop_processing: { type: boolean, description: "Reserved; first-match-wins is the only evaluation mode in v1." } recipe_id: { type: string, description: "Automation recipe id this rule was created by; empty = not from a recipe." } created_at: { type: string, format: date-time } updated_at: { type: string, format: date-time } required: [id, name, enabled, sort_order, match_source, match_labels, match_title_pattern, match_body_pattern, match_author_assoc, apply_target_label, stop_processing, created_at, updated_at] AutomationRecipeParam: type: object properties: key: { type: string } label: { type: string } kind: { type: string, enum: [repo, workflow, label, cron, string] } required: { type: boolean } default: { type: string } help: { type: string } required: [key, label, kind, required, default, help] AutomationRecipe: type: object properties: id: { type: string } version: { type: integer } name: { type: string } description: { type: string } kind: { type: string, enum: [webhook, schedule] } default_cron: { type: string } params: { type: array, items: { $ref: "#/components/schemas/AutomationRecipeParam" } } template: type: object properties: name: { type: string } title: { type: string } description: { type: string } type: { type: string } required: [name, title, description, type] installed: { type: boolean } objects: type: object properties: template_id: { type: string, nullable: true } schedule_id: { type: string, nullable: true } endpoint_id: { type: string, nullable: true } rule_id: { type: string, nullable: true } repo_id: { type: string, nullable: true } required: [template_id, schedule_id, endpoint_id, rule_id, repo_id] required: [id, version, name, description, kind, params, template, installed, objects] AutomationRecipeInstallRequest: type: object properties: params: type: object additionalProperties: { type: string } description: "Keyed by the recipe's param keys (repo_id, workflow_id, target_label, cron_expr, branch)." confirm_auto_start: type: boolean description: "Required when target_label is a non-human-gate label (tasks start agents without review)." required: [params] AutomationRecipeInstallResult: type: object properties: recipe: { type: string } template: { $ref: "#/components/schemas/TaskTemplate" } schedule: { $ref: "#/components/schemas/TaskSchedule" } endpoint: { $ref: "#/components/schemas/IntakeEndpoint" } rule: { $ref: "#/components/schemas/IntakeRule" } url: { type: string, description: "Full intake URL (webhook recipes)." } secret: { type: string, description: "HMAC secret, shown once (webhook recipes)." } snippet: { type: string, description: "Paste-ready sender snippet (webhook recipes). Never contains the secret." } target_label: { type: string, description: "Label created tasks start on ('' for webhook recipes = the workflow's human-gate label)." } warnings: { type: array, items: { type: string } } required: [recipe, template, target_label, warnings] IntakeEndpoint: type: object description: > A signed inbound webhook endpoint that creates tasks (see docs/task-sources.md). The HMAC secret is never included here; it is returned only by create and rotate-secret. properties: id: { type: string } name: { type: string } repo_id: { type: string } workflow_id: { type: string, nullable: true, description: "Null = the repo's workflow." } target_label: { type: string, description: "Empty = the workflow's human-gate label. A non-gate label starts tasks without human review." } enabled: { type: boolean } title_template: { type: string } description_template: { type: string, description: "Empty = the payload pretty-printed as JSON." } dedupe_key_template: { type: string, description: "Empty = never dedupe." } last_received_at: { type: string, format: date-time, nullable: true } created_at: { type: string, format: date-time } updated_at: { type: string, format: date-time } secret_set: { type: boolean } url_path: { type: string, example: "/api/v1/intake/" } recipe_id: { type: string, description: "Automation recipe id this object was created by; empty = not from a recipe." } required: [id, name, repo_id, workflow_id, target_label, enabled, title_template, description_template, dedupe_key_template, last_received_at, created_at, updated_at, secret_set, url_path] IntakeEndpointCreated: allOf: - $ref: "#/components/schemas/IntakeEndpoint" - type: object properties: secret: { type: string, description: "HMAC secret. Shown only once." } required: [secret] IntakeEndpointBody: type: object properties: name: { type: string } repo_id: { type: string } workflow_id: { type: string, nullable: true } target_label: { type: string } enabled: { type: boolean, description: "Default true." } title_template: { type: string, maxLength: 4096 } description_template: { type: string, maxLength: 4096 } dedupe_key_template: { type: string, maxLength: 4096 } required: [name, repo_id, title_template] IntakeEndpointTestRequest: type: object description: Sample payload plus optional unsaved template overrides. properties: payload: { type: object, additionalProperties: true } title_template: { type: string } description_template: { type: string } dedupe_key_template: { type: string } required: [payload] IntakeEndpointTestResponse: type: object properties: title: { type: string } description: { type: string } dedupe_key: { type: string } label: { type: string } workflow_id: { type: string } priority: { type: integer } matched_rule_id: { type: string, nullable: true } existing_task_id: { type: string, nullable: true, description: "Open task a real delivery would append a comment to." } required: [title, description, dedupe_key, label, workflow_id, priority, matched_rule_id, existing_task_id] BackupSettings: type: object description: > DB-backed settings for the automatic local-backup scheduler (see docs/backup.md). Changes take effect on the scheduler's next scheduled run without a restart. Whether the scheduler is enabled at all remains a deploy-time-only choice (BACKUP_DIR). properties: interval_seconds: { type: integer, description: "How often to write a new snapshot, in seconds. Minimum 600 (10 minutes). Default 86400 (once a day)." } keep: { type: integer, description: "Number of most-recent snapshots to retain before pruning older ones. Minimum 1. Default 7." } updated_at: { type: string, format: date-time } required: [interval_seconds, keep, updated_at] LogRetentionSettings: type: object description: > DB-backed settings for the automatic agent-log retention pruner (see docs/backup.md#agent-log-retention). It deletes agent_logs rows belonging to runs in a terminal status (completed/failed/ waiting_human) whose completed_at is older than `days` days ago. Changes take effect on the pruner's next scheduled run without a restart. Unlike backup, there is no separate deploy-time enable gate — days=0 fully disables cleanup via this settings row alone. properties: days: { type: integer, description: "Delete terminal-run logs older than this many days. 0 disables cleanup (logs are kept forever). Minimum 0. Default 30 on fresh installs (existing installs keep their stored value)." } interval_seconds: { type: integer, description: "How often the pruner checks for logs to delete, in seconds. Minimum 60 (1 minute). Default 3600 (once an hour)." } updated_at: { type: string, format: date-time } required: [days, interval_seconds, updated_at] CostWarningSettings: type: object description: > DB-backed global threshold for the mid-run cost early-warning event (see docs/agents.md#cost-budgets, internal/agent/providers/ cost_watchdog.go, and migration 050_cost_warning). warn_ratio is the fraction of a task's effective cost budget (max_cost_usd) at which a task.cost_warning WebSocket event fires — both from the provider-side mid-run watchdog (claude, qwen_code) and from the dispatcher's pre-dispatch check (all providers) — ahead of the hard kill/exhaustion at 1.0. Read fresh on every relevant check, so a change here takes effect on the very next dispatch/run without a restart. properties: warn_ratio: { type: number, format: double, description: "Fraction of the effective cost budget at which to warn. Must be greater than 0 and at most 1. Default 0.8 (80%)." } updated_at: { type: string, format: date-time } required: [warn_ratio, updated_at] ModelPricing: type: object description: > One user-editable USD-per-1M-token pricing row (see 042_model_pricing and internal/agent/providers/pricing.go's DBPriceResolver), used to estimate codex_cli run costs and to drive the claude/qwen_code mid-run cost watchdog. A model with no row here falls back to an internal, approximate hardcoded table; a model matching neither has its cost flagged unknown (AgentRun.cost_unknown) instead of being silently reported as free. Read fresh on every run completion, so an edit here takes effect on the very next run without a restart. properties: model: { type: string, description: "Model ID, matched exactly first, then by longest-prefix (e.g. a row for \"claude-sonnet-4-5\" also prices \"claude-sonnet-4-5-20260101\")." } input_per_1m: { type: number, format: double, description: "USD price per 1M input/prompt tokens. Must be >= 0." } output_per_1m: { type: number, format: double, description: "USD price per 1M output/completion tokens. Must be >= 0." } cached_input_per_1m: type: number format: double nullable: true description: "USD price per 1M cached (prompt-cache hit) input tokens. Used for codex_cli runs, which report cached tokens as part of their input tokens, and for claude/qwen_code's cache_read_input_tokens (reported as a separate counter, additional to input tokens). null bills cached tokens at input_per_1m. Must be >= 0." cache_write_input_per_1m: type: number format: double nullable: true description: "USD price per 1M cache-write (prompt-cache creation) input tokens — claude/qwen_code's cache_creation_input_tokens, billed at a premium over the input rate for writing a prompt prefix into the cache for the first time. Only meaningful for claude/qwen_code; codex_cli reports no cache-write counter. null bills cache-write tokens at input_per_1m. Must be >= 0." updated_at: { type: string, format: date-time } required: [model, input_per_1m, output_per_1m, cached_input_per_1m, cache_write_input_per_1m, updated_at] WorkflowLabel: type: object properties: id: { type: string } workflow_id: { type: string } name: { type: string } display_name: { type: string, maxLength: 64, description: "Optional human-readable title shown in the UI (column headers, chips). Empty/absent = UI derives one from name (separators to spaces, sentence case). name stays the API/URL identifier." } color: { type: string, pattern: "^#[0-9a-fA-F]{3,8}$", description: "Hex color (#rgb/#rrggbb/#rrggbbaa) used by the UI, including the dashboard's factory visualization. Empty string is allowed (falls back to a UI default); anything else that isn't a hex literal is rejected with 400 on write." } sort_order: { type: integer } agent_ignore: { type: integer } is_terminal: { type: integer } create_pr: { type: integer, description: "When non-zero, a task entering this label auto-opens a GitHub PR (pushes the branch first)." } wip_limit: { type: integer, nullable: true, description: "Max tasks allowed in this label column; null = unlimited (soft/visual by default)." } wip_limit_hard: { type: integer, description: "When non-zero, the dispatcher stops picking up tasks whose success target is this label once it is at its wip_limit (backpressure)." } verify_mode: type: string enum: [inherit, custom, disabled] description: > Per-label override of the repo's verify_command, applied to the label a task is on when its run signals success. inherit (the default) uses the repo command; custom runs verify_command below instead; disabled skips verification on this label. The repo's verify_timeout_seconds applies in every mode. Set via the workflow YAML (verify_mode / verify_command) or the labels array of PUT /workflows/{id}. verify_command: { type: string, description: "The label's own command; only meaningful (and required) when verify_mode is custom, else empty." } pr_feedback_label: { type: string, description: "Label ghsync moves a task to when it ingests PR feedback (failing check, merge conflict, changes-requested review or inline comment) and the repo has pr_review_auto_transition_enabled. Empty = the failure human transition (default). Must be a non-terminal, non-agent_ignore label of the same workflow with a human/both transition from this label; else 400. Set via YAML or the labels array of PUT /workflows/{id}." } autonomy: allOf: - $ref: "#/components/schemas/LabelAutonomy" nullable: true description: > Per-gate autonomy policy; null when the mode is ask (the default). Only human-gate labels may have a non-ask mode (every transition out of it human-triggered, at least one, not agent_ignore or terminal). Written via the labels array of PUT /workflows/{id} or the YAML autonomy block (mode, ask_on, hold such as 10m, max_cost_usd). This release only records shadow decisions; nothing is approved automatically. Invalid mode, unknown ask_on code, autonomy on a non-gate label, a missing mode or a negative hold/cost give 400. required: [id, workflow_id, name, color, sort_order, agent_ignore, is_terminal, create_pr, wip_limit_hard, verify_mode, verify_command] WorkflowTransition: type: object properties: id: { type: string } workflow_id: { type: string } from_label: { type: string } to_label: { type: string } trigger_type: { type: string, enum: [agent, human, both] } agent_config_id: { type: string, nullable: true } path: type: string enum: [success, failure, either] nullable: true description: > For an agent transition, which run outcome takes this edge: success, failure, or either (the default when unset/null). required: [id, workflow_id, from_label, to_label, trigger_type] Workflow: type: object properties: id: { type: string } name: { type: string } description: { type: string } labels: { type: array, items: { $ref: "#/components/schemas/WorkflowLabel" } } transitions: { type: array, items: { $ref: "#/components/schemas/WorkflowTransition" } } created_at: { type: string, format: date-time } updated_at: { type: string, format: date-time } is_default: { type: boolean, description: 'True for the board default workflow: the one named "Default", else the alphabetically-first workflow other than the seeded "PR review" workflow. Exactly one workflow is default when any exist.' } required: [id, name, description, labels, transitions, created_at, updated_at] AgentConfigSnapshot: type: object description: "Behaviour-relevant fields of an agent config at one version. name, labels, enabled and priority are not versioned." properties: system_prompt: { type: string } provider_config_id: { type: string } fallback_provider_config_ids: { type: array, items: { type: string } } escalation_ladder: { type: array, items: { $ref: "#/components/schemas/EscalationRung" } } effort: { type: string } permission_mode: { type: string } max_turns: { type: integer } max_tokens: { type: integer } timeout_secs: { type: integer } max_cost_usd: { type: number, format: double } max_retries: { type: integer } retry_backoff_secs: { type: integer } resume_sessions: { type: boolean } subtasks_enabled: { type: boolean } cross_repo_subtasks_enabled: { type: boolean } review_fanout_enabled: { type: boolean } review_fanout_min_lines: { type: integer } review_fanout_min_files: { type: integer } max_subtasks: { type: integer } enabled_plugins: { type: array, items: { type: string } } enabled_mcp_servers: { type: array, items: { type: string } } command_allowlist: { type: array, items: { type: string } } command_denylist: { type: array, items: { type: string } } AgentConfigVersion: type: object required: [id, agent_config_id, version, snapshot, created_at] properties: id: { type: string } agent_config_id: { type: string } version: { type: integer, description: "1-based, increasing per agent config." } snapshot: { $ref: "#/components/schemas/AgentConfigSnapshot" } actor_id: { type: string, nullable: true } note: { type: string, nullable: true } created_at: { type: string, format: date-time } AgentExperimentArmStats: type: object required: [tasks, tasks_done, first_pass_success_rate_percent, rework_rate_percent, human_touch_rate_percent, avg_cost_to_done_usd, avg_duration_secs, not_enough_data] properties: tasks: { type: integer, description: "Assigned, non-archived tasks." } tasks_done: { type: integer, description: "Assigned tasks whose current label is terminal." } first_pass_success_rate_percent: { type: number, format: double, description: "Of done tasks, share where the agent had exactly one run and it completed." } rework_rate_percent: { type: number, format: double, description: "Of done tasks, share with a transition into an already-visited label." } human_touch_rate_percent: { type: number, format: double, description: "Of done tasks, share with any human-triggered transition." } avg_cost_to_done_usd: { type: number, format: double, description: "Mean total cost of all runs on each done task." } avg_duration_secs: { type: number, format: double, description: "Mean duration of the agent's finished runs in this arm." } not_enough_data: { type: boolean, description: "True when tasks_done is below min_tasks_per_arm." } AgentExperimentResults: type: object required: [control, candidate, min_tasks_per_arm] properties: control: { $ref: "#/components/schemas/AgentExperimentArmStats" } candidate: { $ref: "#/components/schemas/AgentExperimentArmStats" } min_tasks_per_arm: { type: integer } AgentExperiment: type: object required: [id, agent_config_id, candidate_snapshot, share_percent, status, started_at] properties: id: { type: string } agent_config_id: { type: string } candidate_snapshot: { $ref: "#/components/schemas/AgentConfigSnapshot" } base_version: { type: integer, nullable: true, description: "Latest version when the experiment started (informational)." } share_percent: { type: integer, minimum: 1, maximum: 90 } status: { type: string, enum: [running, stopped, promoted] } note: { type: string, nullable: true } actor_id: { type: string, nullable: true } promoted_version: { type: integer, nullable: true } started_at: { type: string, format: date-time } stopped_at: { type: string, format: date-time, nullable: true } results: { $ref: "#/components/schemas/AgentExperimentResults" } AgentExperimentStart: type: object required: [candidate, share_percent] properties: candidate: { $ref: "#/components/schemas/AgentConfigSnapshot" } share_percent: { type: integer, minimum: 1, maximum: 90, description: "Percent of newly arriving tasks assigned to the candidate arm." } note: { type: string } AgentExperimentPromoteResponse: type: object required: [experiment, config] properties: experiment: { $ref: "#/components/schemas/AgentExperiment" } config: { $ref: "#/components/schemas/AgentConfig" } RunningExperimentSummary: type: object required: [id, share_percent, started_at, control_tasks, candidate_tasks] properties: id: { type: string } share_percent: { type: integer } started_at: { type: string, format: date-time } note: { type: string, nullable: true } control_tasks: { type: integer } candidate_tasks: { type: integer } EscalationRung: type: object required: [provider_config_id] properties: provider_config_id: { type: string, description: "Existing provider config used on this rung." } effort: type: string enum: ["", low, medium, high, xhigh, max] description: "Effort for this rung; empty inherits the agent config's effort." fallback_provider_config_ids: type: array items: { type: string } description: "Tried after the rung provider when it is rate-limited or paused, before the agent's own provider list." AgentConfig: type: object properties: current_version: { type: integer, nullable: true, description: "Latest version number in the config's version history (null when it has none yet). Create/update bodies accept an optional `note` recorded on the new version." } running_experiment: nullable: true allOf: [{ $ref: "#/components/schemas/RunningExperimentSummary" }] description: "Summary of the running A/B experiment; populated on GET /agents/{id} only (null otherwise)." id: { type: string } name: { type: string } provider_config_id: type: string description: > References a ProviderConfig (provider/model/env), which is created and managed separately via /provider-configs and may be shared with other agent configs or chat sessions. provider_config: allOf: - $ref: '#/components/schemas/ProviderConfig' readOnly: true description: > The resolved provider config for provider_config_id, embedded on responses for convenience so clients don't need a second fetch. Absent from request bodies. Its `env` values are redacted (see ProviderConfig.env) — this embed never carries real secret values. fallback_provider_config_ids: type: array items: { type: string } description: > Ordered fallback providers, tried after provider_config_id when an earlier one's account is rate-limited (or its provider is paused). Each must be an existing provider config, distinct, and not the primary. Optional on write: omitted on create means none; omitted on update keeps the stored list (minus a fallback promoted to primary). Runs record which one they used in AgentRun.provider_config_id. escalation_ladder: type: array items: { $ref: "#/components/schemas/EscalationRung" } description: > Escalate on failure. Rung 0 is implicit (this config's own provider_config_id/effort); entry i is rung i+1. At dispatch the rung is the number of failed attempts on this agent's stage (consecutive failures plus review/test bounce-backs into the label), capped at the last rung; it resets when the stage is freshly entered or a human acts. Max 10 rungs. Rate-limit fallbacks still apply on top. Optional on write: omitted on create means none; omitted on update keeps the stored ladder. Runs record the rung in AgentRun.ladder_rung. enabled: type: boolean description: > Whether the dispatcher considers this config for its labels. Sent as a boolean on responses (the stored 0/1 is normalized); accepted as boolean or 0/1 on write. Absent from create request bodies (new configs start enabled unless a label conflict disables them). system_prompt: { type: string } labels: { type: string, description: "JSON array of label names" } max_tokens: { type: integer } timeout_secs: { type: integer } max_turns: { type: integer } priority: type: integer description: > Dispatch failover order among configs sharing a label: lower is tried first; ties broken by newest created_at. At dispatch the first non-rate-limited match wins, so a higher-priority-value config acts as a backup when the primary is rate-limit/usage-blocked. Default 0. max_retries: type: integer description: > Number of automatic consecutive retries allowed for a task after a transient provider error (rate limit, network blip, upstream 5xx) before it is left failed / escalated to waiting_human for a human to intervene. 0 disables auto-retry. Default 3. retry_backoff_secs: type: integer description: > Base backoff, in seconds, before a transient-error retry becomes eligible for re-dispatch. Exponential backoff (base * 2^attempt, capped at 10 minutes) is applied on top of this base. Default 30. resume_sessions: type: boolean description: > Whether new runs for a task resume the previous run's provider session (claude provider only; other providers ignore it). On by default. Off means every run starts cold — useful for stages that should look at the work with fresh eyes (e.g. agent review). subtasks_enabled: type: boolean description: > Whether this config's runs may decompose their task into subtasks via the create_subtask MCP tool (claude/qwen_code only). Off by default — a deliberate capability granted to a specific agent (the planner). cross_repo_subtasks_enabled: type: boolean description: > Off by default; also requires subtasks_enabled. Lets create_subtask target another configured repo via repo_id (ADR 0041); each such child lands via its own pull request. review_fanout_enabled: type: boolean description: > Off by default. For the config that handles the agent-review stage: when a review run's diff reaches review_fanout_min_lines changed lines or review_fanout_min_files changed files, the pool runs four focused reviewer passes (correctness, security, tests, conventions) and aggregates them into one pass/fail decision. Smaller diffs use the single reviewer. review_fanout_min_lines: type: integer minimum: 0 description: "Changed-line threshold for review fan-out (default 400; 0 ignores this criterion)." review_fanout_min_files: type: integer minimum: 0 description: "Changed-file threshold for review fan-out (default 15; 0 ignores this criterion)." max_subtasks: type: integer description: "Per-parent cap on children this config may create. Default 10." enabled_plugins: type: string description: > JSON array of Claude plugin IDs ("@") enabled for this agent config. Claude-provider only; defaults to "[]" (all plugins off). enabled_mcp_servers: type: string description: > JSON array of Claude user-level MCP server names (from ~/.claude.json's global mcpServers) enabled for this agent config. Claude-provider only; defaults to "[]" (all MCP servers off). command_allowlist: type: string description: > JSON array of shell-command glob patterns ("*" wildcard). If non-empty, only commands matching at least one pattern may run via run_bash/Bash. Fully enforced for qwen_code. NOT an effective restriction for claude (the CLI only auto-approves matches; non-matching commands still run — see docs/providers/claude.md). Mapped to opencode's permission.bash config (allow-listed patterns plus a catch-all deny default) via OPENCODE_CONFIG_CONTENT; opencode's pattern-matching semantics have not been verified live. Not enforced for codex_cli. Defaults to "[]" (no restriction). command_denylist: type: string description: > JSON array of shell-command glob patterns ("*" wildcard). Commands matching any pattern here are always denied, regardless of command_allowlist. Checked first. Fully enforced for claude. Mapped to opencode's permission.bash config as "deny" entries via OPENCODE_CONFIG_CONTENT (opencode's pattern-matching semantics have not been verified live). NOT enforced for qwen_code (no confirmed CLI denylist flag) or codex_cli. Defaults to "[]" (no restriction). max_cost_usd: type: number format: double description: > Advisory per-task cost budget cap in USD, checked by the dispatcher before each sweep-dispatch against the task's cumulative recorded run cost so far (across every run for the task, any status). 0 disables the cap (unlimited). Default 0. If the task itself also has a nonzero max_cost_usd, the effective budget is the lower of the two. Providers with a mid-run cost watchdog (claude, always; qwen_code, when the configured model is priced) additionally enforce this as a kill switch: they project cost from incremental token usage as the run progresses and cancel an in-flight run that crosses the cap, escalating to waiting_human — this projection is an *estimate* via the pricing table, not the provider's own authoritative billed cost. Other providers (codex_cli, opencode) only block the *next* dispatch once the budget is already exhausted. See docs/agents.md#cost-budgets. effort: type: string enum: ["", low, medium, high, xhigh, max] description: > Optional reasoning effort level. Empty string (default) leaves the provider's own default effort in place. Passed as claude's --effort flag (accepts exactly low/medium/high/xhigh/max — an unrecognized model or an organization-side restriction can make the CLI silently ignore it) and mapped to codex_cli's model_reasoning_effort config override (xhigh/max clamp down to high, since codex has no higher tier). Also passed through unchanged to opencode's `opencode run --variant` flag (no fixed vendor enum to clamp against there, so the value is forwarded as-is and may be silently ignored or rejected by the underlying model provider). Ignored by qwen_code. See docs/agents.md#effort. permission_mode: type: string enum: ["", default, auto, acceptEdits, bypassPermissions] description: > Optional Claude CLI permission mode for headless task runs. Empty string (default) omits the --permission-mode flag entirely, leaving the claude CLI's own default ("auto" — a cloud safety classifier) in place, matching pre-existing behavior. "default" requires interactive approval for every tool call (impractical for headless runs unless a hook auto-approves). "auto" explicitly selects the same classifier as the CLI default, which can transiently deny safe commands when the classifier is unavailable. "acceptEdits" auto-approves file edits but still gates other tools. "bypassPermissions" skips approval prompts entirely for this run. Claude-provider only; other providers ignore it (codex_cli and qwen_code always run in their own always-bypass modes regardless of this field). permission_mode does not affect command_denylist enforcement — permissions.deny is honored even under bypassPermissions (verified empirically). See docs/agents.md#permission-mode and docs/providers/claude.md. created_at: { type: string, format: date-time } updated_at: { type: string, format: date-time } required: - id - name - provider_config_id - enabled - system_prompt - labels - max_tokens - timeout_secs - max_turns - priority - max_retries - retry_backoff_secs - max_cost_usd - effort - permission_mode - created_at - updated_at ModelList: type: object properties: provider: { type: string } default_model: { type: string } models: { type: array, items: { type: string } } required: [provider, default_model, models] ClaudeOptions: type: object description: > Claude plugins and user-level MCP servers discovered on the server's Claude home directory (~/.claude/plugins/installed_plugins.json and the global mcpServers key in ~/.claude.json), for per-agent-config selection. properties: plugins: type: array items: type: object properties: id: { type: string, description: "\"@\"" } name: { type: string } marketplace: { type: string } required: [id, name, marketplace] mcp_servers: type: array items: { type: string } required: [plugins, mcp_servers] Repo: type: object properties: id: { type: string } name: { type: string } path: { type: string } remote_url: { type: string, nullable: true } workflow_id: { type: string, nullable: true } issue_sync_enabled: type: boolean description: > true = open GitHub issues matching issue_sync_label are periodically imported as tasks (requires remote_url and workflow_id). false = off. issue_sync_label: type: string deprecated: true description: > DEPRECATED — narrows the issue-import fetch to issues carrying this label (empty = all open issues fetched). Prefer an IntakeRule (see /intake-rules) with a match_labels condition, which additionally lets you shape (template/priority/target label/cost) the resulting task, not just filter which issues are fetched. Still honoured for one more release: it continues to control which issues are FETCHED, while any matching rule continues to control how the fetched issue is SHAPED — the two layer, they don't compete. See docs/task-sources.md. issue_writeback_enabled: type: boolean description: > true = status write-back to the source GitHub issue is enabled for this repo's imported tasks (requires remote_url; independent of issue_sync_enabled): comments on the issue when a task's PR opens, applies the issue_writeback_label (or the "agent-in-progress" default) when a task first leaves the workflow's human-gate label ("not_ready" in the default workflow), and closes the issue with a comment when the PR merges. false = off. See docs/task-sources.md. issue_writeback_label: type: string description: > Label applied to the source GitHub issue when a task first leaves the workflow's human-gate label. Empty (the default) falls back to "agent-in-progress". The label must already exist on the GitHub repo, or the write-back silently no-ops. See docs/task-sources.md. pr_review_auto_transition_enabled: type: boolean description: > true = when ghsync ingests new GitHub PR review/GHA feedback for one of this repo's tasks (a changes_requested review, a new inline review comment, or a failed check), the task is automatically transitioned along its workflow's "failure" human path (the same target as a manual Reject), so it lands back in front of an agent without a human having to click Reject. Requires remote_url. false = off (feedback is still ingested and surfaced in the prompt; a human must transition the task manually). See docs/task-sources.md. pr_review_enabled: type: boolean description: > Opt-in review-only PR path (default false; requires remote_url). true = pull requests opened by people (or other tools) on this repo get an agent review posted back on the PR as a comment-type review (never an approval or a blocking request-changes). One review task per PR; new commits re-run the review on the same task. See docs/task-sources.md "Review any PR". pr_review_author_assocs: type: array items: { type: string, enum: [OWNER, MEMBER, COLLABORATOR, CONTRIBUTOR, FIRST_TIME_CONTRIBUTOR, FIRST_TIMER, NONE] } description: > Author-association allowlist for PR review (default OWNER, MEMBER, COLLABORATOR). A PR whose author association is not listed (or unknown) is never reviewed. pr_review_label: type: string description: Only review PRs carrying this forge label (case-insensitive). Empty = no label filter. pr_review_skip_drafts: type: boolean description: Skip draft / work-in-progress PRs (default true). pr_review_workflow_id: type: string nullable: true description: Workflow the review tasks are created on. null = the seeded "PR review" workflow. pr_review_target_label: type: string description: > Label review tasks start on. Must be a non-terminal, non-agent_ignore label of pr_review_workflow_id (400 otherwise). Empty = the workflow's first such label ("pr-review" in the seeded workflow). review_reply_enabled: type: boolean description: > true = when an agent resolves a review comment ingested from the forge (resolve_comment), reply on that comment's review thread with the resolution text and pushed short SHA, once the branch is pushed. Default false. Gitea has no thread-reply API, so the reply is a PR conversation comment. See docs/task-sources.md. review_reply_resolve_enabled: type: boolean description: > true = also mark the thread resolved after replying (GitHub only; ignored on Gitea). Requires review_reply_enabled. Default false. issue_sync_update_policy: type: string enum: [gate, always, never] description: > Conflict policy for propagating upstream title/body/label drift (and, when issue_comment_sync_enabled is on, comment ingestion) to an already-imported task. 'gate' (default; empty string is treated the same as 'gate') applies updates only while the task is still on its workflow's human-gate label; 'always' applies them regardless of label; 'never' detects drift but never writes it to the task. See docs/task-sources.md. issue_sync_gone_action: type: string enum: [flag, archive, move] description: > What the importer's reconciliation sweep does when a previously imported issue closes or stops matching issue_sync_label. 'flag' (default; empty string is treated the same as 'flag') only sets the task's source_state; 'archive' also archives the task; 'move' also transitions it to issue_sync_gone_label. A task with an active agent run is only ever flagged, regardless of this setting, and is re-evaluated on the next sweep. See docs/task-sources.md. issue_sync_gone_label: type: string description: > Target label for issue_sync_gone_action 'move'. Required (rejected with 400) when issue_sync_gone_action is 'move'. issue_comment_sync_enabled: type: boolean description: > true = ingest the source GitHub issue's comment thread (write-access authors only: OWNER/MEMBER/COLLABORATOR; this system's own write-back comments are filtered out) into task_source_comments and pass it to the agent prompt as clearly delimited untrusted context. Follows the same issue_sync_update_policy gate as field updates. false = off (default). clone_status: type: string enum: [ready, cloning, error] description: > State of the repo's initial auto-clone. 'ready' for local repos and finished clones; 'cloning' while an async git clone is in progress (POST /repos returns immediately with this status); 'error' if the clone failed (see clone_error). Watch the repo.clone_done / repo.clone_failed WebSocket events for transitions out of 'cloning'. clone_error: type: string description: Human-readable failure detail when clone_status is 'error'. max_concurrent_runs: type: integer nullable: true description: > Optional cap on the number of agent runs the dispatcher will keep in flight against this repo at once. null (the default) means "no repo-specific cap" — the dispatcher falls back to the server's global MAX_WORKERS limit, preserving pre-existing behavior. A repo saturated with eligible tasks is skipped by the dispatcher once its in-flight run count reaches this limit (or the global fallback), leaving worker slots free for other repos. See GET /dashboard's repo_concurrency for live in-use vs. limit. runtime_languages: type: string description: > Serialized JSON array of this repo's agent toolchain pins (see RuntimeLanguagePin) — stored and returned as a JSON string, not a structured array, matching the DB column. Empty string (the default) means unconfigured: tasks on this repo spawn their agent CLI exactly as they did before this feature existed. When non-empty, the dispatcher runs `mise install` for every pin before invoking the provider and wraps the CLI command with `mise x`; a python pin instead gets a per-worktree virtualenv on PATH. Prep failure escalates the task to waiting_human — it never falls back to a plain spawn. See docs/runtime.md. verify_command: type: string description: > Shell command (run with `sh -c` in the task's worktree, as the unprivileged agent user, with the repo's runtime pins applied) that independently verifies an agent's claimed success. Empty (the default) disables verification. When set it is authoritative: a run that signals success only takes the success transition if the command exits 0; otherwise the failure transition fires (or the task keeps its label) and the capped output is fed to the next run as a `VERIFICATION FAILED:` section. See RunVerification and docs/workflows.md. verify_timeout_seconds: type: integer description: Timeout for verify_command in seconds (1-3600, default 600). preview_command: type: string description: > Shell command that starts the app's dev server in the task's worktree (run as the agent user, `$PORT` is a free port, bind 127.0.0.1). Empty (the default) disables preview screenshots. See docs/workflows.md#preview-screenshots. preview_routes: type: string description: Newline-separated paths to screenshot (each starts with /, at most 20). preview_paths_glob: type: string description: > Newline-separated globs deciding when a diff counts as a UI change. Empty = frontend/**, web/**, src/**/*.{tsx,jsx,vue,svelte,css}. auto_merge_mode: type: string enum: [off, when_green] description: > Opt-in auto-merge policy (default off). when_green: ATE merges a task's PR once all checks pass, it is not a draft or conflicting, has no unresolved changes-requested review and the task has no live run, is not paused and not always_ask. See docs/workflows.md. auto_merge_method: type: string enum: [squash, merge, rebase] description: Merge method used by auto-merge (default squash). created_at: { type: string, format: date-time } required: [id, name, path, created_at] RunVerification: type: object description: > The result of a repo's verify_command for one agent run that signalled success. At most one per run. properties: run_id: { type: string } task_id: { type: string } command: { type: string, description: The command that was run (snapshot of repo.verify_command). } status: type: string enum: [pass, fail, timeout, error] description: > pass = exit 0; fail = non-zero exit; timeout = exceeded verify_timeout_seconds; error = the command could not be run (the task is escalated to waiting_human). exit_code: { type: integer, nullable: true, description: Null unless the process exited on its own. } output: { type: string, description: "Tail of the combined stdout and stderr, capped at 16 KiB." } truncated: { type: boolean, description: True when earlier output was dropped from output. } head_sha: { type: string, description: "Worktree HEAD commit the verification ran against (empty if unknown)." } reused_from_run_id: { type: string, nullable: true, description: "Set when this pass was reused from an earlier run's pass on the same commit and command; the command was not re-run." } duration_ms: { type: integer } created_at: { type: string, format: date-time } required: [run_id, task_id, command, status, exit_code, output, truncated, duration_ms, head_sha, reused_from_run_id, created_at] TaskPreviewImage: type: object properties: id: { type: string } route: { type: string } variant: { type: string, enum: [after, before], description: "Only after is produced today." } width: { type: integer } height: { type: integer } url: { type: string, description: "Served by GET /uploads/{task_id}/{filename}." } required: [id, route, variant, width, height, url] TaskPreviewCapture: type: object description: One preview screenshot capture for a task. properties: id: { type: string } status: { type: string, enum: [running, ok, failed] } error: { type: string, description: "Short failure reason; for status ok it lists routes that failed (partial success)." } created_at: { type: string, format: date-time } finished_at: { type: string, format: date-time, nullable: true } images: type: array items: { $ref: "#/components/schemas/TaskPreviewImage" } required: [id, status, error, created_at, finished_at, images] RuntimeLanguagePin: type: object description: > One toolchain pin in a repo's runtime_languages array (the wire shape used by POST /repos, PATCH /repos/{id}, and the runtime/detect suggestions — the DB column itself stores this array serialized to JSON text). properties: id: type: string enum: [go, node, python, rust, ruby, java, godot] version: type: string description: > A mise-installable version string, e.g. "1.21", "22", "3.12". Validated server-side against ^[A-Za-z0-9][A-Za-z0-9._-]{0,31}$ (no "@", no spaces, no leading "-") since it becomes an argv element passed to mise/uv subprocesses. required: [id, version] ReviewComment: type: object description: >- A persistent, file/line-anchored inline review comment on a task's diff. Open comments are injected into every agent run's prompt until resolved (by an agent via the MCP resolve_comment tool, or by a human). properties: id: { type: string } task_id: { type: string } file_path: { type: string } side: { type: string, enum: [old, new] } start_line: { type: integer } end_line: { type: integer } quoted_text: { type: string } body: { type: string } status: { type: string, enum: [open, resolved] } resolution_note: { type: string, nullable: true } resolved_by_run_id: { type: string, nullable: true, description: "Run that resolved it; null when human-resolved" } created_at: { type: string, format: date-time } updated_at: { type: string, format: date-time } external_id: type: string nullable: true description: > The originating forge's review-comment id when source is not 'local' (used to dedup re-sweeps); null for locally-created comments. source: type: string enum: [local, github, gitea] description: > 'local' for comments left in-app; 'github'/'gitea' for comments ingested from a PR/MR review on that forge (see internal/ghsync, internal/forge). All flow through the same OPEN REVIEW COMMENTS prompt section and resolve loop. required: [id, task_id, file_path, side, start_line, end_line, quoted_text, body, status, created_at, updated_at] TaskSourceComment: type: object description: >- One comment ingested from the comment thread of the external item (e.g. GitHub issue) a task was imported from. Append-only and deduped by (task_id, external_id). Only ingested from authors with write access to the repo (OWNER/MEMBER/COLLABORATOR), with this system's own write-back comments filtered out; passed to the agent prompt as explicitly delimited untrusted content. See docs/task-sources.md. properties: id: { type: string } task_id: { type: string } external_id: { type: string, description: "GitHub comment id (used to dedup re-sweeps)" } author: { type: string } body: { type: string } external_created_at: { type: string, description: "RFC3339 timestamp as reported by the source" } created_at: { type: string, format: date-time, description: "When this row was ingested" } required: [id, task_id, external_id, author, body, external_created_at, created_at] TaskHumanDecision: type: object description: >- A human reply to a waiting_human run, shown to later runs under HUMAN DECISIONS ON THIS TASK. Only replied rows are returned. properties: run_id: { type: string } label: { type: string } escalation_reason: { type: string } question: { type: string } reply: { type: string, nullable: true } replied_at: { type: string, format: date-time, nullable: true } asked_at: { type: string, format: date-time } agent_name: { type: string, description: "Empty when the agent config was deleted" } required: [run_id, label, escalation_reason, question, reply, replied_at, asked_at, agent_name] AgentRun: type: object properties: id: { type: string } task_id: { type: string } agent_config_id: { type: string, nullable: true, description: "Agent config that ran this task; set NULL if that config is later deleted." } provider_config_id: { type: string, nullable: true, description: "Provider config the run used (the agent config's primary or one of its fallbacks); null for runs from before provider fallbacks." } ladder_rung: { type: integer, nullable: true, description: "Escalation ladder rung the run used (0 = the agent config's own provider/effort); null when the agent config had no ladder." } agent_config_version: { type: integer, nullable: true, description: "Agent config version the run was dispatched with; null for runs from before version history." } experiment_id: { type: string, nullable: true, description: "A/B experiment the run belonged to; null when none." } experiment_arm: { type: string, nullable: true, enum: [control, candidate], description: "Experiment arm; candidate runs have a null agent_config_version until the experiment is promoted." } status: { type: string, enum: [pending, running, completed, failed, waiting_human, cancelled, interrupted] } feedback: { type: string, nullable: true } stored_info: { type: string, nullable: true, description: "Free-form info the agent stored for this run (via the MCP store_info tool); null when none." } notes: { type: string, nullable: true, description: "Human/agent notes attached to the run; null when none." } escalation_reason: type: string nullable: true enum: [agent_question, auth_required, repeated_failure, rework_loop, cost_budget, cost_unknown, provider_missing, runtime_prep, max_turns, transient_exhausted, no_outcome, rejected_transition, verify_error] description: >- Why the run ended in waiting_human; null for runs in any other status and for waiting_human runs that predate this field. The human-readable explanation is in notes (or feedback for agent_question). agent_question = the agent called request_human; auth_required = provider CLI not logged in; repeated_failure = consecutive failures hit the cap; rework_loop = the same rework transition fired repeatedly; cost_budget / cost_unknown = task cost budget exhausted / unenforceable; provider_missing = the agent config's provider is disabled or unknown; runtime_prep = toolchain install failed; verify_error = the verify command could not be run; max_turns = turn cap hit; transient_exhausted = transient-retry budget exhausted; no_outcome = finished without a usable outcome; rejected_transition = requested move refused repeatedly. started_at: { type: string, format: date-time, nullable: true } completed_at: { type: string, format: date-time, nullable: true } created_at: { type: string, format: date-time } input_tokens: type: integer description: >- Total input/prompt tokens consumed across the run (summed across all turns of a multi-turn agentic loop). output_tokens: type: integer description: Total output/completion tokens consumed across the run. cost_usd: type: number format: double description: >- USD cost of the run. For the `claude`/`qwen_code`/`opencode` providers this is the CLI's own authoritative reported cost (which may legitimately be 0, e.g. under a Claude Max subscription); for the codex_cli provider it is *estimated* by computing input/output tokens against the user-editable pricing table (see GET/PUT /settings/pricing), falling back to an internal, approximate pricing table for models with no matching row. 0 if unknown/unreported — see cost_unknown to distinguish that from a genuinely free run. For a claude run that resumed an earlier session it is that run's own share: the CLI's session total minus session_cost_usd of the session's previous run. session_cost_usd: type: number format: double nullable: true description: >- The provider's own cumulative cost for the run's whole session, as reported when the run ended (claude only; it includes earlier runs resumed into the same session). Null when not reported. Used as the baseline for the next resumed run's cost_usd; sum cost_usd, not this, for spend totals. cost_unknown: type: integer description: >- 1 if tokens were consumed but no price entry (user-edited or hardcoded fallback) matched the model, so cost_usd was left at 0 as a placeholder rather than a computed figure — add a row for this model at /settings/pricing to get a real estimate. Only applies to the codex_cli estimation path described under cost_usd. 0 otherwise, including for claude/qwen_code/opencode (which never set this; their cost_usd, including a legitimate 0 under a Claude Max subscription, is always authoritative). session_id: type: string description: >- Provider-side conversation session recorded for this run (the claude/qwen CLI stream-json session_id). A later run on the same task under the same agent config resumes it (claude provider only, unless the config's resume_sessions is off). Empty for providers/runs without a session. turns_used: type: integer description: >- Number of internal agent turns the run actually consumed, for comparison against the agent config's configured `max_turns` cap. 0 means "not reported" for providers that expose a real count from the CLI itself (`claude`/`qwen_code`, from the CLI stream-json result event's `num_turns`). `codex_cli` and `opencode` instead have the runner count completed tool steps / `step_finish` events as a proxy for turns, so a genuine 0 there means the run ended before completing a single step rather than "not reported". required: [id, task_id, agent_config_id, status, created_at] TaskLabelHistory: type: object description: >- One row of a task's label-transition audit trail (task_label_history), oldest first. properties: id: { type: string } task_id: { type: string } from_label: { type: string, nullable: true } to_label: { type: string } trigger: { type: string, enum: [agent, human, subtasks_complete] } actor_id: type: string nullable: true description: >- For human-triggered transitions, the resolved named-token actor (see BearerAuth / API_TOKENS) — null/empty when the legacy shared API_TOKEN or no auth was used. For agent-triggered transitions, the agent run ID. note: { type: string, nullable: true } created_at: { type: string, format: date-time } required: [id, task_id, from_label, to_label, trigger, actor_id, note, created_at] AgentLog: type: object properties: id: { type: string } agent_run_id: { type: string } timestamp: { type: string, format: date-time } type: { type: string, enum: [stdout, stderr, system, tool_call, tool_result] } content: { type: string } seq: { type: integer, format: int64, description: "Monotonic per-entry sequence; tiebreak for entries with the same (second-resolution) timestamp." } required: [id, agent_run_id, timestamp, type, content] Dashboard: type: object properties: label_counts: type: object additionalProperties: { type: integer } description: Non-archived task counts by label name, summed across all workflows. workflow_label_counts: type: object description: > The same non-archived counts broken out per workflow: workflow id -> label name -> count. Use this when more than one workflow exists, since label names can repeat across workflows. additionalProperties: type: object additionalProperties: { type: integer } active_agents: type: array items: type: object properties: run_id: { type: string } task_id: { type: string } task_title: { type: string } agent_name: { type: string } started_at: { type: string } required: [run_id, task_id, task_title, agent_name, started_at] intervention_queue: type: array items: type: object properties: run_id: { type: string } task_id: { type: string } task_title: { type: string } task_label: { type: string, description: "The task's current label." } workflow_id: { type: string, description: "The task's workflow; used to check which human transitions exist from task_label." } message: { type: string, nullable: true } created_at: { type: string } required: [run_id, task_id, task_title, task_label, workflow_id, message, created_at] cost_total: type: object description: >- Aggregate token/cost usage across all runs in a terminal state (completed, failed, waiting_human). properties: input_tokens: { type: integer } output_tokens: { type: integer } cost_usd: { type: number, format: double } required: [input_tokens, output_tokens, cost_usd] cost_by_provider: type: array description: >- Per-provider breakdown of token/cost usage, sorted by cost descending. Runs whose agent_config was later deleted are excluded (agent_config_id is set NULL on delete, so they can no longer be attributed to a provider). items: type: object properties: provider: { type: string } input_tokens: { type: integer } output_tokens: { type: integer } cost_usd: { type: number, format: double } run_count: { type: integer } required: [provider, input_tokens, output_tokens, cost_usd, run_count] agent_config_stats: type: array description: >- Per-agent-config run analytics, sorted by run_count descending. Only runs in a terminal status (completed/failed/waiting_human) with a still-existing agent_config are included, same filtering as cost_by_provider. Two caveats: (1) avg_runs_per_task is a proportional split — each done task contributes 1.0 "task credit" divided across every config that ran on it, weighted by that config's share of the task's total runs — while the retry fields are still attributed entirely to a task's *last* run's agent config; (2) avg_transient_retries and tasks_with_retries are a live snapshot of tasks.transient_retry_count, which resets to 0 on success or escalation to a human — not a lifetime/historical retry count. items: type: object properties: agent_config_id: { type: string } agent_name: { type: string } provider: { type: string } run_count: { type: integer } completed_count: { type: integer } failed_count: { type: integer } waiting_human_count: { type: integer } success_rate_percent: { type: number, format: double } avg_duration_secs: { type: number, format: double } p90_duration_secs: { type: number, format: double } avg_turns_used: type: number format: double description: >- Mean internal agent turns per run, averaged only over runs that actually reported a count (see AgentRun.turns_used); 0 when no run under this config reported one. Compare against max_turns to tune the cap. p90_turns_used: type: number format: double description: >- 90th-percentile turns per run, over the same reported-count-only set as avg_turns_used. max_turns: type: integer description: >- The agent config's currently-configured max_turns cap, returned alongside the used-turn aggregates. This is a live value — not necessarily the cap in force when the historical runs above executed. avg_runs_per_task: { type: number, format: double } avg_transient_retries: { type: number, format: double } tasks_with_retries: { type: integer } input_tokens: { type: integer } output_tokens: { type: integer } cost_usd: { type: number, format: double } required: - group_key - low_sample - agent_config_id - agent_name - provider - run_count - completed_count - failed_count - waiting_human_count - success_rate_percent - avg_duration_secs - p90_duration_secs - avg_turns_used - p90_turns_used - max_turns - avg_runs_per_task - avg_transient_retries - tasks_with_retries - input_tokens - output_tokens - cost_usd cost_by_day: type: array description: >- Daily token/cost/run-count rollup, most recent day first, capped at the last 30 days with recorded activity. Same terminal-status filtering as cost_total. items: type: object properties: day: { type: string, description: "ISO date (YYYY-MM-DD)" } input_tokens: { type: integer } output_tokens: { type: integer } cost_usd: { type: number, format: double } run_count: { type: integer } required: [day, input_tokens, output_tokens, cost_usd, run_count] cost_by_task: type: array description: >- Top 20 tasks by cumulative recorded cost. Unlike cost_total / cost_by_provider / agent_config_stats, this includes runs in EVERY status (not just terminal ones) — a cost rollup should reflect every run that ran, including ones still in flight or that failed, matching the same filtering the dispatcher's cost-budget guard uses (see docs/agents.md#cost-budgets). items: type: object properties: task_id: { type: string } task_title: { type: string } input_tokens: { type: integer } output_tokens: { type: integer } cost_usd: { type: number, format: double } required: [task_id, task_title, input_tokens, output_tokens, cost_usd] cost_by_repo: type: array description: >- Per-repo token/cost rollup, sorted by cost descending -- the companion to cost_by_task for answering "which repo is expensive" before setting a per-repo repos.max_concurrent_runs limit. Like cost_by_task, includes runs in EVERY status (not just terminal ones), joined through tasks since agent_runs has no repo_id of its own. items: type: object properties: repo_id: { type: string } repo_name: { type: string } input_tokens: { type: integer } output_tokens: { type: integer } cost_usd: { type: number, format: double } run_count: { type: integer } required: [repo_id, repo_name, input_tokens, output_tokens, cost_usd, run_count] claude_usage: type: object description: >- Live Claude account rate-limit usage from Anthropic's OAuth usage endpoint (5-hour rolling window + weekly window). `available` is false when the server has no Claude OAuth credentials or the fetch failed; other fields are zero/absent in that case. properties: available: { type: boolean } rate_limited: type: boolean description: >- True when `available` is false because Anthropic's usage endpoint itself returned 429. The server caches this result longer than a normal failure to back off from the already-rate-limited endpoint. five_hour_percent: { type: number, format: double } five_hour_resets_at: { type: string, format: date-time, nullable: true } weekly_percent: { type: number, format: double } weekly_resets_at: { type: string, format: date-time, nullable: true } required: [available, five_hour_percent, weekly_percent] repo_concurrency: type: array description: >- Per-repo worker-slot breakdown: how many of a repo's effective concurrency limit (its max_concurrent_runs if set, else the server's global MAX_WORKERS) are currently occupied by in-flight agent runs. Only repos with at least one in-flight run are included, sorted by in_use descending. items: type: object properties: repo_id: { type: string } repo_name: { type: string } in_use: { type: integer } limit: { type: integer } required: [repo_id, repo_name, in_use, limit] global_cost_budget: type: object nullable: true description: >- The server's global daily/monthly spend-ceiling status (see MAX_DAILY_COST_USD/MAX_MONTHLY_COST_USD), plus a simple "projected spend at current burn" forecast per configured period (trailing 7-day mean extrapolated linearly to the end of the day/month -- deliberately unsophisticated; the value is "am I on track to blow through this", not an accurate prediction). Omitted entirely when neither MAX_DAILY_COST_USD nor MAX_MONTHLY_COST_USD is configured. When tripped, the dispatcher halts all new dispatch (in-flight runs are left to finish) until spend for the tripped period drops back under its cap on the next calendar day/month -- see each task's block_reason, which reports cost_budget_global while this is tripped. properties: daily_limit_usd: { type: number, format: double } monthly_limit_usd: { type: number, format: double } daily_spent_usd: { type: number, format: double } monthly_spent_usd: { type: number, format: double } tripped: { type: boolean } tripped_reason: type: string enum: [daily, monthly] description: Which cap tripped first. Absent when tripped is false. daily_forecast_usd: type: number format: double description: >- Projected total spend for today (already-recorded spend plus the trailing burn rate extrapolated to end of day). Present only when daily_limit_usd > 0. monthly_forecast_usd: type: number format: double description: >- Projected total spend for this calendar month. Present only when monthly_limit_usd > 0. required: - daily_limit_usd - monthly_limit_usd - daily_spent_usd - monthly_spent_usd - tripped today: type: object description: >- Activity since local midnight in the server's timezone (window is [midnight, next midnight)). Feeds the control-room Today panel. properties: done_count: { type: integer, description: "Distinct non-archived tasks that entered a terminal (is_terminal) label today, counted from task label history. A task that reached done more than once today counts once." } verify_total: { type: integer, description: "Verification results recorded today (run_verifications rows; same source as the task.verification WS event)." } verify_passed: { type: integer, description: "How many of verify_total have status pass. The client computes the pass rate." } runs_started: { type: integer, description: "Agent runs whose started_at is today." } required: [done_count, verify_total, verify_passed, runs_started] required: - label_counts - workflow_label_counts - active_agents - intervention_queue - cost_total - cost_by_provider - agent_config_stats - cost_by_day - cost_by_task - cost_by_repo - claude_usage - repo_concurrency - today OutcomeQuality: type: object description: >- Per-agent-config outcome-quality analytics: did the work stick, not just did the run exit cleanly. See [docs/api.md#dashboard](../docs/api.md#dashboard) for full metric definitions, attribution rules, and caveats. properties: group_by: { type: string, enum: [config, version, provider_config, repo, task_type], description: "Dimension the rows are broken down by." } configs: type: array items: type: object description: >- One row per agent config still present in the database. Every rate is reported alongside its own sample-size denominator (the *_n / runs_finished fields) and a low_sample_* flag (sample size below 10) so a small sample doesn't masquerade as a confident number. tasks_done (and every rate derived from it) attributes a whole task to the agent config of that task's *last* run - the same last-run attribution convention already used by Dashboard.agent_config_stats - except rework_rate_percent's numerator, which is attributed to whichever run most recently preceded the backward transition (the config that caused the bounce-back), not necessarily the config that finished the task. "Terminal" means the task's current label has workflow_labels.is_terminal set. properties: agent_config_id: { type: string } group_key: { type: string, description: "Unique row id (config id + dimension value)." } group_value: { type: string, description: "Display label of the dimension value (v3, unversioned, provider config name, repo name, task type); absent for group_by=config." } version: { type: integer, nullable: true } provider_config_id: { type: string } repo_id: { type: string } task_type: { type: string } low_sample: { type: boolean, description: "true when tasks_done is below 5." } agent_name: { type: string } provider: { type: string } tasks_done: type: integer description: >- Number of tasks whose last run was under this config and which reached a terminal label. Shared denominator for avg_cost_to_done_usd, rework_rate_percent, human_touch_rate_percent, and avg_review_comments. avg_cost_to_done_usd: type: number format: double description: >- Average, across tasks_done tasks, of the total recorded cost_usd across ALL of that task's runs (including failed and mid-flight ones) until it reached a terminal label - same "every run counts" rationale as Dashboard.cost_by_task. rework_rate_percent: type: number format: double description: >- Percentage of tasks_done tasks that moved back into a label they had already occupied at least once (a "rework" event) before reaching a terminal label, attributed to the config whose run preceded the bounce-back. rework_n: { type: integer, description: "Denominator for rework_rate_percent (== tasks_done)." } low_sample_rework: { type: boolean, description: "true when rework_n is below 10." } human_touch_rate_percent: type: number format: double description: >- Percentage of tasks_done tasks whose label history includes at least one human-triggered transition (the task needed a human to move it along its workflow at some point, not just approve the final step). human_touch_n: { type: integer, description: "Denominator for human_touch_rate_percent (== tasks_done)." } low_sample_human_touch: { type: boolean, description: "true when human_touch_n is below 10." } avg_review_comments: type: number format: double description: >- Average number of task_review_comments (open and resolved) received per tasks_done task - review burden. runs_finished: type: integer description: >- Number of this config's runs that reached a terminal run status (completed or waiting_human) - denominator for escalation_rate_percent. A run-level, not task-level, count - independent of tasks_done. escalation_rate_percent: type: number format: double description: >- Percentage of runs_finished runs that ended waiting_human rather than completed. low_sample_escalation: { type: boolean, description: "true when runs_finished is below 10." } ladder_rungs: type: array description: >- Present only for configs whose runs carry a ladder_rung. Per finishing rung (the rung of the config's last laddered run on each terminal task): tasks finished and average total task cost. Independent of the last-run attribution of tasks_done. items: type: object required: [rung, tasks_done, avg_cost_to_done_usd] properties: rung: { type: integer } tasks_done: { type: integer } avg_cost_to_done_usd: { type: number, format: double } required: - agent_config_id - agent_name - provider - tasks_done - avg_cost_to_done_usd - rework_rate_percent - rework_n - low_sample_rework - human_touch_rate_percent - human_touch_n - low_sample_human_touch - avg_review_comments - runs_finished - escalation_rate_percent - low_sample_escalation required: [configs] ProviderCheck: type: object description: A single provider/onboarding readiness row. properties: id: type: string description: Stable identifier (e.g. claude_cli, mcp_sidecar, gh_auth). name: type: string description: Human-readable check name. status: type: string enum: [ok, warn, error] description: > ok = ready (green); warn = optional/degraded or heuristically undetected (yellow); error = required item missing, runs will fail (red). detail: type: string description: One-line description of the current state. hint: type: string description: How to fix it; present when status is not ok. required: [id, name, status, detail] PausedProvider: type: object description: > A provider kind whose dispatch is paused by the provider circuit breaker after an auth-classified run. properties: provider: type: string description: Provider kind, matching provider_configs.provider (e.g. claude). reason: type: string description: Human-readable cause. paused_at: type: string format: date-time required: [provider, reason, paused_at] Error: type: object properties: error: { type: string } required: [error] # --------------------------------------------------------------------- # WebSocket events (GET /ws). Not REST responses: these schemas are the # source of truth for the server-pushed event stream. WsEvent is the # discriminated union of every event envelope {type, payload}; the Go # payload structs in backend/internal/wsevent and the frontend's WSEvent # type (frontend/src/api/ws.ts) are both pinned to it (a Go test fails on # drift; the TS type is generated). See docs/websocket.md. # --------------------------------------------------------------------- WsEvent: description: >- Envelope of every message the server pushes on the /ws socket (and the locally synthesised `resync` after a reconnect). Discriminated by `type`. oneOf: - $ref: "#/components/schemas/WsTaskLabelChangedEvent" - $ref: "#/components/schemas/WsTaskUpdatedEvent" - $ref: "#/components/schemas/WsTaskSideEffectEvent" - $ref: "#/components/schemas/WsTaskAgentStartedEvent" - $ref: "#/components/schemas/WsTaskAgentDoneEvent" - $ref: "#/components/schemas/WsTaskNeedsHumanEvent" - $ref: "#/components/schemas/WsTaskCostWarningEvent" - $ref: "#/components/schemas/WsSystemCostBudgetTrippedEvent" - $ref: "#/components/schemas/WsTaskReviewCommentsChangedEvent" - $ref: "#/components/schemas/WsTaskVerificationEvent" - $ref: "#/components/schemas/WsTaskPreviewEvent" - $ref: "#/components/schemas/WsTaskRateLimitedEvent" - $ref: "#/components/schemas/WsProviderPauseChangedEvent" - $ref: "#/components/schemas/WsTaskGitStateChangedEvent" - $ref: "#/components/schemas/WsTaskPrMergeableChangedEvent" - $ref: "#/components/schemas/WsTaskReviewCommentAddedEvent" - $ref: "#/components/schemas/WsTaskSubtaskConflictEvent" - $ref: "#/components/schemas/WsTaskSourceCommentAddedEvent" - $ref: "#/components/schemas/WsTaskCreatedEvent" - $ref: "#/components/schemas/WsTaskCreatedBulkEvent" - $ref: "#/components/schemas/WsRepoCloneDoneEvent" - $ref: "#/components/schemas/WsRepoCloneFailedEvent" - $ref: "#/components/schemas/WsAgentLogEvent" - $ref: "#/components/schemas/WsAgentLogReplayEvent" - $ref: "#/components/schemas/WsTaskAutonomyPendingEvent" - $ref: "#/components/schemas/WsTaskAutonomyHeldEvent" - $ref: "#/components/schemas/WsTaskAutonomyApprovedEvent" - $ref: "#/components/schemas/WsTaskAutonomyUndoneEvent" - $ref: "#/components/schemas/WsTaskAutonomyAskedEvent" - $ref: "#/components/schemas/WsAutonomySteppedDownEvent" - $ref: "#/components/schemas/WsResyncEvent" discriminator: propertyName: type mapping: task.label_changed: "#/components/schemas/WsTaskLabelChangedEvent" task.updated: "#/components/schemas/WsTaskUpdatedEvent" task.side_effect: "#/components/schemas/WsTaskSideEffectEvent" task.agent_started: "#/components/schemas/WsTaskAgentStartedEvent" task.agent_done: "#/components/schemas/WsTaskAgentDoneEvent" task.needs_human: "#/components/schemas/WsTaskNeedsHumanEvent" task.cost_warning: "#/components/schemas/WsTaskCostWarningEvent" system.cost_budget_tripped: "#/components/schemas/WsSystemCostBudgetTrippedEvent" task.review_comments_changed: "#/components/schemas/WsTaskReviewCommentsChangedEvent" task.verification: "#/components/schemas/WsTaskVerificationEvent" task.preview: "#/components/schemas/WsTaskPreviewEvent" task.rate_limited: "#/components/schemas/WsTaskRateLimitedEvent" provider.pause_changed: "#/components/schemas/WsProviderPauseChangedEvent" task.git_state_changed: "#/components/schemas/WsTaskGitStateChangedEvent" task.pr_mergeable_changed: "#/components/schemas/WsTaskPrMergeableChangedEvent" task.review_comment_added: "#/components/schemas/WsTaskReviewCommentAddedEvent" task.subtask_conflict: "#/components/schemas/WsTaskSubtaskConflictEvent" task.source_comment_added: "#/components/schemas/WsTaskSourceCommentAddedEvent" task.created: "#/components/schemas/WsTaskCreatedEvent" task.created_bulk: "#/components/schemas/WsTaskCreatedBulkEvent" repo.clone_done: "#/components/schemas/WsRepoCloneDoneEvent" repo.clone_failed: "#/components/schemas/WsRepoCloneFailedEvent" agent.log: "#/components/schemas/WsAgentLogEvent" agent.log_replay: "#/components/schemas/WsAgentLogReplayEvent" task.autonomy_pending: "#/components/schemas/WsTaskAutonomyPendingEvent" task.autonomy_held: "#/components/schemas/WsTaskAutonomyHeldEvent" task.autonomy_approved: "#/components/schemas/WsTaskAutonomyApprovedEvent" task.autonomy_undone: "#/components/schemas/WsTaskAutonomyUndoneEvent" task.autonomy_asked: "#/components/schemas/WsTaskAutonomyAskedEvent" autonomy.stepped_down: "#/components/schemas/WsAutonomySteppedDownEvent" resync: "#/components/schemas/WsResyncEvent" WsTaskLabelChangedEvent: type: object properties: type: { type: string, enum: [task.label_changed] } payload: { $ref: "#/components/schemas/WsTaskLabelChangedPayload" } required: [type, payload] WsTaskLabelChangedPayload: type: object description: A task moved to a new label. properties: task_id: { type: string } from: { type: string } to: { type: string } note: { type: string, description: "Transition note; empty string when none." } required: [task_id, from, to, note] WsTaskUpdatedEvent: type: object properties: type: { type: string, enum: [task.updated] } payload: { $ref: "#/components/schemas/WsTaskUpdatedPayload" } required: [type, payload] WsTaskUpdatedPayload: type: object description: >- Lightweight "something about this task changed, refetch it" signal. Carries only the id; never treat it as a full Task. properties: id: { type: string } required: [id] WsTaskSideEffectEvent: type: object properties: type: { type: string, enum: [task.side_effect] } payload: { $ref: "#/components/schemas/WsTaskSideEffectPayload" } required: [type, payload] WsTaskSideEffectPayload: type: object description: >- A post-transition side effect (push, PR creation, issue write-back) ran or failed. A task.updated follows each one. properties: task_id: { type: string } kind: { type: string, description: "Side-effect kind, e.g. create_pr, terminal, leave_not_ready, pr_review_post." } status: { type: string, enum: [done, pending, failed], description: "pending = the attempt failed and will be retried." } last_error: { type: string, description: "Empty string when there is no error." } required: [task_id, kind, status, last_error] WsTaskAgentStartedEvent: type: object properties: type: { type: string, enum: [task.agent_started] } payload: { $ref: "#/components/schemas/WsTaskAgentStartedPayload" } required: [type, payload] WsTaskAgentStartedPayload: type: object description: An agent run began. properties: task_id: { type: string } run_id: { type: string } agent_name: { type: string } required: [task_id, run_id, agent_name] WsTaskAgentDoneEvent: type: object properties: type: { type: string, enum: [task.agent_done] } payload: { $ref: "#/components/schemas/WsTaskAgentDonePayload" } required: [type, payload] WsTaskAgentDonePayload: type: object description: An agent run reached a terminal (or waiting_human) status. properties: task_id: { type: string } run_id: { type: string } status: { type: string, enum: [pending, running, completed, failed, waiting_human, cancelled, interrupted] } required: [task_id, run_id, status] WsTaskNeedsHumanEvent: type: object properties: type: { type: string, enum: [task.needs_human] } payload: { $ref: "#/components/schemas/WsTaskNeedsHumanPayload" } required: [type, payload] WsTaskNeedsHumanPayload: type: object description: A run escalated to a human (request_human, cost-budget exhaustion, retry exhaustion, ...). properties: task_id: { type: string } run_id: { type: string } reason: type: string enum: [agent_question, auth_required, repeated_failure, rework_loop, cost_budget, cost_unknown, provider_missing, runtime_prep, max_turns, transient_exhausted, no_outcome, rejected_transition, verify_error, change_set_partial] description: Same code as AgentRun.escalation_reason, or change_set_partial (published for a parent task whose change set merged only partly; run_id is empty). message: { type: string } required: [task_id, run_id, reason, message] WsTaskAutonomyPendingEvent: type: object properties: type: { type: string, enum: [task.autonomy_pending] } payload: { $ref: "#/components/schemas/WsTaskAutonomyPendingPayload" } required: [type, payload] WsTaskAutonomyPendingPayload: type: object description: The autonomy policy scheduled an auto-approval that fires at due_at unless held. properties: task_id: { type: string } label: { type: string } decision_id: { type: string } due_at: { type: string, format: date-time } hold_seconds: { type: integer } required: [task_id, label, decision_id, due_at, hold_seconds] WsTaskAutonomyHeldEvent: type: object properties: type: { type: string, enum: [task.autonomy_held] } payload: { $ref: "#/components/schemas/WsTaskAutonomyHeldPayload" } required: [type, payload] WsTaskAutonomyHeldPayload: type: object description: A person held a pending auto-approval; the task is a normal review now. properties: task_id: { type: string } label: { type: string } decision_id: { type: string } actor: { type: string } required: [task_id, label, decision_id, actor] WsTaskAutonomyApprovedEvent: type: object properties: type: { type: string, enum: [task.autonomy_approved] } payload: { $ref: "#/components/schemas/WsTaskAutonomyApprovedPayload" } required: [type, payload] WsTaskAutonomyApprovedPayload: type: object description: The policy approved the task (task.label_changed is published too). properties: task_id: { type: string } decision_id: { type: string } from: { type: string } to: { type: string } note: { type: string } required: [task_id, decision_id, from, to, note] WsTaskAutonomyUndoneEvent: type: object properties: type: { type: string, enum: [task.autonomy_undone] } payload: { $ref: "#/components/schemas/WsTaskAutonomyUndonePayload" } required: [type, payload] WsTaskAutonomyUndonePayload: type: object description: A person undid an auto-approval; the task is back on its gate. properties: task_id: { type: string } label: { type: string, description: The gate the task returned to. } from: { type: string, description: The label the task was moved back from. } pr_url: { type: string, description: Present when a pull request had already been opened. } required: [task_id, label, from] WsTaskAutonomyAskedEvent: type: object properties: type: { type: string, enum: [task.autonomy_asked] } payload: { $ref: "#/components/schemas/WsTaskAutonomyAskedPayload" } required: [type, payload] WsTaskAutonomyAskedPayload: type: object description: The policy handed a task to a person at a non-ask gate. properties: task_id: { type: string } label: { type: string } decision_id: { type: string, description: Omitted when no decision row exists (evaluation_error). } reason: { type: string, enum: [policy, skipped, failed, evaluation_error, stepped_down] } reasons: type: array items: { type: string } description: Reason codes of the ask decision (policy only). required: [task_id, label, reason, reasons] WsAutonomySteppedDownEvent: type: object properties: type: { type: string, enum: [autonomy.stepped_down] } payload: { $ref: "#/components/schemas/WsAutonomySteppedDownPayload" } required: [type, payload] WsAutonomySteppedDownPayload: type: object description: A gate's autonomy mode was lowered one notch after enough escapes within the window (see GET/PUT /settings/autonomy). properties: workflow_id: { type: string } label: { type: string } from_mode: { type: string, enum: [ask, on_flags, auto] } to_mode: { type: string, enum: [ask, on_flags, auto] } actor: { type: string, description: Always "policy". } reason: { type: string } escapes: { type: integer, description: Distinct escapes counted. } change_id: { type: string, description: The autonomy_changes row (see the gate history endpoint). } required: [workflow_id, label, from_mode, to_mode, actor, reason, escapes, change_id] WsTaskCostWarningEvent: type: object properties: type: { type: string, enum: [task.cost_warning] } payload: { $ref: "#/components/schemas/WsTaskCostWarningPayload" } required: [type, payload] WsTaskCostWarningPayload: type: object description: >- A task's cumulative cost crossed the early-warning threshold of its effective cost budget (see GET/PUT /settings/cost-warning). Sent either by a provider's mid-run watchdog (run_id present) or by the dispatcher's pre-dispatch check (run_id omitted; no run in flight yet). properties: task_id: { type: string } run_id: { type: string, description: "Omitted for the dispatcher's pre-dispatch variant." } spent_usd: { type: number } budget_usd: { type: number } required: [task_id, spent_usd, budget_usd] WsSystemCostBudgetTrippedEvent: type: object properties: type: { type: string, enum: [system.cost_budget_tripped] } payload: { $ref: "#/components/schemas/WsSystemCostBudgetTrippedPayload" } required: [type, payload] WsSystemCostBudgetTrippedPayload: type: object description: >- The global daily/monthly spend ceiling was reached and dispatch is halted. Not task-scoped; fired once on the transition into the tripped state. properties: reason: { type: string, enum: [daily, monthly] } message: { type: string } daily_spent_usd: { type: number } daily_limit_usd: { type: number } monthly_spent_usd: { type: number } monthly_limit_usd: { type: number } required: [reason, message, daily_spent_usd, daily_limit_usd, monthly_spent_usd, monthly_limit_usd] WsTaskReviewCommentsChangedEvent: type: object properties: type: { type: string, enum: [task.review_comments_changed] } payload: { $ref: "#/components/schemas/WsTaskReviewCommentsChangedPayload" } required: [type, payload] WsTaskReviewCommentsChangedPayload: type: object description: A completed run resolved one or more review comments (only sent when resolved > 0). properties: task_id: { type: string } run_id: { type: string } resolved: { type: integer } required: [task_id, run_id, resolved] WsTaskVerificationEvent: type: object properties: type: { type: string, enum: [task.verification] } payload: { $ref: "#/components/schemas/WsTaskVerificationPayload" } required: [type, payload] WsTaskVerificationPayload: type: object description: > A run's repo verify command started (status running, never stored; not sent for a reused pass) or finished (refetch GET /tasks/{id}/verifications). A final status always follows running. properties: task_id: { type: string } run_id: { type: string } status: { type: string, enum: [running, pass, fail, timeout, error] } required: [task_id, run_id, status] WsTaskPreviewEvent: type: object properties: type: { type: string, enum: [task.preview] } payload: { $ref: "#/components/schemas/WsTaskPreviewPayload" } required: [type, payload] WsTaskPreviewPayload: type: object description: A preview screenshot capture started or finished (refetch GET /tasks/{id}/previews). properties: task_id: { type: string } capture_id: { type: string } status: { type: string, enum: [running, ok, failed] } required: [task_id, capture_id, status] WsTaskRateLimitedEvent: type: object properties: type: { type: string, enum: [task.rate_limited] } payload: { $ref: "#/components/schemas/WsTaskRateLimitedPayload" } required: [type, payload] WsTaskRateLimitedPayload: type: object description: A run was rate-limited by the provider and will be retried automatically. properties: task_id: { type: string } run_id: { type: string } agent_config_id: { type: string } unblocked_at: { type: string, description: "RFC3339 time retries resume; empty string when unknown." } required: [task_id, run_id, agent_config_id, unblocked_at] WsProviderPauseChangedEvent: type: object properties: type: { type: string, enum: [provider.pause_changed] } payload: { $ref: "#/components/schemas/WsProviderPauseChangedPayload" } required: [type, payload] WsProviderPauseChangedPayload: type: object description: The provider circuit breaker tripped (paused true) or lifted (paused false). properties: provider: { type: string } paused: { type: boolean } required: [provider, paused] WsTaskGitStateChangedEvent: type: object properties: type: { type: string, enum: [task.git_state_changed] } payload: { $ref: "#/components/schemas/WsTaskGitStateChangedPayload" } required: [type, payload] WsTaskGitStateChangedPayload: type: object description: The task's PR/git state changed (fired by the background forge sync). properties: task_id: { type: string } git_state: { type: string, enum: ["", pushed, pr_open, pr_merged, pr_closed] } pr_url: { type: string } required: [task_id, git_state, pr_url] WsTaskPrMergeableChangedEvent: type: object properties: type: { type: string, enum: [task.pr_mergeable_changed] } payload: { $ref: "#/components/schemas/WsTaskPrMergeableChangedPayload" } required: [type, payload] WsTaskPrMergeableChangedPayload: type: object description: The forge's merge-conflict verdict for the task's PR changed (sent only on a change). properties: task_id: { type: string } pr_mergeable: { type: string, enum: ["", mergeable, conflicting, unknown] } required: [task_id, pr_mergeable] WsTaskReviewCommentAddedEvent: type: object properties: type: { type: string, enum: [task.review_comment_added] } payload: { $ref: "#/components/schemas/WsTaskReviewCommentAddedPayload" } required: [type, payload] WsTaskReviewCommentAddedPayload: type: object description: The forge sync ingested a new PR review comment for the task. properties: task_id: { type: string } comment_id: { type: string } source: { type: string, description: "Forge/source name, e.g. github." } required: [task_id, comment_id, source] WsTaskSubtaskConflictEvent: type: object properties: type: { type: string, enum: [task.subtask_conflict] } payload: { $ref: "#/components/schemas/WsTaskSubtaskConflictPayload" } required: [type, payload] WsTaskSubtaskConflictPayload: type: object description: A subtask's branch conflicted on merge into its parent. task_id is the child task. properties: task_id: { type: string } parent_id: { type: string } files: { type: array, items: { type: string } } required: [task_id, parent_id, files] WsTaskSourceCommentAddedEvent: type: object properties: type: { type: string, enum: [task.source_comment_added] } payload: { $ref: "#/components/schemas/WsTaskSourceCommentAddedPayload" } required: [type, payload] WsTaskSourceCommentAddedPayload: type: object description: The importer ingested a new comment from the task's source issue thread. properties: task_id: { type: string } comment_id: { type: string } required: [task_id, comment_id] WsTaskCreatedEvent: type: object properties: type: { type: string, enum: [task.created] } payload: { $ref: "#/components/schemas/WsTaskCreatedPayload" } required: [type, payload] WsTaskCreatedPayload: type: object description: >- A task was created by a schedule or as a subtask. A subset of Task fields; refetch the task for full data. properties: id: { type: string } title: { type: string } label: { type: string } repo_id: { type: string } source: { type: string, description: "Present for schedule-created tasks." } source_ref: { type: string, description: "Present for schedule-created tasks." } parent_id: { type: string, description: "Present for subtasks." } required: [id, title, label, repo_id] WsTaskCreatedBulkEvent: type: object properties: type: { type: string, enum: [task.created_bulk] } payload: { $ref: "#/components/schemas/WsTaskCreatedBulkPayload" } required: [type, payload] WsTaskCreatedBulkPayload: type: object description: >- Sent by the issue importer instead of one task.created per item. count is exact; ids is capped server-side. Do a single list refresh. properties: repo_id: { type: string } source: { type: string } count: { type: integer } ids: { type: array, items: { type: string } } required: [repo_id, source, count, ids] WsRepoCloneDoneEvent: type: object properties: type: { type: string, enum: [repo.clone_done] } payload: { $ref: "#/components/schemas/WsRepoClonePayload" } required: [type, payload] WsRepoCloneFailedEvent: type: object properties: type: { type: string, enum: [repo.clone_failed] } payload: { $ref: "#/components/schemas/WsRepoClonePayload" } required: [type, payload] WsRepoClonePayload: type: object description: Outcome of an async repo clone (repo.clone_done / repo.clone_failed). properties: repo_id: { type: string } clone_status: { type: string, enum: [ready, error] } clone_error: { type: string, description: "Empty string on success." } required: [repo_id, clone_status, clone_error] WsAgentLogEntry: type: object description: >- A log line as pushed over the WebSocket. Note this is not AgentLog: the timestamp key is `at` and there is no agent_run_id (the enclosing payload carries run_id). `id` is the persisted agent_logs row id. properties: id: { type: string } type: { type: string, enum: [stdout, stderr, system, tool_call, tool_result] } content: { type: string } at: { type: string, format: date-time } seq: { type: integer, format: int64, description: "Monotonic per-entry sequence; tiebreak for entries with the same timestamp." } required: [id, type, content, at] WsAgentLogEvent: type: object properties: type: { type: string, enum: [agent.log] } payload: { $ref: "#/components/schemas/WsAgentLogPayload" } required: [type, payload] WsAgentLogPayload: type: object description: One live log entry. Delivered only to clients subscribed to task_id. properties: run_id: { type: string } task_id: { type: string } entry: { $ref: "#/components/schemas/WsAgentLogEntry" } required: [run_id, task_id, entry] WsAgentLogReplayEvent: type: object properties: type: { type: string, enum: [agent.log_replay] } payload: { $ref: "#/components/schemas/WsAgentLogReplayPayload" } required: [type, payload] WsAgentLogReplayPayload: type: object description: >- Sent once on subscribe: the newest (capped) tail of the current run's persisted log, chronological. has_more means earlier entries exist. properties: run_id: { type: string } task_id: { type: string } has_more: { type: boolean } entries: { type: array, items: { $ref: "#/components/schemas/WsAgentLogEntry" } } required: [run_id, task_id, has_more, entries] WsResyncEvent: type: object properties: type: { type: string, enum: [resync] } payload: { $ref: "#/components/schemas/WsResyncPayload" } required: [type, payload] WsResyncPayload: type: object description: >- Events were dropped for this client (or it reconnected); refetch any state derived from WebSocket events. Always empty. additionalProperties: false paths: /tasks: get: summary: List tasks parameters: - name: q in: query description: Case-insensitive substring search over title and description schema: { type: string } - name: label in: query schema: { type: string } - name: repo_id in: query schema: { type: string } - name: type in: query schema: { type: string } - name: git_state in: query schema: { type: string, enum: [pushed, pr_open, pr_merged, pr_closed] } - name: parent_id in: query description: > When set, returns the direct children (subtasks) of this parent task (one family at a time), bypassing pagination. schema: { type: string } - name: archived in: query description: > Archived-task visibility. Omitted (default) hides archived tasks; "only" returns just archived tasks; "all" returns everything. schema: { type: string, enum: [all, only] } - name: limit in: query description: Page size. Defaults to 200; values above 500 are clamped to 500. schema: { type: integer, default: 200, maximum: 500 } - name: after in: query description: > Cursor for the next page: the id of the last task from the previous page (returned in that response's X-Next-Cursor header). Omit for the first page. schema: { type: string } responses: "200": description: > A page of tasks, newest first. When more tasks remain, the id to pass as the next `after` cursor is returned in the X-Next-Cursor header (absent on the final page). headers: X-Next-Cursor: description: Cursor for the next page; absent when no more tasks remain. schema: { type: string } content: application/json: schema: { type: array, items: { $ref: "#/components/schemas/Task" } } post: summary: Create a task requestBody: required: true content: application/json: schema: type: object required: [title, repo_id] properties: title: { type: string } description: { type: string } type: { type: string } repo_id: { type: string } workflow_id: { type: string, description: "Optional. Defaults to the board's default workflow (the one named 'Default', else the alphabetically-first workflow) when omitted." } label: { type: string, description: "Label (column) the task starts on. Empty defaults to the workflow's human-gate label — the lowest sort_order agent_ignore label, else the first label ('not_ready' in the default workflow). Must name a label defined in the workflow; unlike a label move this is initial placement, so it is not restricted to defined transition edges (e.g. a task can be created directly on 'work')." } priority: { type: integer, enum: [-1, 0, 1, 2], default: 0 } related_repo_ids: type: array items: { type: string } description: > Other repo ids this change also touches (ADR 0041). repo_id stays the primary repo. Naming repos is the per-task opt-in for cross-repo create_subtask; the planner prompt lists them and asks for one child per repo. Entries must exist, be distinct and differ from repo_id. children: type: array description: > Child tasks created in the same transaction as the task, with parent→child dependency edges (like create_subtask). At most 10. Children land on the workflow's human-gate (agent_ignore) label; 422 if the workflow has none. Not supported by templates or schedules. items: type: object required: [repo_id, title] additionalProperties: false properties: repo_id: { type: string, description: "May equal the task's repo_id." } title: { type: string } description: { type: string } multipart/form-data: schema: type: object required: [title, repo_id] description: > Same fields as the JSON body plus image attachments (`files`). Send related_repo_ids as repeated form values and children as one JSON-encoded string. properties: title: { type: string } description: { type: string } type: { type: string } repo_id: { type: string } workflow_id: { type: string } label: { type: string } priority: { type: integer } related_repo_ids: { type: array, items: { type: string } } children: { type: string, description: 'JSON array of {repo_id, title, description}' } responses: "201": description: > Created task. When related_repo_ids or children were supplied the body also carries related_repo_ids (every repo stored for the task) and children. content: application/json: schema: allOf: - $ref: "#/components/schemas/Task" - type: object properties: related_repo_ids: { type: array, items: { type: string } } children: { type: array, items: { $ref: "#/components/schemas/CreatedChildTask" } } "400": { description: Invalid body, unknown or duplicate repo, empty child title, or a child with keys other than repo_id/title/description } "422": { description: More than 10 children, or the workflow has no agent_ignore label for them } /tasks/bulk: post: summary: Apply one action to many tasks description: > Applies a single action to every task in ids. Each task is processed independently — one failure doesn't abort the rest. Returns 200 if every task succeeded, 207 if any failed; the per-task results array reports each outcome either way. "move" transitions are validated through the workflow engine exactly like PATCH /tasks/{id}/label, including refusing (as a per-task failure, not a request error) any task whose active agent run is still live (pending/running) — the same rule PATCH /tasks/{id}/label enforces with a 409. requestBody: required: true content: application/json: schema: type: object required: [ids, action] properties: ids: { type: array, items: { type: string } } action: { type: string, enum: [move, pause, resume, archive, unarchive] } to_label: { type: string, description: "Required when action is move" } note: { type: string, description: "Optional transition note (move only)" } responses: "200": description: All tasks processed successfully content: application/json: schema: type: object properties: results: type: array items: type: object properties: id: { type: string } ok: { type: boolean } error: { type: string } "207": { description: Some tasks failed; see per-task results } "400": { description: Missing ids, unknown action, or move without to_label } /tasks/{id}: parameters: - name: id in: path required: true schema: { type: string } get: summary: Get a task responses: "200": content: application/json: schema: { $ref: "#/components/schemas/Task" } patch: summary: Update a task's metadata description: > Partial update — omitted fields keep their existing values. An explicitly empty title is rejected with 400 rather than being persisted. requestBody: content: application/json: schema: type: object properties: title: { type: string } description: { type: string } type: { type: string } priority: { type: integer, enum: [-1, 0, 1, 2] } responses: "200": content: application/json: schema: { $ref: "#/components/schemas/Task" } "400": { description: Invalid request (e.g. empty title, bad priority/max_cost_usd) } delete: summary: Delete a task responses: "204": { description: Deleted } "409": description: > An agent run on this task is `pending` or `running`. Cancel the run (POST /tasks/{id}/runs/{run_id}/cancel) before deleting. /tasks/{id}/label: patch: summary: Move task label (human-initiated) parameters: - name: id in: path required: true schema: { type: string } requestBody: required: true content: application/json: schema: type: object required: [to_label] properties: to_label: { type: string } note: { type: string } force: type: boolean default: false description: > Force move: bypass the workflow's transition table and move the task to any label of its workflow (escape hatch for wedged tasks). Recorded in label history with the note prefixed "Forced move". Still refused with 409 while an agent run is live; 400 if to_label is not a label of the task's workflow. responses: "200": content: application/json: schema: { $ref: "#/components/schemas/Task" } "400": { description: Invalid transition, or (with force) unknown label } "403": { description: Gate required } "409": description: > An agent run on this task is `pending` (claimed but not yet started) or `running`. Cancel the run (POST /tasks/{id}/runs/{run_id}/cancel) before moving its label. /tasks/{id}/archive: patch: summary: Archive or unarchive a task description: > Archived tasks are hidden from the default board view, excluded from the GitHub PR status sweep, and never dispatched to agents. Archiving does not change the task's label. parameters: - name: id in: path required: true schema: { type: string } requestBody: required: true content: application/json: schema: type: object required: [archived] properties: archived: { type: boolean } responses: "200": content: application/json: schema: { $ref: "#/components/schemas/Task" } "404": { description: Task not found } /tasks/{id}/pause: patch: summary: Pause or unpause a task description: > A paused task is never picked up by the dispatcher, regardless of its current label. Pausing does not change the task's label and does not cancel any in-flight agent run; it only blocks future dispatch. parameters: - name: id in: path required: true schema: { type: string } requestBody: required: true content: application/json: schema: type: object required: [paused] properties: paused: { type: boolean } responses: "200": content: application/json: schema: { $ref: "#/components/schemas/Task" } /tasks/{id}/always-ask: patch: summary: Set a task's always_ask override description: > When true the autonomy policy never auto-approves this task at a gate. parameters: - name: id in: path required: true schema: { type: string } requestBody: required: true content: application/json: schema: type: object required: [always_ask] properties: always_ask: { type: boolean } responses: "200": content: application/json: schema: { $ref: "#/components/schemas/Task" } "404": { description: Task not found } /tasks/{id}/autonomy-decision: get: summary: Latest autonomy decision for the task's current label description: > Recorded when the task landed on a gate whose autonomy mode is not ask. An approve decision is acted on after its hold window; see outcome. parameters: - name: id in: path required: true schema: { type: string } responses: "200": content: application/json: schema: { $ref: "#/components/schemas/AutonomyDecision" } "404": { description: Task not found, or no decision for its current label } /tasks/{id}/autonomy/hold: post: summary: Hold a pending auto-approval description: > Cancels the task's pending auto-approval (decision outcome becomes held); the task becomes a normal review. Publishes task.autonomy_held. parameters: - name: id in: path required: true schema: { type: string } responses: "200": description: The held decision content: application/json: schema: { $ref: "#/components/schemas/AutonomyDecision" } "404": { description: Task not found } "409": { description: No pending auto-approval for this task } /tasks/{id}/autonomy/undo: post: summary: Undo an auto-approval description: > Only for a task whose last gate exit was made by the policy actor and that is not terminal-merged. Moves the task back to that gate (label history note "Undo auto-approval"), records an autonomy_escapes row (source undo) and publishes task.autonomy_undone. A pull request that was already opened is left as is. The task is then re-evaluated with a hard stop (reason undone), so a person decides. parameters: - name: id in: path required: true schema: { type: string } responses: "200": content: application/json: schema: { $ref: "#/components/schemas/AutonomyUndoResponse" } "404": { description: Task not found } "409": { description: Last gate exit was not by the policy, task already merged or archived, or a run is live } /tasks/{id}/autonomy/suggestions: get: summary: Candidate ask-rule conditions derived from a task description: > Deepest common directories of the changed files as `dir/**` globs (top 3 by file count), `*.ext` globs for specific kinds (sql, proto, yaml, ...), the task type and a size threshold rounded down from the changed lines. Without a diff, path_globs is empty and min_changed_lines is null. parameters: - name: id in: path required: true schema: { type: string } responses: "200": content: application/json: schema: { $ref: "#/components/schemas/AutonomySuggestions" } "404": { description: Task not found } /tasks/{id}/autonomy/should-have-asked: post: summary: Report that a policy-approved task should have been asked about description: > Records an escape (source should_have_asked) against the task's latest policy approval, optionally creates an ask rule (scoped to this gate or all gates of the workflow; optionally this repo), optionally sends the task back through its failure path with a note (skipped when it is done) and optionally creates an active lesson with the rule's globs. May step the gate down (see GET/PUT /settings/autonomy). Everything is validated before anything is written. parameters: - name: id in: path required: true schema: { type: string } requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/ShouldHaveAskedRequest" } responses: "200": content: application/json: schema: { $ref: "#/components/schemas/ShouldHaveAskedResponse" } "400": { description: Invalid rule, lesson or label_scope } "404": { description: Task not found } "409": { description: Task not approved by the policy, archived, or cannot be sent back (no failure path, run live) } /autonomy/ask-rules: get: summary: List ask rules description: The label and repo filters also return the all-gates / all-repos rules, because those apply too. parameters: - { name: workflow_id, in: query, schema: { type: string } } - { name: label, in: query, schema: { type: string } } - { name: repo_id, in: query, schema: { type: string } } responses: "200": content: application/json: schema: { type: array, items: { $ref: "#/components/schemas/AskRule" } } post: summary: Create an ask rule requestBody: required: true content: application/json: schema: allOf: - $ref: "#/components/schemas/AskRuleInput" - type: object required: [workflow_id] properties: workflow_id: { type: string } label: { type: string, nullable: true } repo_id: { type: string, nullable: true } source_task_id: { type: string, nullable: true } responses: "201": content: application/json: schema: { $ref: "#/components/schemas/AskRule" } "400": { description: No condition, invalid glob, or unknown workflow, label or repo } /autonomy/ask-rules/{id}: parameters: - name: id in: path required: true schema: { type: string } patch: summary: Update an ask rule description: Nullable fields (repo_id, label, task_type, min_changed_lines) are cleared with an explicit null. workflow_id cannot change. requestBody: required: true content: application/json: schema: allOf: - $ref: "#/components/schemas/AskRuleInput" - type: object properties: label: { type: string, nullable: true } repo_id: { type: string, nullable: true } responses: "200": content: application/json: schema: { $ref: "#/components/schemas/AskRule" } "400": { description: The merged rule is invalid } "404": { description: Rule not found } delete: summary: Delete an ask rule responses: "204": { description: Deleted } "404": { description: Rule not found } /autonomy/rule-proposals: get: summary: List model-proposed ask rules description: Best catches first, up to 200. parameters: - { name: workflow_id, in: query, schema: { type: string } } - { name: label, in: query, schema: { type: string } } - { name: status, in: query, schema: { type: string, enum: [proposed, accepted, dismissed, all], default: proposed } } responses: "200": content: application/json: schema: { type: array, items: { $ref: "#/components/schemas/RuleProposal" } } "400": { description: Invalid status } /autonomy/rule-proposals/{id}/accept: post: summary: Accept a rule proposal description: >- Creates an ask rule with the proposal's conditions, scoped to its gate, created_by the caller, and marks the proposal accepted. parameters: - { name: id, in: path, required: true, schema: { type: string } } responses: "201": content: application/json: schema: type: object required: [proposal, rule] properties: proposal: { $ref: "#/components/schemas/RuleProposal" } rule: { $ref: "#/components/schemas/AskRule" } "404": { description: Proposal not found } "409": { description: Already accepted or dismissed, an identical rule exists, or the gate or repo is gone } /autonomy/rule-proposals/{id}/dismiss: post: summary: Dismiss a rule proposal description: A later run that finds the same conditions refreshes its counts but does not offer it again. parameters: - { name: id, in: path, required: true, schema: { type: string } } responses: "200": content: application/json: schema: { $ref: "#/components/schemas/RuleProposal" } "404": { description: Proposal not found } "409": { description: Already accepted or dismissed } /workflows/{id}/labels/{label}/autonomy/proposals/run: post: summary: Start a rule proposal run for a gate description: >- Reads the gate's escapes and human rejections from the last 30 days, asks the configured provider for candidate ask rules, validates and replays each one, and stores the ones that would have caught at least one of them. Runs in the background; poll proposal-runs for the result. Skipped (no model call) with fewer than 3 escapes or rejections. parameters: - { name: id, in: path, required: true, schema: { type: string } } - { name: label, in: path, required: true, schema: { type: string } } responses: "202": content: application/json: schema: { $ref: "#/components/schemas/RuleProposalRun" } "400": { description: Not a human gate, or no usable provider config set for proposals } "404": { description: Workflow or label not found } "409": { description: A run is already in progress for this gate } /workflows/{id}/labels/{label}/autonomy/proposal-runs: get: summary: A gate's recent rule proposal runs description: Newest first. parameters: - { name: id, in: path, required: true, schema: { type: string } } - { name: label, in: path, required: true, schema: { type: string } } - { name: limit, in: query, schema: { type: integer, minimum: 1, maximum: 100, default: 10 } } responses: "200": content: application/json: schema: { type: array, items: { $ref: "#/components/schemas/RuleProposalRun" } } "400": { description: Invalid limit } /workflows/{id}/labels/{label}/autonomy/history: get: summary: A gate's autonomy changes and escapes description: Newest first, up to 200 each. parameters: - { name: id, in: path, required: true, schema: { type: string } } - { name: label, in: path, required: true, schema: { type: string } } responses: "200": content: application/json: schema: { $ref: "#/components/schemas/AutonomyHistory" } "404": { description: Workflow not found } /settings/autonomy: get: summary: Get the escape step-down and rule proposal settings responses: "200": content: application/json: schema: { $ref: "#/components/schemas/AutonomySettings" } put: summary: Update the escape step-down and rule proposal settings requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/AutonomySettings" } responses: "200": content: application/json: schema: { $ref: "#/components/schemas/AutonomySettings" } "400": { description: Out of range, or unknown proposal_provider_config_id } /tasks/similar: get: summary: Find open tasks similar to a title (no model call) description: > Deterministic possible-duplicate lookup for the New Task modal: open, non-archived tasks in the repo whose title overlaps `q` (Jaccard index of normalised tokens >= 0.5, at least 2 shared tokens). Best first, at most 5. parameters: - { name: repo_id, in: query, required: true, schema: { type: string } } - { name: q, in: query, required: false, schema: { type: string } } responses: "200": description: Matches, possibly empty content: application/json: schema: type: array items: { $ref: "#/components/schemas/PossibleDuplicate" } "400": { description: repo_id missing } /tasks/{id}/intake-check: get: summary: Latest intake assistant check for a task parameters: - { name: id, in: path, required: true, schema: { type: string } } responses: "200": content: application/json: schema: { $ref: "#/components/schemas/IntakeCheck" } "404": { description: No check for this task } post: summary: Run the intake assistant on a task (advisory, background) description: > Starts a model check (clarity verdict, suggested type/workflow, which duplicate candidates are real) in a scratch directory with shell commands denied. It never moves, edits or archives the task. Returns the running check; poll GET for the result. Requires the assistant to be enabled in settings. parameters: - { name: id, in: path, required: true, schema: { type: string } } responses: "202": content: application/json: schema: { $ref: "#/components/schemas/IntakeCheck" } "400": { description: Assistant disabled or no usable provider } "404": { description: Task not found } "409": { description: A check is already running for this task } /settings/intake-assistant: get: summary: Get the intake assistant settings (off by default) responses: "200": content: application/json: schema: { $ref: "#/components/schemas/IntakeAssistantSettings" } put: summary: Update the intake assistant settings requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/IntakeAssistantSettings" } responses: "200": content: application/json: schema: { $ref: "#/components/schemas/IntakeAssistantSettings" } "400": { description: Unknown provider config, or enabled without one } /tasks/{id}/dependencies: get: summary: List a task's dependency edges description: > Returns both directions of the task's dependency edges: the tasks it is blocked by (each with derived satisfaction state) and the tasks that depend on it. Dependencies are a pure dispatch gate — a task with any unsatisfied blocker is never picked up by the dispatcher, though a human can still move it anywhere. parameters: - name: id in: path required: true schema: { type: string } responses: "200": content: application/json: schema: { $ref: "#/components/schemas/TaskDependencies" } "404": { description: Task not found } post: summary: Add a dependency (this task depends on another) description: > Creates an edge so this task is not dispatched until the depended-on task reaches a terminal label or is archived. Both tasks must be in the same workflow, and the blocker's workflow must have a terminal label (otherwise the edge could never satisfy). Cycles and self-edges are rejected. parameters: - name: id in: path required: true schema: { type: string } requestBody: required: true content: application/json: schema: type: object required: [depends_on_task_id] properties: depends_on_task_id: { type: string } responses: "204": { description: Dependency created } "400": { description: Self-edge, cross-workflow, or blocker workflow has no terminal label } "404": { description: Task not found } "409": { description: Edge already exists or would create a cycle } /tasks/{id}/subtasks: post: summary: Create a subtask under a parent description: > Creates a child task under the parent named in the path (Mechanism 2). The create_subtask MCP tool posts here live during a planning run. The child inherits the parent's workflow (and its repo unless repo_id names another one, ADR 0041), lands on a human-gate (agent_ignore) label, and gets an auto-created parent→child dependency edge so the parent isn't dispatched until the child finishes. Guardrails: depth limit 1 (a subtask can't create subtasks), a per-parent cap (config max_subtasks, default 10), and — when a creating run is in flight — the run's config must have subtasks_enabled (plus cross_repo_subtasks_enabled for a repo_id naming another repo). A foreign child (another repo) lands via its own pull request instead of merging back; its merge_status follows the PR. With no creating run in flight (a human calling directly) repo_id is allowed. parameters: - name: id in: path required: true schema: { type: string } requestBody: required: true content: application/json: schema: type: object required: [title] properties: title: { type: string } description: { type: string } type: { type: string, enum: [feature, bug, chore, spike] } file_scope: type: array items: { type: string } description: > Optional repo-relative globs the subtask may change (max 20, 256 chars each, no leading "/" or ".." segments). Siblings with overlapping scopes are serialized via dependency edges. label: type: string description: > Optional landing label; must be an agent_ignore (human-gate) label. Defaults to the workflow's first agent_ignore label. repo_id: type: string description: > Optional id of another configured repo (ADR 0041). Omitted (or equal to the parent's repo) creates a home child that merges back as before. Another repo creates a foreign child that uses the parent's workflow, forks from that repo's base and lands via its own PR; requires cross_repo_subtasks_enabled on the creating run's config. responses: "201": content: application/json: schema: allOf: - $ref: "#/components/schemas/Task" - type: object properties: overlap_dependencies: type: array description: Siblings this subtask now depends on because their file scopes overlap. items: type: object properties: task_id: { type: string } title: { type: string } globs: { type: array, items: { type: string } } "400": { description: Depth limit exceeded, non-gate label, missing title, or repo_id does not reference an existing repo } "403": { description: Creating run's config is not permitted to create subtasks (or cross-repo subtasks for a foreign repo_id) } "404": { description: Parent task not found } "422": { description: Per-parent subtask cap reached } /tasks/{id}/change-set: get: summary: Change-set view of a multi-repo task family description: > Read-only, derived on read (ADR 0041). {id} may be the parent or any of its children. For a family with at least one foreign child (a child in a different repo than the parent) it returns every non-archived child in created order with its verify result, diff stats (null when no branch or the diff is unavailable), auto-merge state and 1-based merge position. Otherwise multi_repo is false and children is empty. There is no merged cross-repo diff. parameters: - name: id in: path required: true schema: { type: string } responses: "200": content: application/json: schema: { $ref: "#/components/schemas/ChangeSet" } "404": { description: Task not found } /tasks/{id}/dependencies/{dep_id}: delete: summary: Remove a dependency edge parameters: - name: id in: path required: true schema: { type: string } - name: dep_id in: path required: true schema: { type: string } description: The depends_on_task_id of the edge to remove. responses: "204": { description: Dependency removed (idempotent) } /tasks/{id}/approve: post: summary: Approve the current human gate parameters: - name: id in: path required: true schema: { type: string } requestBody: content: application/json: schema: type: object properties: note: { type: string } responses: "200": content: application/json: schema: { $ref: "#/components/schemas/Task" } "409": description: > An agent run on this task is `pending` (claimed but not yet started) or `running`. Cancel the run before approving. /tasks/{id}/reject: post: summary: Reject and push back with feedback parameters: - name: id in: path required: true schema: { type: string } requestBody: content: application/json: schema: type: object properties: note: { type: string } to_label: { type: string } responses: "200": content: application/json: schema: { $ref: "#/components/schemas/Task" } "409": description: > An agent run on this task is `pending` (claimed but not yet started) or `running`. Cancel the run before rejecting. /tasks/{id}/notes: patch: summary: Update agent notes on a task parameters: - name: id in: path required: true schema: { type: string } requestBody: required: true content: application/json: schema: type: object required: [notes] properties: notes: { type: string, description: "Notes content (supports markdown)" } append: { type: boolean, description: "If true, append to existing notes" } responses: "200": content: application/json: schema: { $ref: "#/components/schemas/Task" } /tasks/{id}/rerun: post: summary: Clear a task's active agent run so it can be re-dispatched description: > Clears active_agent_run_id without changing the task's label, letting the dispatcher pick it up again on the next sweep. Does not cancel any currently in-flight process; use POST /tasks/{id}/runs/{run_id}/cancel for that first if needed. parameters: - name: id in: path required: true schema: { type: string } responses: "204": { description: Rerun requested } "404": { description: Task not found } /tasks/{id}/review-comments: get: summary: List inline diff review comments on a task (open and resolved) parameters: - name: id in: path required: true schema: { type: string } responses: "200": content: application/json: schema: type: array items: { $ref: "#/components/schemas/ReviewComment" } post: summary: Add an inline diff review comment description: > Creates a persistent, file/line-anchored review comment on the task's diff. Open comments are injected into every subsequent agent run's prompt (under "OPEN REVIEW COMMENTS") until resolved — by the agent via the MCP resolve_comment tool, or by a human via PATCH. parameters: - name: id in: path required: true schema: { type: string } requestBody: required: true content: application/json: schema: type: object required: [file_path, start_line, end_line, body] properties: file_path: { type: string } side: { type: string, enum: [old, new], default: new } start_line: { type: integer, minimum: 1 } end_line: { type: integer, minimum: 1 } quoted_text: { type: string, description: "Diff content the comment anchors to" } body: { type: string, description: "The review comment text" } responses: "201": content: application/json: schema: { $ref: "#/components/schemas/ReviewComment" } /tasks/{id}/review-comments/{comment_id}: patch: summary: Resolve or reopen a review comment parameters: - name: id in: path required: true schema: { type: string } - name: comment_id in: path required: true schema: { type: string } requestBody: required: true content: application/json: schema: type: object required: [status] properties: status: { type: string, enum: [resolved, open] } resolution_note: { type: string } responses: "200": content: application/json: schema: { $ref: "#/components/schemas/ReviewComment" } "404": description: Comment not found (or already resolved when resolving) delete: summary: Delete a review comment parameters: - name: id in: path required: true schema: { type: string } - name: comment_id in: path required: true schema: { type: string } responses: "204": description: Deleted /tasks/{id}/diff: get: summary: Get the task's branch diff against its base (this task's accumulated changes) parameters: - name: id in: path required: true schema: { type: string } responses: "200": content: application/json: schema: type: object properties: branch: { type: string } diff: { type: string } /tasks/{id}/pr-url: get: summary: Build a pre-filled GitHub compare/PR URL for the task's branch description: > Returns a github.com/.../compare URL with the PR title and a markdown body (task description, agent notes, and commit subjects) pre-filled, so a human can open a fully-described PR in one click. Requires the repo to have a GitHub remote and the task to have a provisioned branch. parameters: - name: id in: path required: true schema: { type: string } responses: "200": content: application/json: schema: type: object properties: url: { type: string } /tasks/{id}/pr: post: summary: Push the task's branch and open a GitHub pull request via the gh CLI description: > Pushes the task's branch to origin, then runs `gh pr create` with the title from the task and a body assembled from the description, agent notes, and commit subjects. The resulting PR URL and git state are stored on the task. Idempotent: if a PR already exists for the branch, that PR is returned instead of erroring. Requires the repo to have a GitHub remote, the task to have a provisioned branch, and the gh CLI to be authenticated. parameters: - name: id in: path required: true schema: { type: string } responses: "200": content: application/json: schema: type: object properties: pr_url: { type: string } git_state: { type: string, enum: ["", pushed, pr_open, pr_merged, pr_closed] } "400": { description: Task has no branch, or repo has no/invalid GitHub remote } "409": { description: "Review-only PR task (source github_pr/gitea_pr): these never push or open pull requests" } "502": { description: gh pr create failed (e.g. not authenticated) } /tasks/{id}/side-effects/retry: post: summary: Retry a task's failed side effects description: > Makes the task's failed outbox rows (see TaskSideEffect) pending again with a fresh attempt budget; the background worker picks them up immediately. Returns the task with its current side_effects. parameters: - name: id in: path required: true schema: { type: string } responses: "200": description: Requeued content: application/json: schema: { $ref: '#/components/schemas/Task' } "404": { description: Task not found } "409": { description: The task has no failed side effects } /tasks/{id}/side-effects: delete: summary: Dismiss a task's failed side effects description: > Deletes the task's failed outbox rows (see TaskSideEffect) without running them, for effects that no longer apply. Emits task.updated. parameters: - name: id in: path required: true schema: { type: string } responses: "204": { description: Dismissed } "404": { description: Task not found } "409": { description: The task has no failed side effects } /tasks/{id}/source-update/apply: post: summary: Apply the held source-issue edit to the task description: > With issue_sync_update_policy "always", an edit to the source issue made after a human approved the task is not written to the task; it is held as source_pending_update. This overwrites the task's title, description and type with the held text and clears it. Emits task.updated. Returns the task. parameters: - name: id in: path required: true schema: { type: string } responses: "200": description: Applied content: application/json: schema: { $ref: '#/components/schemas/Task' } "404": { description: Task not found } "409": { description: The task has no pending source update } /tasks/{id}/source-update: delete: summary: Discard the held source-issue edit description: > Dismisses the held edit without applying it. The same upstream text is not held again; a further edit to the issue is. Emits task.updated. Returns the task. parameters: - name: id in: path required: true schema: { type: string } responses: "200": description: Discarded content: application/json: schema: { $ref: '#/components/schemas/Task' } "404": { description: Task not found } "409": { description: The task has no pending source update } /tasks/{id}/github-status: get: summary: Refresh and return the task's live GitHub PR state via the gh CLI description: > Queries gh for the current PR state of the task's branch and persists it. When a PR exists, also refreshes GitHub's merge-conflict verdict for it (pr_mergeable). If the live query fails, returns the previously stored git_state and pr_url instead of erroring, with an additional error field describing the failure. Returns git_state "none" without querying gh if the task has no branch yet. parameters: - name: id in: path required: true schema: { type: string } responses: "200": content: application/json: schema: type: object properties: git_state: { type: string, enum: ["", none, pushed, pr_open, pr_merged, pr_closed] } pr_url: { type: string } pr_mergeable: { type: string, enum: ["", mergeable, conflicting, unknown], description: "Omitted from the no-branch response; otherwise the stored verdict, refreshed when a PR exists" } error: { type: string, nullable: true, description: "Present only when the live gh query failed" } "400": { description: Repo has no/invalid GitHub remote } "404": { description: Task not found } /tasks/{id}/git-state: patch: summary: Manually set a task's git state parameters: - name: id in: path required: true schema: { type: string } requestBody: required: true content: application/json: schema: type: object required: [git_state] properties: git_state: { type: string, enum: ["", pushed, pr_open, pr_merged, pr_closed] } responses: "200": content: application/json: schema: { $ref: "#/components/schemas/Task" } "400": { description: Invalid git_state value } /tasks/{id}/label-history: get: summary: Get a task's label-transition audit trail parameters: - name: id in: path required: true schema: { type: string } responses: "200": content: application/json: schema: { type: array, items: { $ref: "#/components/schemas/TaskLabelHistory" } } /tasks/{id}/source-comments: get: summary: Get a task's ingested source-issue comment thread description: > Comments ingested from the external item (e.g. GitHub issue) this task was imported from, oldest first. Empty for tasks with no source, for repos with issue_comment_sync_enabled off, or before the next sweep ingests any. See docs/task-sources.md. parameters: - name: id in: path required: true schema: { type: string } responses: "200": content: application/json: schema: { type: array, items: { $ref: "#/components/schemas/TaskSourceComment" } } "404": { description: Task not found } /tasks/{id}/human-decisions: get: summary: List a task's human replies to waiting_human runs description: > Replied decisions only (question-only rows are excluded), oldest first. These are the same replies shown to later runs under HUMAN DECISIONS ON THIS TASK. parameters: - name: id in: path required: true schema: { type: string } responses: "200": content: application/json: schema: { type: array, items: { $ref: "#/components/schemas/TaskHumanDecision" } } "404": { description: Task not found } /tasks/{id}/runs: get: summary: List agent runs for a task parameters: - name: id in: path required: true schema: { type: string } - name: limit in: query description: Page size. Defaults to 100; values above 500 are clamped to 500. schema: { type: integer, default: 100, maximum: 500 } - name: after in: query description: > Cursor for the next page: the id of the last run from the previous page (returned in that response's X-Next-Cursor header). Omit for the first page. schema: { type: string } responses: "200": description: > A page of the task's agent runs, newest first. When more runs remain, the id to pass as the next `after` cursor is returned in the X-Next-Cursor header (absent on the final page). The task's lifetime cumulative cost is not derivable from a single page; see Task.cumulative_cost_usd on GET /tasks/{id}. headers: X-Next-Cursor: description: Cursor for the next page; absent when no more runs remain. schema: { type: string } content: application/json: schema: { type: array, items: { $ref: "#/components/schemas/AgentRun" } } /tasks/{id}/previews: get: summary: Latest preview screenshot capture for a task description: > Screenshots of the repo's preview routes at desktop (1280x800) and phone (390x844) width, captured when a run succeeded into a human gate and the diff touched UI files. capture is null when none was taken. Failures never block the task; they appear as status failed. parameters: - name: id in: path required: true schema: { type: string } responses: "200": content: application/json: schema: type: object properties: capture: nullable: true allOf: - $ref: "#/components/schemas/TaskPreviewCapture" required: [capture] /tasks/{id}/verifications: get: summary: List the task's verification results description: > Verify-command results for the task's runs, newest first (at most 20). Empty when the repo has no verify_command or no run has signalled success since one was configured. The first element is the latest result shown beside the diff on the review view. parameters: - name: id in: path required: true schema: { type: string } responses: "200": content: application/json: schema: { type: array, items: { $ref: "#/components/schemas/RunVerification" } } /tasks/{id}/review-brief: get: summary: Review brief for a task description: > Deterministic risk flags, change summary, latest verification, run/rework/cost totals and the latest agent summary. Diff-derived parts are cached per branch head. Advisory only; no LLM calls. parameters: - name: id in: path required: true schema: { type: string } responses: "200": description: The review brief. content: application/json: schema: { $ref: "#/components/schemas/ReviewBrief" } "404": description: Task not found. /tasks/{id}/runs/{run_id}: get: summary: Get an agent run parameters: - name: id in: path required: true schema: { type: string } - name: run_id in: path required: true schema: { type: string } responses: "200": content: application/json: schema: { $ref: "#/components/schemas/AgentRun" } /tasks/{id}/runs/{run_id}/cancel: post: summary: Cancel a running agent run description: > Signals an in-flight run to stop. The pool cancels the run's context — propagating to CLI subprocesses (exec.CommandContext) and aborting HTTP providers — then, once the provider returns, marks the run `cancelled` (not `failed`, and without consuming retry budget), pauses the task so it is not immediately re-dispatched, clears the active-run lock, and broadcasts `task.agent_done`. Cancellation is asynchronous: a 202 means it was signalled, not that the run has fully stopped. parameters: - name: id in: path required: true schema: { type: string } - name: run_id in: path required: true schema: { type: string } responses: "202": description: Cancellation signalled. content: application/json: schema: type: object properties: status: { type: string, example: cancelling } run_id: { type: string } "404": { description: Run not found or does not belong to the task } "409": { description: Run is not currently running (already finished or never started). } /tasks/{id}/runs/{run_id}/reply: post: summary: Reply to an agent waiting for human input description: > Answers a waiting_human run's request_human question with text and continues the work. Starts a new run that resumes the prior provider session where supported (claude provider, unless the agent config has resume_sessions off) so the reply lands as the next message of the same conversation; other providers start cold with the reply injected into the prompt ("RESPONSE FROM HUMAN"). The task stays on its current label — this is a conversation, not a workflow transition — and the replied-to run keeps its waiting_human status, matching the approve/reject flows. The reply is recorded at the top of the new run's log. parameters: - name: id in: path required: true schema: { type: string } - name: run_id in: path required: true schema: { type: string } requestBody: required: true content: application/json: schema: type: object required: [message] properties: message: type: string description: The human's answer to the agent's question. responses: "202": description: Reply dispatched; a new run was created. content: application/json: schema: type: object properties: run_id: { type: string, description: The continuation run's id. } "400": { description: Missing/empty message } "404": { description: Run not found or does not belong to the task } "409": { description: Run is not the task's active waiting_human run, no enabled agent config can serve the reply, or a concurrent reply/move changed the task first (the dispatch-lock claim lost the race) } "503": { description: Worker pool is saturated } /tasks/{id}/runs/{run_id}/steer: post: summary: Send a steering note to a running agent description: > Valid only while the run is `running` (a waiting_human run uses the reply endpoint). The run is interrupted gracefully and ends with status `interrupted` (not a failure: no retry budget, consecutive-failure count, escalation or pause). The task's dispatch lock is handed straight to a follow-up run on the same task and label that resumes the same provider session where supported (otherwise cold-starts) with the note delivered as "STEERING NOTE FROM HUMAN". The note is stored in task_human_decisions (with the named-token actor) so later runs see it. parameters: - name: id in: path required: true schema: { type: string } - name: run_id in: path required: true schema: { type: string } requestBody: required: true content: application/json: schema: type: object required: [message] properties: message: type: string description: The steering note for the agent. responses: "202": description: Interrupt signalled; a follow-up run will carry the note. content: application/json: schema: type: object properties: status: { type: string, description: Always "steering". } run_id: { type: string, description: The run being interrupted. } "400": { description: Missing/empty message } "404": { description: Run not found or does not belong to the task } "409": { description: Run is not running, or is no longer active on this server } "503": { description: Steering is not available on this server } /tasks/{id}/runs/{run_id}/logs: get: summary: Get a page of logs for an agent run description: > Returns a page of the run's log entries in chronological order (oldest first). Omit `before` to get the most recent page (the tail); pass a previous response's X-Prev-Cursor as `before` to load earlier entries. parameters: - name: id in: path required: true schema: { type: string } - name: run_id in: path required: true schema: { type: string } - name: limit in: query description: Page size. Defaults to 200; values above 1000 are clamped to 1000. schema: { type: integer, default: 200, maximum: 1000 } - name: before in: query description: > Cursor to load earlier entries: the id of the oldest entry the caller already has (returned in the previous response's X-Prev-Cursor header). Omit for the newest page. schema: { type: string } responses: "200": description: > A page of log entries, oldest first. When earlier entries remain, X-Has-More is "true" and X-Prev-Cursor carries the id to pass as the next `before` cursor. headers: X-Has-More: description: '"true" when earlier entries exist before this page.' schema: { type: string } X-Prev-Cursor: description: Cursor (id) to pass as the next `before` to load earlier entries. schema: { type: string } content: application/json: schema: { type: array, items: { $ref: "#/components/schemas/AgentLog" } } /templates: get: summary: List task templates responses: "200": content: application/json: schema: { type: array, items: { $ref: "#/components/schemas/TaskTemplate" } } post: summary: Create a task template requestBody: required: true content: application/json: schema: type: object required: [name] properties: name: { type: string } title: { type: string } description: { type: string } type: { type: string, default: feature } responses: "201": content: application/json: schema: { $ref: "#/components/schemas/TaskTemplate" } "409": { description: A template with that name already exists } /templates/{id}: parameters: - name: id in: path required: true schema: { type: string } get: summary: Get a task template responses: "200": content: application/json: schema: { $ref: "#/components/schemas/TaskTemplate" } "404": { description: Template not found } put: summary: Update a task template requestBody: required: true content: application/json: schema: type: object required: [name] properties: name: { type: string } title: { type: string } description: { type: string } type: { type: string } responses: "200": content: application/json: schema: { $ref: "#/components/schemas/TaskTemplate" } "404": { description: Template not found } "409": { description: A template with that name already exists } delete: summary: Delete a task template responses: "204": { description: Deleted } /repos/{id}/lessons: parameters: - name: id in: path required: true schema: { type: string } get: summary: List a repo's own lessons (global lessons excluded) parameters: - name: status in: query required: false schema: { type: string, enum: [proposed, active, stale, retired] } responses: "200": content: application/json: schema: { type: array, items: { $ref: "#/components/schemas/RepoLesson" } } "400": { description: Invalid status filter } "404": { description: Repo not found } post: summary: Create a lesson for a repo requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/RepoLessonCreate" } responses: "201": content: application/json: schema: { $ref: "#/components/schemas/RepoLesson" } "400": { description: Invalid kind/status/source, empty or over-long body, or non-array citations } "404": { description: Repo not found } /repos/{id}/map: parameters: - name: id in: path required: true schema: { type: string } get: summary: Get a repo's generated map, config and staleness description: Pages come from the latest successful generation run; pages is empty when none exists. Disabled repos return their (default) config. responses: "200": description: The map content: application/json: schema: { $ref: "#/components/schemas/RepoMap" } "404": { description: Repo not found } /repos/{id}/map/config: parameters: - name: id in: path required: true schema: { type: string } put: summary: Set the repo's map opt-in and refresh policy requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/RepoMapConfigUpdate" } responses: "200": description: The saved config content: application/json: schema: { $ref: "#/components/schemas/RepoMapConfig" } "400": { description: Unknown provider config, enabling without a provider config, or a value out of range } "404": { description: Repo not found } /repos/{id}/map/generate: parameters: - name: id in: path required: true schema: { type: string } post: summary: Generate or refresh the repo's map now description: Starts a run in the background in a read-only scratch checkout of the default branch and returns the (still running) run row. responses: "202": description: Run started content: application/json: schema: { $ref: "#/components/schemas/RepoMapRun" } "400": { description: The map is not enabled for the repo, or its provider config is missing or unavailable } "404": { description: Repo not found } "409": { description: A run is already in progress, or a global cost ceiling is reached } /repos/{id}/map/runs: parameters: - name: id in: path required: true schema: { type: string } get: summary: List the repo's map generation runs, newest first parameters: - name: limit in: query required: false schema: { type: integer, minimum: 1, maximum: 100, default: 10 } responses: "200": content: application/json: schema: { type: array, items: { $ref: "#/components/schemas/RepoMapRun" } } "400": { description: Invalid limit } "404": { description: Repo not found } /settings/repo-map: get: summary: Get the global repo map injection settings responses: "200": content: application/json: schema: { $ref: "#/components/schemas/RepoMapSettings" } put: summary: Set the labels flagged for the REPO MAP prompt section and the agent configs that opted out requestBody: required: true content: application/json: schema: type: object properties: inject_labels: { type: array, items: { type: string } } excluded_agent_ids: { type: array, items: { type: string } } responses: "200": content: application/json: schema: { $ref: "#/components/schemas/RepoMapSettings" } "400": { description: A label name contains a comma or newline } /lessons: get: summary: List global lessons (repo_id null) parameters: - name: status in: query required: false schema: { type: string, enum: [proposed, active, stale, retired] } responses: "200": content: application/json: schema: { type: array, items: { $ref: "#/components/schemas/RepoLesson" } } "400": { description: Invalid status filter } post: summary: Create a global lesson requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/RepoLessonCreate" } responses: "201": content: application/json: schema: { $ref: "#/components/schemas/RepoLesson" } "400": { description: Invalid kind/status/source, empty or over-long body, or non-array citations } /lessons/{id}: parameters: - name: id in: path required: true schema: { type: string } patch: summary: Update a lesson (repo or global) requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/RepoLessonUpdate" } responses: "200": content: application/json: schema: { $ref: "#/components/schemas/RepoLesson" } "400": { description: Invalid field value } "404": { description: Lesson not found } delete: summary: Delete a lesson responses: "204": { description: Deleted } "404": { description: Lesson not found } /repos/{id}/lessons/distill: post: summary: Draft lessons for a repo from recent task history (distiller) description: >- Reads the repo's last 30 days of evidence (human rejection notes, human replies, rework failure feedback, repeated verify failures, "should have asked" notes), asks the provider config chosen for rule proposals for candidate lessons, validates them like human-created lessons, drops near-duplicates of existing or dismissed lessons and ones citing no real task, and stores at most 5 as `status=proposed`, `source=distiller`. Proposed lessons are never injected until accepted (PATCH the lesson to `status=active`). Runs in the background; poll distill-runs. parameters: - { name: id, in: path, required: true, schema: { type: string } } responses: "202": content: application/json: schema: { $ref: "#/components/schemas/LessonDistillRun" } "400": { description: No usable provider config set for proposals } "404": { description: Repo not found } "409": { description: A run is already in progress for this repo } /repos/{id}/lessons/distill-runs: get: summary: A repo's recent lesson distiller runs description: Newest first, with cost. parameters: - { name: id, in: path, required: true, schema: { type: string } } - { name: limit, in: query, schema: { type: integer, minimum: 1, maximum: 100, default: 10 } } responses: "200": content: application/json: schema: { type: array, items: { $ref: "#/components/schemas/LessonDistillRun" } } "400": { description: Invalid limit } "404": { description: Repo not found } /lessons/{id}/dismiss: post: summary: Dismiss a proposed distiller lesson description: Deletes the proposal and remembers its text so it is not offered again. parameters: - { name: id, in: path, required: true, schema: { type: string } } responses: "204": { description: Dismissed } "404": { description: Lesson not found } "409": { description: Lesson is not a proposed distiller lesson } /skills: get: summary: List skills responses: "200": description: Skills sorted by name content: application/json: schema: { type: array, items: { $ref: "#/components/schemas/Skill" } } post: summary: Create a skill from a SKILL.md body or a zip of a skill folder description: > Send JSON `{skill_md}` or an `application/zip` body (max 1 MB, at most 200 files; SKILL.md at the root or in a single top-level folder). Zips with path traversal, absolute paths or symlinks are rejected. requestBody: required: true content: application/json: schema: type: object required: [skill_md] properties: skill_md: { type: string } application/zip: schema: { type: string, format: binary } responses: "201": description: Created content: application/json: schema: { $ref: "#/components/schemas/Skill" } "400": { description: Invalid SKILL.md frontmatter or unsafe zip } "409": { description: A skill with that name already exists } /skills/{id}: parameters: - name: id in: path required: true schema: { type: string } get: summary: Get a skill with its SKILL.md and file list responses: "200": description: The skill content: application/json: schema: { $ref: "#/components/schemas/Skill" } "404": { description: Skill not found } patch: summary: Enable/disable a skill and/or replace its content description: > JSON `{enabled?, skill_md?}` or an `application/zip` body replacing the content. Replacement content must keep the skill's name. requestBody: required: true content: application/json: schema: type: object properties: enabled: { type: boolean } skill_md: { type: string } application/zip: schema: { type: string, format: binary } responses: "200": description: Updated content: application/json: schema: { $ref: "#/components/schemas/Skill" } "400": { description: Invalid content or name mismatch } "404": { description: Skill not found } delete: summary: Delete a skill (also detaches it everywhere) responses: "204": { description: Deleted } "404": { description: Skill not found } /agents/{id}/skills: parameters: - name: id in: path required: true schema: { type: string } get: summary: List skills attached to an agent config responses: "200": description: Attached skills content: application/json: schema: { type: array, items: { $ref: "#/components/schemas/Skill" } } "404": { description: Agent config not found } put: summary: Replace the set of skills attached to an agent config requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/SkillIDs" } responses: "200": description: The new attached set content: application/json: schema: { type: array, items: { $ref: "#/components/schemas/Skill" } } "400": { description: Unknown skill id } "404": { description: Agent config not found } /repos/{id}/skills: parameters: - name: id in: path required: true schema: { type: string } get: summary: List skills attached to a repo responses: "200": description: Attached skills content: application/json: schema: { type: array, items: { $ref: "#/components/schemas/Skill" } } "404": { description: Repo not found } put: summary: Replace the set of skills attached to a repo requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/SkillIDs" } responses: "200": description: The new attached set content: application/json: schema: { type: array, items: { $ref: "#/components/schemas/Skill" } } "400": { description: Unknown skill id } "404": { description: Repo not found } /schedules: get: summary: List task schedules responses: "200": content: application/json: schema: { type: array, items: { $ref: "#/components/schemas/TaskSchedule" } } post: summary: Create a task schedule requestBody: required: true content: application/json: schema: type: object required: [template_id, repo_id, cron_expr] properties: template_id: { type: string } repo_id: { type: string } cron_expr: { type: string } target_label: { type: string, description: "Empty defaults to the repo workflow's human-gate label (lowest sort_order agent_ignore label, else the first label; 'not_ready' in the default workflow)." } enabled: { type: boolean, default: true } responses: "201": content: application/json: schema: { $ref: "#/components/schemas/TaskSchedule" } "400": { description: Missing/invalid template_id, repo_id, or cron_expr } "404": { description: Template or repo not found } /schedules/{id}: parameters: - name: id in: path required: true schema: { type: string } get: summary: Get a task schedule responses: "200": content: application/json: schema: { $ref: "#/components/schemas/TaskSchedule" } "404": { description: Schedule not found } put: summary: Update a task schedule requestBody: required: true content: application/json: schema: type: object required: [cron_expr] properties: cron_expr: { type: string } target_label: { type: string, description: "Empty defaults to the repo workflow's human-gate label (lowest sort_order agent_ignore label, else the first label; 'not_ready' in the default workflow)." } enabled: { type: boolean, default: true } responses: "200": content: application/json: schema: { $ref: "#/components/schemas/TaskSchedule" } "400": { description: Invalid cron_expr } "404": { description: Schedule not found } delete: summary: Delete a task schedule responses: "204": { description: Deleted } /intake-rules: get: summary: List intake routing rules description: > Ordered by sort_order then created_at — the same order rule evaluation walks (first-match-wins). responses: "200": content: application/json: schema: { type: array, items: { $ref: "#/components/schemas/IntakeRule" } } post: summary: Create an intake routing rule requestBody: required: true content: application/json: schema: type: object required: [name] properties: name: { type: string } enabled: { type: boolean, default: true } sort_order: { type: integer, default: 0 } match_source: { type: string, enum: ['', manual, issue, schedule, webhook, subtask] } match_repo_id: { type: string, nullable: true } match_labels: { type: array, items: { type: string } } match_title_pattern: { type: string } match_body_pattern: { type: string } match_author_assoc: { type: array, items: { type: string, enum: [OWNER, MEMBER, COLLABORATOR, CONTRIBUTOR, NONE] } } apply_template_id: { type: string, nullable: true } apply_priority: { type: integer, nullable: true, enum: [-1, 0, 1, 2] } apply_target_label: { type: string } apply_workflow_id: { type: string, nullable: true } apply_max_cost_usd: { type: number, format: double, nullable: true } responses: "201": content: application/json: schema: { $ref: "#/components/schemas/IntakeRule" } "400": { description: "Invalid body — including the auto-start safety-gate rejection: apply_target_label targets an agent-triggerable label without match_author_assoc restricted to OWNER/MEMBER/COLLABORATOR" } "404": { description: match_repo_id, apply_template_id, or apply_workflow_id not found } /intake-rules/preview: post: summary: Preview which recently-imported tasks a rule would match description: > Evaluates an unsaved (or being-edited) rule body against the most recently imported tasks for a repo, using the same intake.Match function the importer and scheduler call at runtime, so preview and runtime behaviour can never disagree. Previews against already-imported task history for the repo rather than making a live forge API call. requestBody: required: true content: application/json: schema: type: object required: [repo_id, rule] properties: repo_id: { type: string } limit: { type: integer, default: 50, maximum: 50, description: "Number of most-recently-imported tasks to check." } rule: type: object description: An unsaved IntakeRule body — same shape as POST /intake-rules's request body. responses: "200": content: application/json: schema: type: object properties: matches: type: array items: type: object properties: task_id: { type: string } title: { type: string } matched: { type: boolean } target_label: { type: string } priority: { type: integer, nullable: true } max_cost_usd: { type: number, format: double, nullable: true } "400": { description: Missing repo_id or invalid rule body } "404": { description: Repo not found } /intake-rules/{id}: parameters: - name: id in: path required: true schema: { type: string } get: summary: Get an intake routing rule responses: "200": content: application/json: schema: { $ref: "#/components/schemas/IntakeRule" } "404": { description: Rule not found } put: summary: Update an intake routing rule requestBody: required: true content: application/json: schema: type: object required: [name] properties: name: { type: string } enabled: { type: boolean, default: true } sort_order: { type: integer, default: 0 } match_source: { type: string, enum: ['', manual, issue, schedule, webhook, subtask] } match_repo_id: { type: string, nullable: true } match_labels: { type: array, items: { type: string } } match_title_pattern: { type: string } match_body_pattern: { type: string } match_author_assoc: { type: array, items: { type: string, enum: [OWNER, MEMBER, COLLABORATOR, CONTRIBUTOR, NONE] } } apply_template_id: { type: string, nullable: true } apply_priority: { type: integer, nullable: true, enum: [-1, 0, 1, 2] } apply_target_label: { type: string } apply_workflow_id: { type: string, nullable: true } apply_max_cost_usd: { type: number, format: double, nullable: true } responses: "200": content: application/json: schema: { $ref: "#/components/schemas/IntakeRule" } "400": { description: "Invalid body — including the auto-start safety-gate rejection (see POST /intake-rules)" } "404": { description: Rule, match_repo_id, apply_template_id, or apply_workflow_id not found } delete: summary: Delete an intake routing rule responses: "204": { description: Deleted } /workflows: get: summary: List workflows parameters: - name: limit in: query description: Page size. Defaults to 200; values above 500 are clamped to 500. schema: { type: integer, default: 200, maximum: 500 } - name: after in: query description: > Cursor for the next page: the id of the last workflow from the previous page (returned in that response's X-Next-Cursor header). Omit for the first page. schema: { type: string } responses: "200": description: > A page of workflows, newest first. When more workflows remain, the id to pass as the next `after` cursor is returned in the X-Next-Cursor header (absent on the final page). headers: X-Next-Cursor: description: Cursor for the next page; absent when no more workflows remain. schema: { type: string } content: application/json: schema: { type: array, items: { $ref: "#/components/schemas/Workflow" } } post: summary: Create a workflow responses: "201": content: application/json: schema: { $ref: "#/components/schemas/Workflow" } /workflows/import: post: summary: Import a workflow from a YAML body description: > Creates a new workflow from a YAML document with the same shape produced by GET /workflows/{id}/export.yaml (name, description, labels, transitions). Fails if a workflow with the same name already exists. Labels may carry an optional autonomy block (mode, ask_on, hold, max_cost_usd); see WorkflowLabel.autonomy. requestBody: required: true content: application/yaml: schema: { type: string } responses: "201": content: application/json: schema: { $ref: "#/components/schemas/Workflow" } "400": { description: Invalid YAML, missing name, duplicate name, or invalid label color or autonomy block } /workflows/{id}/labels/{label}/autonomy/backtest: post: summary: Backtest a proposed autonomy setting for a gate label description: > Read-only. Replays every human exit from the gate label in the last `days` days (default 30, max 90; forced moves ignored) and reports what the proposed setting would have done. Exits via the success path are `approved`, via the failure path `rejected`. Inputs are recomputed as of each pass (branch diff at that time, verify status of the latest run, cost so far); flags are only computed for `on_flags`. Passes whose branch or commit is gone are `unknown` and excluded from the tallies. Capped at the 500 most recent passes (`truncated`); on timeout the remaining passes are `unknown` and `timed_out` is true. parameters: - name: id in: path required: true schema: { type: string } - name: label in: path required: true schema: { type: string } requestBody: required: true content: application/json: schema: type: object required: [mode] properties: mode: { type: string, enum: [ask, on_flags, auto] } ask_on: { type: array, items: { type: string } } max_cost_usd: { type: number, nullable: true } days: { type: integer, minimum: 1, maximum: 90, default: 30 } extra_rules: type: array description: Draft ask rules to include in the replay (scoped to this gate). Each may carry an optional repo_id. items: { $ref: "#/components/schemas/AskRuleInput" } responses: "200": content: application/json: schema: { $ref: "#/components/schemas/AutonomyBacktest" } "400": { description: Invalid body, or the label is not a human gate } "404": { description: Workflow or label not found } /workflows/{id}: parameters: - name: id in: path required: true schema: { type: string } get: summary: Get a workflow with labels and transitions responses: "200": content: application/json: schema: { $ref: "#/components/schemas/Workflow" } put: summary: Replace workflow labels and transitions responses: "200": content: application/json: schema: { $ref: "#/components/schemas/Workflow" } "400": { description: Duplicate workflow name or invalid label color or autonomy block or autonomy block } delete: summary: Delete a workflow responses: "204": { description: Deleted } /workflows/{id}/export.yaml: get: summary: Export a workflow as YAML description: > Returns the workflow's name, description, labels, and transitions as a portable YAML document (Content-Disposition: attachment), suitable for re-importing via POST /workflows/import or PUT /workflows/{id}/yaml. Labels with a non-ask autonomy policy include an autonomy block (mode, ask_on, hold, max_cost_usd). parameters: - name: id in: path required: true schema: { type: string } responses: "200": description: A YAML document describing the workflow content: application/yaml: schema: { type: string } "404": { description: Workflow not found } /workflows/{id}/yaml: put: summary: Replace a workflow's labels and transitions from a YAML body description: > Same YAML shape as GET /workflows/{id}/export.yaml. Replaces the workflow's name/description and fully replaces its labels and transitions (delete-then-recreate). parameters: - name: id in: path required: true schema: { type: string } requestBody: required: true content: application/yaml: schema: { type: string } responses: "200": content: application/json: schema: { $ref: "#/components/schemas/Workflow" } "400": { description: Invalid YAML, missing name, duplicate name, or invalid label color or autonomy block } "404": { description: Workflow not found } /agents: get: summary: List agent configs parameters: - name: limit in: query description: Page size. Defaults to 200; values above 500 are clamped to 500. schema: { type: integer, default: 200, maximum: 500 } - name: after in: query description: > Cursor for the next page: the id of the last agent config from the previous page (returned in that response's X-Next-Cursor header). Omit for the first page. schema: { type: string } responses: "200": description: > A page of agent configs (enabled or not), newest first. When more configs remain, the id to pass as the next `after` cursor is returned in the X-Next-Cursor header (absent on the final page). headers: X-Next-Cursor: description: Cursor for the next page; absent when no more configs remain. schema: { type: string } content: application/json: schema: { type: array, items: { $ref: "#/components/schemas/AgentConfig" } } post: summary: Create an agent config responses: "201": content: application/json: schema: { $ref: "#/components/schemas/AgentConfig" } /agents/{id}: parameters: - name: id in: path required: true schema: { type: string } get: summary: Get an agent config responses: "200": content: application/json: schema: { $ref: "#/components/schemas/AgentConfig" } put: summary: Update an agent config responses: "200": content: application/json: schema: { $ref: "#/components/schemas/AgentConfig" } delete: summary: Delete an agent config responses: "204": { description: Deleted } /agents/{id}/versions: parameters: - name: id in: path required: true schema: { type: string } get: summary: List an agent config's version history (newest first, with snapshots) responses: "200": content: application/json: schema: { type: array, items: { $ref: "#/components/schemas/AgentConfigVersion" } } "404": { description: Not found } /agents/{id}/versions/{version}: parameters: - name: id in: path required: true schema: { type: string } - name: version in: path required: true schema: { type: integer } get: summary: Get one version snapshot responses: "200": content: application/json: schema: { $ref: "#/components/schemas/AgentConfigVersion" } "400": { description: Non-integer version } "404": { description: Not found } /agents/{id}/versions/{version}/restore: parameters: - name: id in: path required: true schema: { type: string } - name: version in: path required: true schema: { type: integer } post: summary: Restore a version as a new version description: > Applies the snapshot onto the current config (name, labels, enabled and priority are kept) and records a new version, unless the result is identical to the current config. Provider configs referenced by the snapshot are re-validated. requestBody: required: false content: application/json: schema: type: object properties: note: { type: string } responses: "200": content: application/json: schema: { $ref: "#/components/schemas/AgentConfig" } "400": { description: Snapshot references a deleted provider config or is otherwise invalid } "404": { description: Not found } /agents/{id}/experiments: parameters: - name: id in: path required: true schema: { type: string } get: summary: List an agent config's A/B experiments (newest first, without results) responses: "200": content: application/json: schema: { type: array, items: { $ref: "#/components/schemas/AgentExperiment" } } "404": { description: Not found } post: summary: Start an A/B experiment description: > Runs the candidate snapshot on a deterministic share of tasks that first reach this agent's label; the rest keep the current config. At most one experiment runs per agent config. requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/AgentExperimentStart" } responses: "201": content: application/json: schema: { $ref: "#/components/schemas/AgentExperiment" } "400": { description: Invalid share, invalid candidate, or candidate identical to the current config } "404": { description: Not found } "409": { description: An experiment is already running for this agent } /agents/{id}/experiments/{experimentId}: parameters: - name: id in: path required: true schema: { type: string } - name: experimentId in: path required: true schema: { type: string } get: summary: Get one experiment with per-arm results responses: "200": content: application/json: schema: { $ref: "#/components/schemas/AgentExperiment" } "404": { description: Not found } /agents/{id}/experiments/{experimentId}/stop: parameters: - name: id in: path required: true schema: { type: string } - name: experimentId in: path required: true schema: { type: string } post: summary: Stop a running experiment (all later runs use the current config) responses: "200": content: application/json: schema: { $ref: "#/components/schemas/AgentExperiment" } "404": { description: Not found } "409": { description: Experiment is not running } /agents/{id}/experiments/{experimentId}/promote: parameters: - name: id in: path required: true schema: { type: string } - name: experimentId in: path required: true schema: { type: string } post: summary: Promote the candidate to the agent's new version description: > Applies the candidate onto the current config (like a version restore), records a new version, marks the experiment promoted and tags the candidate-arm runs with the new version. requestBody: required: false content: application/json: schema: type: object properties: note: { type: string } responses: "200": content: application/json: schema: { $ref: "#/components/schemas/AgentExperimentPromoteResponse" } "400": { description: Candidate references a deleted provider config or is otherwise invalid } "404": { description: Not found } "409": { description: Experiment is not running } /agents/models: get: summary: Get available models for a provider parameters: - name: provider in: query required: true schema: { type: string } responses: "200": description: Model list for the provider content: application/json: schema: { $ref: "#/components/schemas/ModelList" } "400": description: Missing provider parameter "404": description: Unknown provider /agents/claude-options: get: summary: Get available Claude plugins and MCP servers for agent config selection description: > Claude-provider-specific. Discovers plugins from ~/.claude/plugins/installed_plugins.json and user-level MCP servers from ~/.claude.json's global mcpServers key on the server. responses: "200": description: Discovered Claude plugins and MCP servers content: application/json: schema: { $ref: "#/components/schemas/ClaudeOptions" } /provider-configs: get: summary: List provider configs parameters: - name: limit in: query description: Page size. Defaults to 200; values above 500 are clamped to 500. schema: { type: integer, default: 200, maximum: 500 } - name: after in: query description: > Cursor for the next page: the id of the last provider config from the previous page (returned in that response's X-Next-Cursor header). Omit for the first page. schema: { type: string } responses: "200": description: > A page of provider configs, newest first. When more configs remain, the id to pass as the next `after` cursor is returned in the X-Next-Cursor header (absent on the final page). headers: X-Next-Cursor: description: Cursor for the next page; absent when no more configs remain. schema: { type: string } content: application/json: schema: { type: array, items: { $ref: "#/components/schemas/ProviderConfig" } } post: summary: Create a provider config responses: "201": content: application/json: schema: { $ref: "#/components/schemas/ProviderConfig" } "400": { description: Missing name/provider, unknown provider, or env is not a JSON object of string values } /provider-configs/{id}: parameters: - name: id in: path required: true schema: { type: string } get: summary: Get a provider config responses: "200": content: application/json: schema: { $ref: "#/components/schemas/ProviderConfig" } "404": { description: Provider config not found } put: summary: Update a provider config description: > Partial update — omitted fields (including model) keep their existing values. `env` follows its own merge rule when present and non-empty (see ProviderConfig.env): a `"***"` value keeps the existing stored value for that key, any other value overwrites, and a key omitted from the `env` object is deleted. Omitting `env` altogether (empty string / absent) leaves the whole env unchanged. responses: "200": content: application/json: schema: { $ref: "#/components/schemas/ProviderConfig" } "400": { description: Unknown provider, or env is not a JSON object of string values } "404": { description: Provider config not found } delete: summary: Delete a provider config description: > Blocked with 409 if any agent config or chat session still references this provider config. responses: "204": { description: Deleted } "409": { description: Provider config still referenced by an agent config or chat session } /repos: get: summary: List repos parameters: - name: limit in: query description: Page size. Defaults to 200; values above 500 are clamped to 500. schema: { type: integer, default: 200, maximum: 500 } - name: after in: query description: > Cursor for the next page: the id of the last repo from the previous page (returned in that response's X-Next-Cursor header). Omit for the first page. schema: { type: string } responses: "200": description: > A page of repos, newest first. When more repos remain, the id to pass as the next `after` cursor is returned in the X-Next-Cursor header (absent on the final page). headers: X-Next-Cursor: description: Cursor for the next page; absent when no more repos remain. schema: { type: string } content: application/json: schema: { type: array, items: { $ref: "#/components/schemas/Repo" } } post: summary: Register a repo description: > The body also accepts verify_command (string) and verify_timeout_seconds (integer, 1-3600); see the Repo schema. It also accepts preview_command, preview_routes and preview_paths_glob (strings). It also accepts the pr_review_* policy fields (see the Repo schema). It also accepts auto_merge_mode (off|when_green) and auto_merge_method (squash|merge|rebase). responses: "201": content: application/json: schema: { $ref: "#/components/schemas/Repo" } /repos/{id}: parameters: - name: id in: path required: true schema: { type: string } get: summary: Get a repo responses: "200": content: application/json: schema: { $ref: "#/components/schemas/Repo" } patch: summary: Update a repo description: > Partial update — all fields are optional and merge with the repo's existing values. Setting remote_url or workflow_id to an empty string clears it (nullable). requestBody: content: application/json: schema: type: object properties: name: { type: string } path: { type: string } remote_url: { type: string, nullable: true } workflow_id: { type: string, nullable: true } issue_sync_enabled: { type: boolean } issue_sync_label: { type: string } issue_writeback_enabled: { type: boolean } issue_writeback_label: { type: string } pr_review_auto_transition_enabled: { type: boolean } pr_review_enabled: { type: boolean, description: "Enable the review-only PR path (requires remote_url). See Repo.pr_review_enabled." } pr_review_author_assocs: type: array items: { type: string, enum: [OWNER, MEMBER, COLLABORATOR, CONTRIBUTOR, FIRST_TIME_CONTRIBUTOR, FIRST_TIMER, NONE] } description: Author-association allowlist; omit to leave unchanged, empty array resets to the default. pr_review_label: { type: string } pr_review_skip_drafts: { type: boolean } pr_review_workflow_id: { type: string, nullable: true, description: "Empty string clears (use the seeded PR review workflow)." } pr_review_target_label: { type: string } review_reply_enabled: { type: boolean } review_reply_resolve_enabled: { type: boolean } issue_sync_update_policy: type: string enum: [gate, always, never] issue_sync_gone_action: type: string enum: [flag, archive, move] issue_sync_gone_label: { type: string } issue_comment_sync_enabled: { type: boolean } runtime_languages: type: array items: { $ref: "#/components/schemas/RuntimeLanguagePin" } description: > Replaces the repo's toolchain pins. Omit the field to leave existing pins untouched; pass an empty array to clear them back to unconfigured. verify_command: type: string description: Replaces the repo's verify command; empty string disables verification. Omit to leave unchanged. verify_timeout_seconds: type: integer minimum: 1 maximum: 3600 description: Replaces the verify timeout. Omit to leave unchanged. preview_command: type: string description: Replaces the preview command; empty string disables previews. Omit to leave unchanged. preview_routes: type: string description: Replaces the newline-separated preview routes. Omit to leave unchanged. preview_paths_glob: type: string description: Replaces the newline-separated UI path globs (empty = defaults). Omit to leave unchanged. auto_merge_mode: type: string enum: [off, when_green] description: Auto-merge policy. Omit to leave unchanged. auto_merge_method: type: string enum: [squash, merge, rebase] description: Auto-merge method. Omit to leave unchanged. responses: "200": content: application/json: schema: { $ref: "#/components/schemas/Repo" } "404": { description: Repo not found } delete: summary: Remove a repo responses: "204": { description: Removed } /repos/{id}/tree: get: summary: Get repo file tree parameters: - name: id in: path required: true schema: { type: string } - name: ref in: query schema: { type: string, default: HEAD } responses: "200": content: application/json: schema: type: object properties: ref: { type: string } files: { type: array, items: { type: string } } /repos/{id}/runtime/detect: post: summary: Detect suggested toolchain pins from the repo's manifest files description: > Scans the repo's root directory (never a task worktree) for well-known toolchain manifest files (go.mod, .nvmrc/.node-version, .python-version, rust-toolchain(.toml), .ruby-version, .java-version, project.godot) and returns a suggested pin for each one found. A symlinked manifest is skipped and reads are capped at 64KB. Detection NEVER writes to the repo's saved runtime_languages — the UI pre-fills the runtime form with these suggestions and a human must still save explicitly. No LLM fallback; manifest scan only. parameters: - name: id in: path required: true schema: { type: string } responses: "200": content: application/json: schema: type: object properties: suggestions: type: array items: allOf: - $ref: "#/components/schemas/RuntimeLanguagePin" - type: object properties: source: type: string description: The manifest file this suggestion was read from, e.g. "go.mod". required: [source] "404": { description: Repo not found } /needs-me: get: summary: Tasks that need a human, oldest first description: > The single server-side definition of "needs me". Each task appears at most once with one primary reason; precedence is waiting_human > change_set_partial > pr_conflict > auto_approving > human_gate. waiting_human: the task's active run is waiting for input (run_id and message set). change_set_partial: a parent task whose change set (ADR 0041) has at least one merged foreign-child PR and at least one failed one (PR closed unmerged, or the PR never landed after a permanent push/PR failure); shown even when paused or terminal, with a change_set listing both groups. ATE never reverts merged work; rerun the failed child or archive it to clear. pr_conflict: the task has an open PR marked as conflicting. human_gate: the task sits on a non-terminal, non-agent_ignore label with no agent-triggerable outbound transition and at least one human transition, with no live run. auto_approving: a human_gate task with a pending autonomy auto-approval (due_at set); it is never also reported as human_gate. The separate approved_by_policy list holds tasks the policy approved in the last 24 hours. Archived and (for pr_conflict/human_gate) paused tasks are excluded. responses: "200": description: OK content: application/json: schema: { $ref: "#/components/schemas/NeedsMeResponse" } /dashboard: get: summary: Get dashboard summary responses: "200": content: application/json: schema: { $ref: "#/components/schemas/Dashboard" } /dashboard/cost-by-task: get: summary: Per-task cost rollup (full, uncapped) description: > Returns { task_id, input_tokens, output_tokens, cost_usd } for every task with at least one agent_runs row, across every run status (not just terminal ones — see docs/agents.md#cost-budgets). Unlike Dashboard.cost_by_task this has no top-N cap and omits task_title; it backs the Board page's "Filtered cost" badge, which needs a cost figure for every currently-visible task, not just the most expensive ones. responses: "200": content: application/json: schema: type: array items: type: object properties: task_id: { type: string } input_tokens: { type: integer } output_tokens: { type: integer } cost_usd: { type: number, format: double } /dashboard/outcome-quality: get: summary: Per-agent-config outcome-quality analytics (rework, cost-to-done, review burden, human-touch, escalation) description: > Returns the OutcomeQuality analytics table: per-agent-config rework rate, cost-to-done, review burden, human-touch rate, and escalation rate — metrics that answer "did the work stick", which Dashboard.agent_config_stats' success_rate_percent cannot. Computed from a full scan of task_label_history and agent_runs, so results are cached for a short TTL rather than being live — see docs/api.md#dashboard. Optionally scoped to a single repo via ?repo_id=, since aggregate cross-repo numbers can hide a config that is excellent on one codebase and poor on another. Use ?group_by= to break rows down by version, provider config, repo or task type (default: config). parameters: - name: repo_id in: query description: > When set, every metric is recomputed over only the tasks belonging to this repo instead of the cached all-repos snapshot. schema: { type: string } - name: group_by in: query description: Break rows down by this dimension. Invalid values return 400. schema: { type: string, enum: [config, version, provider_config, repo, task_type], default: config } responses: "200": content: application/json: schema: { $ref: "#/components/schemas/OutcomeQuality" } /healthz: get: summary: Liveness probe description: > Simple liveness probe, always 200 OK. Reports the running build's version ("dev" for local/unstamped builds, or the release tag e.g. "v1.4.0" for GHCR images, stamped at build time via `-ldflags "-X main.Version="`). Deliberately fast/side-effect free — unlike /health/providers, it never shells out to gh or touches the network. Served at the server root, not under /api/v1. responses: "200": description: Liveness status and running version content: application/json: schema: type: object properties: status: { type: string, example: "ok" } version: { type: string, example: "v1.4.0" } /github/auth-status: get: summary: Report whether the gh CLI is authenticated description: > Used by the frontend to warn on load when GitHub credentials are missing, before a user hits a failed PR-creation attempt. responses: "200": content: application/json: schema: type: object properties: authed: { type: boolean } note: { type: string } /automation-recipes: get: summary: List automation recipes description: > Bundled one-click presets (see docs/task-templates.md#automation-recipes) with their install parameters and installed state. responses: "200": description: Recipes content: application/json: schema: { type: array, items: { $ref: "#/components/schemas/AutomationRecipe" } } /automation-recipes/{id}/install: parameters: - name: id in: path required: true schema: { type: string } post: summary: Install an automation recipe description: > Creates the recipe's template, schedule and/or intake endpoint + rule in one transaction, tagged with the recipe id. An empty `target_label` parks created tasks on the workflow's human-review label. A non-gate label is rejected with code `auto_start_confirmation_required` unless `confirm_auto_start` is true. For webhook recipes the response carries the endpoint URL and HMAC secret (shown once) and a paste-ready sender snippet. requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/AutomationRecipeInstallRequest" } responses: "201": description: Installed content: application/json: schema: { $ref: "#/components/schemas/AutomationRecipeInstallResult" } "400": { description: "Validation error (or auto_start_confirmation_required)" } "404": { description: Recipe not found } "409": { description: Already installed, or the template name is taken } /automation-recipes/{id}: parameters: - name: id in: path required: true schema: { type: string } delete: summary: Remove an installed automation recipe description: Deletes only the objects tagged with this recipe id. Tasks already created are kept. responses: "204": { description: Removed } "404": { description: Recipe unknown or not installed } /intake-endpoints: get: summary: List intake webhook endpoints responses: "200": description: Endpoints (secrets omitted) content: application/json: schema: { type: array, items: { $ref: "#/components/schemas/IntakeEndpoint" } } post: summary: Create an intake webhook endpoint description: The response includes the generated HMAC `secret`; it is not retrievable again. requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/IntakeEndpointBody" } responses: "201": description: Created content: application/json: schema: { $ref: "#/components/schemas/IntakeEndpointCreated" } "400": { description: Validation error } /intake-endpoints/{id}: parameters: - name: id in: path required: true schema: { type: string } get: summary: Get an intake webhook endpoint responses: "200": description: The endpoint (secret omitted) content: application/json: schema: { $ref: "#/components/schemas/IntakeEndpoint" } "404": { description: Not found } put: summary: Update an intake webhook endpoint description: Does not change the secret; use rotate-secret. requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/IntakeEndpointBody" } responses: "200": description: Updated content: application/json: schema: { $ref: "#/components/schemas/IntakeEndpoint" } "400": { description: Validation error } "404": { description: Not found } delete: summary: Delete an intake webhook endpoint responses: "204": { description: Deleted } /intake-endpoints/{id}/rotate-secret: parameters: - name: id in: path required: true schema: { type: string } post: summary: Rotate an endpoint's HMAC secret description: The old secret stops working immediately. The new one is shown only in this response. responses: "200": description: New secret content: application/json: schema: type: object properties: secret: { type: string } required: [secret] "404": { description: Not found } /intake-endpoints/{id}/test: parameters: - name: id in: path required: true schema: { type: string } post: summary: Preview how a sample payload would be turned into a task description: Renders the templates and runs intake rules. Creates nothing. requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/IntakeEndpointTestRequest" } responses: "200": description: Rendered preview content: application/json: schema: { $ref: "#/components/schemas/IntakeEndpointTestResponse" } "400": { description: Missing or invalid payload } "404": { description: Not found } "422": { description: No workflow resolvable } /intake/{endpoint_id}: post: summary: Deliver a signed event to an intake endpoint description: > NOT behind bearer auth; authenticated by the HMAC-SHA256 of the raw body, keyed with the endpoint secret, sent as `X-ATE-Signature-256: sha256=` (constant-time compare). Body is capped at 256 KB, must be a JSON object, and each endpoint accepts at most 30 authenticated requests per minute. Creates a task (source `webhook`, on the workflow's gate label unless the endpoint sets a target label), or, when the dedupe key matches an open task, appends the event as an untrusted source comment to it. See docs/task-sources.md. security: [] parameters: - { name: endpoint_id, in: path, required: true, schema: { type: string } } - { name: X-ATE-Signature-256, in: header, required: true, schema: { type: string, example: "sha256=..." } } requestBody: required: true content: application/json: schema: { type: object, additionalProperties: true } responses: "200": description: Deduplicated into an existing open task content: application/json: schema: type: object properties: task_id: { type: string } deduped: { type: boolean } "201": description: Task created content: application/json: schema: type: object properties: task_id: { type: string } created: { type: boolean } "400": { description: Unreadable body, invalid JSON, or not an object } "401": { description: Missing or invalid signature } "403": { description: Endpoint disabled } "404": { description: Unknown endpoint } "413": { description: Body larger than 256 KB } "415": { description: Content type is not application/json } "422": { description: No workflow resolvable for the endpoint } "429": description: Rate limit exceeded headers: Retry-After: { schema: { type: integer } } /github/webhook: post: summary: Receive a GitHub webhook delivery description: > Optional push channel that refreshes task PR state immediately instead of waiting for the next ghsync poll. NOT behind bearer auth (GitHub cannot send the API token); authenticated instead by the HMAC-SHA256 `X-Hub-Signature-256` header computed with `GITHUB_WEBHOOK_SECRET` (constant-time compare). Returns 404 when `GITHUB_WEBHOOK_SECRET` is unset. Body capped at 2 MB. Handled events: `ping`, `pull_request` (opened, closed, reopened, synchronize, edited, ready_for_review, converted_to_draft), `pull_request_review`, `pull_request_review_comment`, `issue_comment` (on PRs), `check_suite` / `check_run` (completed) and `status`. Payload fields only select which tasks to refresh; state is re-fetched from the forge. Deliveries are deduplicated by `X-GitHub-Delivery` and refreshes are debounced per task; work runs asynchronously after the response. Content type must be `application/json`. See docs/task-sources.md. security: [] parameters: - { name: X-GitHub-Event, in: header, required: true, schema: { type: string } } - { name: X-GitHub-Delivery, in: header, required: false, schema: { type: string } } - { name: X-Hub-Signature-256, in: header, required: true, schema: { type: string, example: "sha256=..." } } requestBody: required: true content: application/json: schema: { type: object, additionalProperties: true } responses: "200": description: ping answered, or duplicate delivery ignored content: application/json: schema: type: object properties: status: { type: string, enum: [pong, duplicate] } "202": description: Accepted; matching tasks are refreshed in the background content: application/json: schema: type: object properties: status: { type: string, enum: [accepted] } "204": description: Event or action not handled "400": description: Unreadable body or invalid JSON "401": description: Missing or invalid signature "404": description: Webhook receiver disabled (GITHUB_WEBHOOK_SECRET unset) "413": description: Body too large /health/providers: get: summary: Provider / onboarding readiness checks description: > Reports the readiness of each agent provider and supporting piece of infrastructure so first-run misconfiguration is visible at a glance instead of surfacing as a failed agent run. Checks the claude CLI (present + authenticated), qwen/opencode binaries (only for providers actually referenced by an enabled agent config or a chat session, via their Provider Config — an unused/disabled Provider Config produces no check), the MCP sidecar binary (MCP_SERVER_PATH), gh auth, REPO_BASE_DIR, auto_backup (whether the automatic local-snapshot scheduler is enabled via BACKUP_DIR — see docs/backup.md), and version (the running build's version — see /healthz). Also includes an opt-in update_check row (UPDATE_CHECK_ENABLED, default false) that compares the running version against the latest GitHub release tag; best-effort and never fails the response (degrades to warn when offline or gh is unavailable). Checks are cheap and side-effect free (PATH lookups, credential/config-file existence, env/config values) — no real agent invocation is performed, so a green result means "ready as far as we can tell", not a live token validation. Also lists paused_providers: provider kinds whose dispatch the provider circuit breaker paused after a run was classified as an auth failure (CLI not logged in). Queued tasks for a paused provider are left untouched; the pause lifts automatically once that provider's health check passes again, or manually via POST /health/providers/{provider}/resume. The pause state is held in memory and resets on restart. Changes are broadcast as the provider.pause_changed WebSocket event ({provider, paused}). responses: "200": description: Ordered list of readiness checks content: application/json: schema: type: object properties: checks: type: array items: { $ref: "#/components/schemas/ProviderCheck" } paused_providers: type: array items: { $ref: "#/components/schemas/PausedProvider" } /health/providers/{provider}/resume: post: summary: Manually resume a paused provider description: > Clears the provider circuit breaker for a provider kind (e.g. claude) so dispatch resumes on the next sweep. If the provider is still not logged in, the next auth-classified run pauses it again. Idempotent. parameters: - name: provider in: path required: true schema: { type: string } responses: "200": description: Whether the provider was paused before this call content: application/json: schema: type: object properties: resumed: { type: boolean } required: [resumed] /uploads/{task_id}/{filename}: get: summary: Download a task attachment file description: > Serves a task attachment image. Responses always include X-Content-Type-Options: nosniff and Content-Disposition: inline; filename="" (#142). Content-Type is derived from the stored file extension, which is itself derived from the sniffed image MIME type at upload time rather than any client-supplied filename. parameters: - name: task_id in: path required: true schema: { type: string } - name: filename in: path required: true schema: { type: string } responses: "200": description: The attachment file headers: X-Content-Type-Options: schema: { type: string, enum: [nosniff] } description: Always set to prevent MIME-sniffing in the browser. Content-Disposition: schema: { type: string, example: 'inline; filename=""' } description: > Always set to a non-attachment, filename-less inline disposition. content: application/octet-stream: schema: type: string format: binary image/png: schema: type: string format: binary image/jpeg: schema: type: string format: binary image/gif: schema: type: string format: binary image/webp: schema: type: string format: binary "400": { description: Invalid path component } "404": { description: File not found } /backup: get: summary: Download a consistent database snapshot description: > Streams a consistent point-in-time snapshot of the SQLite database as application/octet-stream, generated via SQLite's VACUUM INTO (not a raw file copy), so it's safe to call even while the app is under active write load. See docs/backup.md for the full restore procedure, the optional BACKUP_DIR/BACKUP_INTERVAL/BACKUP_KEEP automatic local-snapshot scheduler, and a Litestream sidecar example for continuous offsite replication. responses: "200": description: A SQLite database file content: application/octet-stream: schema: type: string format: binary /backup/settings: get: summary: Get automatic-backup scheduler settings description: > Returns the current interval/retention-count settings for the automatic local-backup scheduler. Whether the scheduler is enabled at all remains a deploy-time-only choice (BACKUP_DIR); this only covers how often it runs and how many snapshots it keeps. See docs/backup.md. responses: "200": content: application/json: schema: { $ref: "#/components/schemas/BackupSettings" } put: summary: Update automatic-backup scheduler settings description: > Persists new interval/retention-count settings. Takes effect on the scheduler's next scheduled run without a process restart. requestBody: required: true content: application/json: schema: type: object required: [interval_seconds, keep] properties: interval_seconds: { type: integer, description: "Minimum 600 (10 minutes)." } keep: { type: integer, description: "Minimum 1." } responses: "200": content: application/json: schema: { $ref: "#/components/schemas/BackupSettings" } "400": { description: "interval_seconds below 600, or keep below 1" } /log-retention/settings: get: summary: Get agent-log retention pruner settings description: > Returns the current retention-days/interval settings for the automatic agent-log retention pruner. days=0 means cleanup is disabled. See docs/backup.md#agent-log-retention. responses: "200": content: application/json: schema: { $ref: "#/components/schemas/LogRetentionSettings" } put: summary: Update agent-log retention pruner settings description: > Persists new retention-days/interval settings. Takes effect on the pruner's next scheduled run without a process restart. Set days to 0 to disable cleanup entirely. requestBody: required: true content: application/json: schema: type: object required: [days, interval_seconds] properties: days: { type: integer, description: "0 (disabled) or greater." } interval_seconds: { type: integer, description: "Minimum 60 (1 minute)." } responses: "200": content: application/json: schema: { $ref: "#/components/schemas/LogRetentionSettings" } "400": { description: "days below 0, or interval_seconds below 60" } /settings/cost-warning: get: summary: Get the global mid-run cost early-warning threshold description: > Returns the current warn_ratio (fraction of a task's effective cost budget at which task.cost_warning fires). See CostWarningSettings and docs/agents.md#cost-budgets. responses: "200": content: application/json: schema: { $ref: "#/components/schemas/CostWarningSettings" } put: summary: Update the global mid-run cost early-warning threshold description: > Persists a new warn_ratio. Takes effect on the very next dispatch/run without a process restart — both the dispatcher's pre-dispatch warning check and the provider-side mid-run cost watchdog read it fresh. requestBody: required: true content: application/json: schema: type: object required: [warn_ratio] properties: warn_ratio: { type: number, format: double, description: "Must be greater than 0 and at most 1." } responses: "200": content: application/json: schema: { $ref: "#/components/schemas/CostWarningSettings" } "400": { description: "warn_ratio not in (0, 1]" } /settings/pricing: get: summary: List user-editable model pricing rows description: > Returns every row of the user-editable USD-per-1M-token pricing table used to estimate codex_cli run costs and drive the claude/qwen_code mid-run cost watchdog, ordered by model. Models with no row here fall back to an internal, approximate hardcoded table. See ModelPricing and AgentRun.cost_unknown. responses: "200": content: application/json: schema: type: array items: { $ref: "#/components/schemas/ModelPricing" } put: summary: Replace the entire model pricing table description: > Replaces the whole pricing table with the submitted rows in a single transaction — add/remove/edit a model are all expressed client-side as a new full list. Takes effect on the very next run completion without a restart. Rejects an empty/duplicate model or a negative price. requestBody: required: true content: application/json: schema: type: array items: type: object required: [model, input_per_1m, output_per_1m] properties: model: { type: string } input_per_1m: { type: number, format: double, description: "Must be >= 0." } output_per_1m: { type: number, format: double, description: "Must be >= 0." } cached_input_per_1m: { type: number, format: double, nullable: true, description: "Optional; null or omitted bills cached input tokens at input_per_1m. Must be >= 0." } cache_write_input_per_1m: { type: number, format: double, nullable: true, description: "Optional; null or omitted bills cache-write tokens (claude/qwen_code's cache_creation_input_tokens) at input_per_1m. Must be >= 0." } responses: "200": content: application/json: schema: type: array items: { $ref: "#/components/schemas/ModelPricing" } "400": { description: "Empty/duplicate model, or a negative price" } /ws-ticket: post: summary: Mint a short-lived WebSocket auth ticket description: > Returns a random, single-use ticket valid for ~30 seconds, used to authenticate the GET /ws upgrade (?ticket=) without putting the long-lived API token in the URL. Requires the same Bearer auth as the rest of /api/v1 — minting a ticket already requires holding the token. The ticket is consumed on first use; a replayed or expired ticket is rejected with 401. See docs/websocket.md for the full connection flow. The former ?token= fallback was removed (401). responses: "200": description: A freshly minted ticket content: application/json: schema: type: object properties: ticket: type: string description: Opaque single-use token for GET /ws?ticket= expires_in: type: string description: Human-readable TTL (e.g. "30s") /chat/sessions: get: summary: List interactive chat sessions description: > Interactive chat sessions are free-form conversations against a repo, separate from the task/workflow state machine. Each session runs the provider's interactive CLI in a PTY inside the session's git worktree, streamed over the /chat/sessions/{id}/terminal WebSocket. responses: "200": description: All chat sessions, newest-updated first content: application/json: schema: type: array items: $ref: "#/components/schemas/ChatSession" post: summary: Create a chat session requestBody: required: true content: application/json: schema: type: object required: [repo_id, provider_config_id] properties: repo_id: type: string provider_config_id: type: string description: References a ProviderConfig (see /provider-configs), which supplies the provider/model/env for this session's turns. title: type: string responses: "201": description: The created session content: application/json: schema: $ref: "#/components/schemas/ChatSession" "400": description: Missing/invalid repo_id or provider_config_id /chat/sessions/{id}: parameters: - name: id in: path required: true schema: type: string get: summary: Get a chat session description: > Returns the session. The interactive terminal has no server-side transcript — history lives in the CLI's own session store and the browser's terminal scrollback. responses: "200": description: The session content: application/json: schema: type: object properties: session: $ref: "#/components/schemas/ChatSession" provider_config: allOf: - $ref: "#/components/schemas/ProviderConfig" description: > Resolved provider config for the session's provider_config_id, embedded so the frontend doesn't need a second fetch. Its `env` values are redacted (see ProviderConfig.env). "404": description: Session not found delete: summary: Delete a chat session and its worktree responses: "204": description: Deleted "404": description: Session not found /chat/sessions/{id}/terminal: parameters: - name: id in: path required: true schema: type: string - name: ticket in: query required: false schema: type: string description: > Single-use WebSocket auth ticket from POST /ws-ticket. Required when API auth is enabled (browsers can't set the bearer header on a WS handshake). get: summary: Open the session's interactive terminal (WebSocket upgrade) description: > Upgrades to a WebSocket carrying the session's interactive CLI running in a PTY, cwd = the session's repo worktree (provisioned on first connect). The server sends terminal output as binary frames; the client sends keystrokes as binary/text frames and window-size changes as a text frame of the form (NUL byte)resize:,. The process stays alive across disconnects, so reconnecting reattaches to the same live session. responses: "101": description: Switching Protocols — WebSocket established "401": description: Missing or invalid ticket "404": description: Session not found "503": description: Terminal not available