Skip to content

API Reference parrot.flows.dev_loop.sdd_coder.models

github-actions[bot] edited this page Nov 10, 2026 · 4 revisions

parrot.flows.dev_loop.sdd_coder.models

View source

Pydantic payloads of the sdd_coder kernel (spec §2 "Data Models"). No logic, no I/O.

Class AttemptRecord

Per-attempt telemetry (spec G9, design research S8).

Fields:

Field Type Default Description
attempt int
seat_label str
backend str ''
model str ''
started_at str
ended_at str ''
duration_s float 0.0
usage Dict[str, Any]
error str ''
attempt_uid str '' Globally unique id for this attempt, minted by the engine. The telemetry join key. attempt cannot serve: it restarts at 1 on every _run_task invocation (engine.py:592) while each chunk gets a fresh job id (jobs.py:30), so a task re-dispatched in a later job reuses the same number. Defaults empty; the engine sets it.
job_id str ''
resolved_model str '' The model the dispatcher actually resolved, which can differ from the roster seat's configured model via _resolve_model's client fallbacks (dispatchers/llm.py:879).
turns int 0
terminal str 'completed' One of "completed", "failed" or "salvaged".
error_class str '' Exception type name only. The full message stays in error and never reaches the dataset.
declared_files Optional[int] None Count of files the task declared, captured DURING the attempt: the task file lives in the worktree that /sdd-done removes.
declared_files_known bool False
turns_with_unknown_usage int 0
turn_series List[Tuple[int, Optional[int], Optional[int]]] Per turn: (round_number, input_tokens or None, output_tokens or None).
budget_report Dict[str, Any] BudgetReport.model_dump() when an observational ledger was bound.
assessment_id str '' ComplexityAssessment ID for this attempt, enabling audit trail.
execution_id str '' FEAT-559: the execution this attempt ran under. Empty for attempts recorded before this feature landed; new attempts always carry one.
validation_status str '' FEAT-709: task-tier validation verdict status for this attempt; empty when no gate ran.

Alias COMPLEXITY_ERROR_CODES

Re-exported from parrot.flows.dev_loop.sdd_coder.complexity_models.COMPLEXITY_ERROR_CODES.

Class CleanupReport

Result of coder_cleanup — sub-worktrees removed vs. kept for inspection.

Fields:

Field Type Default Description
removed List[str]
kept List[str]

Class CoderBgStatusArgs

coder_bg_status arguments (FEAT-584 M8/R8): opaque, execution-scoped read.

handle is caller-opaque free text emitted only at registration time -- never a PID or a path the model may invent -- so this schema only bounds its shape (non-empty), never its content.

Attributes:

Attribute Type Description
execution_id str
handle str
since_revision Optional[int]
tail_bytes int

Class CoderBgWaitArgs

coder_bg_wait arguments: coder_bg_status's read plus a bounded blocking budget.

Same opaque, execution-scoped handle contract as CoderBgStatusArgs (it is subclassed so the two can never drift); timeout_seconds mirrors CoderWaitArgs' own <=300s cap, so a blocking background wait is bounded exactly like a job wait.

Attributes:

Attribute Type Description
timeout_seconds int

Class CoderCleanupArgs

Attributes:

Attribute Type Description
feature str
worktree str
execution_id str
keep_conflicted bool

Class CoderDeliveryReportArgs

Same shape as prepare_native (FEAT-584 M1b/R1b) -- read-only, never merges/validates/approves.

Class CoderEndExecutionArgs

coder_end_execution arguments (FEAT-559 TASK-3283).

Deliberately minimal: coder_begin_execution reuses CoderPlanArgs (identical feature/worktree/execution_id shape); no other existing model has ONLY execution_id, so this one small class is unavoidable here -- a disclosed exception to TASK-3283's own file scope (see its Completion Note), added in this ledger-adjacent models module rather than guessed into toolkit.py.

Attributes:

Attribute Type Description
execution_id str

Class CoderError

A domain failure, closed to ERROR_CODES.

Fields:

Field Type Default Description
code str
message str
details Dict[str, Any]

Alias CoderFeedback

Re-exported from parrot.knowledge.wiki.ledger.coder_feedback.CoderFeedback.

Class CoderFeedbackReportArgs

coder_feedback_report arguments -- read-only and repository-wide.

Deliberately split from CoderPlanArgs (FEAT-559): the feedback report never starts, resumes or requires an execution, unlike the other seven scoped orchestration/review tools.

Attributes:

Attribute Type Description
feature str
worktree str

Class CoderJob

A running/finished chunk dispatch, tracked by the in-memory JobTable.

Fields:

Field Type Default Description
job_id str
feature_id str
chunk_task_ids List[str]
state Literal['running', 'done', 'error']
started_at str
ended_at str ''
tasks List[TaskResult]
error str ''
execution_id str '' FEAT-559: the execution that dispatched this chunk. Empty only for jobs journaled before this feature; JobTable.create always requires one for new jobs (never minted implicitly).
bg_handle Optional[str] None FEAT-584 M8/R8: opaque coder_bg_status handle for this dispatch's own background registration -- job_id itself, never invented, and never set without a durable registry/real execution_id behind it.

Class CoderJobView

A CoderJob snapshot plus its per-seat roll-up, as coder_status/coder_wait return it.

seats is computed by summary.summarize_job_seats over this one job at read time — never journaled — so the orchestrator prints the Seats table from data instead of re-deriving it from tasks[*].attempts[*] by hand.

Attributes:

Attribute Type Description
seats List[SeatUsageSummary]

Class CoderMergeArgs

Same shape as prepare_native.

Class CoderPlan

coder_plan payload: next wave sliced into distinct-seat chunks.

Fields:

Field Type Default Description
feature_id str
feature str
feature_branch str
index_path str
pending List[str]
blocked List[str]
chunks List[PlanChunk]
roster List[SeatProbeResult]
orphan_branches List[OrphanBranch]
assessments Dict[str, ComplexityAssessment] Task ID to ComplexityAssessment mapping for this plan's tasks.
routing_blocks List[ComplexityBlock] Routing blocks preventing dispatch of affected tasks.
execution_id str '' FEAT-559: the execution this plan was cached under. Empty only for plans predating this feature; a new plan always carries its execution.
pool_generation int 0 Execution pool generation this plan was computed against; run_chunk rejects a stale plan (plan_stale) once the generation has moved on.
suspension_summary str '' FEAT-599 (FEAT-559 AC-12): same text as ExecutionPoolView.suspension_summary for this plan's execution pool; empty on the legacy (no execution) path.

Class CoderPlanArgs

Attributes:

Attribute Type Description
feature str
worktree str
execution_id str

Class CoderPlanRequestArgs

coder_plan request arguments (FEAT-584 M3/R2): scope plus response projection.

Deliberately split from CoderPlanArgs itself: coder_begin_execution reuses CoderPlanArgs directly, and CoderRecordFeedbackArgs/ CoderRecordReviewArgs/CoderRecordNativeObservationArgs all inherit from it -- none of those may silently start accepting response_mode.

Attributes:

Attribute Type Description
response_mode Literal['full', 'compact']

Class CoderPrepareNativeArgs

Attributes:

Attribute Type Description
feature str
worktree str
task_id str
execution_id str

Class CoderReadArtifactArgs

coder_read_artifact arguments (FEAT-584 M3/R2): opaque, execution-scoped only.

artifact_id is never a filesystem path -- confinement to one execution's own evidence directory happens entirely inside ExecutionEvidenceStore (evidence.py), never here; this schema only bounds shape and type.

Attributes:

Attribute Type Description
execution_id str
artifact_id str
offset int
limit int

Class CoderRecordFeedbackArgs

Record a worker-confirmed correction from a known coder attempt.

Attributes:

Attribute Type Description
feedback CoderFeedback

Class CoderRecordNativeObservationArgs

coder_record_native_observation arguments; observation is a fully typed schema (spec R3).

Attributes:

Attribute Type Description
observation NativeObservation

Class CoderRecordReviewArgs

Complete review measurement, including zero-fix deliveries.

Attributes:

Attribute Type Description
review CoderReview

Class CoderResult

Tool envelope — mirrors parrot_tools OperationResult; core MUST NOT import parrot_tools.

Fields:

Field Type Default Description
status Literal['ok', 'error']
operation str
data Dict[str, Any]
error Optional[CoderError] None
elapsed_ms int 0

Alias CoderReview

Re-exported from parrot.knowledge.wiki.ledger.coder_reviews.CoderReview.

Class CoderRunChunkArgs

Attributes:

Attribute Type Description
feature str
worktree str
task_ids List[str]
execution_id str

Class CoderRunValidationArgs

coder_run_validation arguments (FEAT-584 M8/R8): admits one protected, idempotent selection.

tier='task' (FEAT-709) is admitted here but its obligations are not enforced here: exactly one task_ids entry, an attempt_uid this execution issued, and the engine-supplied fork SHA as base_ref are checked by BackgroundRunner.run_validation (background.py), which owns that rule. This model only stops the schema from refusing a request the toolkit's own signature advertises.

Attributes:

Attribute Type Description
feature str
worktree str
execution_id str
task_ids List[str]
tier Literal['task', 'merge', 'feature']
timeout_seconds int
request_id str
attempt_uid Optional[str]

Class CoderStatusArgs

Attributes:

Attribute Type Description
job_id str
response_mode Literal['full', 'compact']

Class CoderTaskContextArgs

Same shape as prepare_native (FEAT-584 M1b/R1b) -- read-only, never allocates a worktree.

Class CoderWaitArgs

Attributes:

Attribute Type Description
job_id str
timeout_seconds int
response_mode Literal['full', 'compact']

Alias ComplexityAssessment

Re-exported from parrot.flows.dev_loop.sdd_coder.complexity_models.ComplexityAssessment.

Alias ComplexityBlock

Re-exported from parrot.flows.dev_loop.sdd_coder.complexity_models.ComplexityBlock.

Alias ComplexityPolicy

Re-exported from parrot.flows.dev_loop.sdd_coder.complexity_models.ComplexityPolicy.

Alias DevAgentBackend

Re-exported from parrot.flows.dev_loop.models.DevAgentBackend.

Alias DevelopmentOutput

Re-exported from parrot.flows.dev_loop.models.DevelopmentOutput.

Attribute ERROR_CODES

Type: frozenset[str]

Attribute EXECUTION_ID_DESCRIPTION

Attribute EXECUTION_ID_PATTERN

Alias EvidenceRef

Re-exported from parrot.flows.dev_loop.sdd_coder.optimization_models.EvidenceRef.

Class ExecutionPoolView

coder_begin_execution / status payload: one execution's pool state (spec §2 ExecutionPoolView).

Bound immutably to (execution_id, feature_id, worktree_path) for its whole lifetime; generation increments on every suspension so a stale cached plan can be rejected before it reaches admission.

Fields:

Field Type Default Description
execution_id str
feature_id str
worktree_path str
status ExecutionStatus
generation int
seats List[PoolSeatView]
fallback_required bool False
fallback_reason str ''
persisted bool True
persistence_degraded bool False
roster_warnings List[str] FEAT-588 advisory notes about unavailable complex-task retry capacity.
suspension_summary str '' FEAT-599 (FEAT-559 AC-12): bounded render_suspension_history() text over every suspension this pool knows about (inherited from durable history + its own). Display only -- the pool's exclusion sets remain the selection authority.

Class ExecutionSnapshot

Durable per-execution journal payload (spec §2 ExecutionSnapshot; architecture "Execution lifecycle, ownership and recovery" -- journaled under <feature-worktree>/.sdd-coder/executions/<uuid>.json).

Carries everything a restart needs to replay: scope/fingerprint binding, admitted attempts, native reservations, outstanding jobs and both local (this execution's own) and inherited (durable, pre-existing) exclusions.

Fields:

Field Type Default Description
execution_id str
feature_id str
worktree_path str
roster_fingerprint str
admitted_attempts Dict[str, str] attempt_uid -> task_id.
native_reservations Dict[str, str] task_id -> reservation id.
outstanding_job_ids List[str]
local_exclusions List[ModelKey]
inherited_exclusions List[ModelKey]
status ExecutionStatus
generation int

Attribute ExecutionStatus

Execution-pool lifecycle state (FEAT-559 spec §2 "Execution lifecycle, ownership and recovery").

Class FailureModel

One failed test node inside a validation verdict (FEAT-709).

Fields:

Field Type Default Description
runner str
nodeid str
verdict Literal['new_red', 'baseline_red', 'unknown']
excerpt str

Class FeedbackConfig

Bound historical lessons and allow a measured baseline without injection.

Fields:

Field Type Default Description
enabled bool True
max_tokens int 1800
max_age_days int 90

Class LintConfig

Engine-owned per-task lint pass, run at the merge boundary instead of by the coder LLM.

Fields:

Field Type Default Description
autofix bool True Run ruff check --fix + the formatter on the task's changed .py files and commit the result on the attempt branch before merging.
formatter LintFormatter 'auto' auto picks black when the repo's pyproject.toml has [tool.black], ruff format when it has ruff format settings, and no formatter otherwise (so a repo with no declared style is never reformatted to a default line length).
error_select List[str] Correctness rules (syntax errors, undefined names) reported separately as LintReport.errors so the orchestrator fixes them; everything else is residual style debt left for the full pass in /sdd-done. Never blocks the merge.
format_scope Literal['changed-lines', 'file'] 'changed-lines' changed-lines formats only the task's changed hunks (black --line-ranges / ruff format --range) so an unclean base file is not reformatted wholesale under the task's name; file restores whole-file formatting. Files the task added are always formatted whole (FEAT-702).

Attribute LintFormatter

Class LintReport

Outcome of the engine lint pass over one task branch.

Fields:

Field Type Default Description
formatter str 'none'
fixed_files List[str]
commit str ''
errors List[str]
residual_count int 0
residual List[str]
tool_error str ''

Alias ModelKey

Re-exported from parrot.knowledge.wiki.ledger.coder_suspensions.ModelKey.

Class NativeObservation

Typed coder_record_native_observation.observation payload (FEAT-584 spec §2 R3).

Reports host-observed agent linkage and completion for an already-issued native attempt -- never authoritative acceptance, never a released reservation (the engine's own record_native_observation enforces that part; this model only enforces the payload's own shape).

started_at/ended_at may both be omitted: the real span is unknown when only the arrival time of the result is known (spec: "El span real puede ser null"). A supplied pair must not be reversed -- no invented duration.

Fields:

Field Type Default Description
event_id str
task_id str
attempt_uid str
agent_id str
observed_at datetime
kind Literal['dispatched', 'finished']
started_at Optional[datetime] None
ended_at Optional[datetime] None
terminal Optional[Literal['completed', 'failed', 'salvaged']] None
evidence_ref EvidenceRef

Class NativePrep

Sub-worktree handed to sdd-worker for a native (Haiku) planned task.

Fields:

Field Type Default Description
task_id str
task_file str
branch str
worktree_path str
seat_label str
model str 'haiku'
effort Optional[str] None Effort the orchestrator passes to the Agent tool (low|medium|high|xhigh|max); None keeps the session default. Resolved like MCP seats: strong_models (complex/unknown) -> seat -> unset.
attempt_uid str ''
coder_feedback str ''
validation_verdict str '' FEAT-709: rendered verdict of the failed previous attempt (same-seat repair).
assessment_id str '' ComplexityAssessment ID for native attempts, enabling attribution.
execution_id str '' FEAT-559: the execution this native reservation belongs to.
bg_handle Optional[str] None FEAT-584 M8/R8: opaque coder_bg_status handle registered for this native reservation's launch (never set for a legacy/no-execution call -- a BackgroundRegistration requires a real execution_id).

Class OrphanBranch

A <feature>--TASK-NNN-a<n> branch with no live job (design research S2).

Fields:

Field Type Default Description
task_id str
branch str
worktree_path str ''
commits int 0
files List[str]

Class PlanChunk

One slice of the current wave, sized to at most len(available_roster).

Fields:

Field Type Default Description
index int
tasks List[PlannedTask]

Class PlannedTask

A task with its assigned seat inside one chunk.

Fields:

Field Type Default Description
task_id str
task_file str
title str ''
seat_label str
native bool False
backend Optional[str] None
model str ''
assessment_id str ''

Class PoolSeatView

One seat's admission state inside an execution pool (spec §2 PoolSeatView).

configured_model/backend are the roster's static configuration; resolved_key is the effective ModelKey once the seat has actually been probed/dispatched (absent before then). Runtime locks/conditions belong to the pool's own runtime object, never to this serialized view.

Fields:

Field Type Default Description
label str
kind SeatKind
backend Optional[str] None
configured_model str ''
resolved_key Optional[ModelKey] None
available bool False
busy bool False
suspended bool False
probe_unavailable bool False
reason str ''
suspension_id str ''
suspended_until str ''
suspension_source str '' FEAT-599 (FEAT-559 AC-12): SuspensionRecord.source of the incident that suspended this seat.
source_task_id str '' FEAT-599: task id (or probe uid) whose attempt caused the suspension; empty when unattributed.
source_execution_id str '' FEAT-599: execution that recorded the suspension.

Class RosterConfig

Ordered roster + engine bounds (spec: wait ≤ 300 s).

Fields:

Field Type Default Description
seats List[RosterSeat]
wait_timeout_max_s int 300
smoke_timeout_s int 60
lint LintConfig
feedback FeedbackConfig
complexity ComplexityPolicy
suspension_policy SuspensionPolicy
runners RunnerConfig FEAT-559: cooldown/summary-budget policy shared by every execution pool for this roster.

Class RosterSeat

One seat of the model roster (config-driven, spec G8).

backend is required for kind == "mcp" and must be omitted for kind == "native" (the Haiku seat, a native Claude Code sub-agent).

Fields:

Field Type Default Description
label str
kind SeatKind 'mcp'
backend Optional[DevAgentBackend] None
model str ''
fallback_model str ''
effort Optional[SeatEffort] None

Class RunnerConfig

Engine-owned task-tier validation gate settings (FEAT-709).

Fields:

Field Type Default Description
gate_overall_timeout_s int 600
same_seat_repair bool True

Class RunnerSummaryModel

Per-runner counts inside a validation verdict (FEAT-709).

Fields:

Field Type Default Description
runner str
suite str
tests int
passed int
failed int
errors int
skipped int
cached int
duration_s float
exit_code int
status str

Attribute SeatEffort

Attribute SeatKind

Class SeatProbeResult

Outcome of probing one seat at first use (spec G8).

probe_* fields (FEAT-559) are structured failure metadata for the ONE probe call that ran on this seat, so roster wiring need not infer a failure from prose. They are independent of fallback_used: a primary probe can fail (recorded here) while a configured fallback still succeeds, leaving available=True.

Fields:

Field Type Default Description
label str
kind SeatKind
backend Optional[str] None
available bool
model_used str ''
fallback_used bool False
reason str ''
probe_uid str ''
probe_observed_at str ''
probe_duration_s float 0.0
probe_exception_class str ''

Alias SeatUsageSummary

Re-exported from parrot.flows.dev_loop.models.SeatUsageSummary.

Class SuspendModelArgs

coder_suspend_model arguments.

The target model is resolved by the engine from attempt_uid -- the caller never names a model directly, so it cannot invent an arbitrary suspension target.

Attributes:

Attribute Type Description
execution_id str
attempt_uid str
reason SuspensionReason
evidence_ref str

Alias SuspensionPolicy

Re-exported from parrot.knowledge.wiki.ledger.coder_suspensions.SuspensionPolicy.

Alias SuspensionReason

Re-exported from parrot.knowledge.wiki.ledger.coder_suspensions.SuspensionReason.

Attribute TaskOutcome

not_dispatched (FEAT-559): a queued task lost its seat before admission -- no synthetic attempt is recorded; the reason lives in TaskResult.diagnostics.

Class TaskResult

Outcome of consolidating one task's latest attempt.

Fields:

Field Type Default Description
task_id str
outcome TaskOutcome
branch str ''
worktree_path str ''
attempts List[AttemptRecord]
conflict_files List[str]
unexpected_files List[str]
diagnostics str ''
development_output Optional[DevelopmentOutput] None
lint Optional[LintReport] None
native_retry Optional['NativePrep'] None FEAT-588: native attempt-2 reservation for retry_native outcomes only.
validation Optional[ValidationVerdictModel] None FEAT-709: engine task-tier validation verdict, when the gate ran.

Class ValidationVerdictModel

Pydantic mirror of the kernel ValidationVerdict (FEAT-709).

Fields:

Field Type Default Description
schema_version int
status Literal['passed', 'failed', 'timed_out', 'unavailable', 'blocked']
tier Literal['task', 'merge', 'feature']
runners List[RunnerSummaryModel]
failures List[FailureModel]
cached List[str]
notes List[str]
evidence List[str]

Method ValidationVerdictModel.from_kernel

Build the model from a kernel ValidationVerdict dataclass.

from_kernel(verdict: Any) -> 'ValidationVerdictModel'

Parameter Type Default Description
verdict Any A test_scope.datatypes.ValidationVerdict instance.

Returns: 'ValidationVerdictModel' — The validated Pydantic mirror.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally