Skip to content

API Reference parrot.flows.dev_loop.run_bundle

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.flows.dev_loop.run_bundle

View source

RunBundle — pure exportable run summary + markdown closing report.

Implements Module 8 (v0.2 amendment) of the FEAT-378 spec, step 3. Everything a "run bundle" needs is already captured by the event-sourced session state (:class:~parrot.flows.dev_loop.session_state.SessionHost) and the flow's shared state — the terminal :class:~parrot.flows.dev_loop.session_state.Snapshot holds per-node, dispatch and gate state; the action log supplies the full audit trail; shared (the flow's ctx.shared_data) carries the rich structured results (ResearchOutput/PlannerOutput, QAReport, deployment/ revision/feature-mode results). This module only assembles them.

This module is pure: no filesystem, no Redis, no network. TASK-1929 wires :func:build_run_bundle / :func:render_markdown into the runner at run-close (writing {run_id}.bundle.json + {run_id}.report.md).

Class CriterionOutcome

One acceptance criterion's outcome (name/passed/duration only — QA's full CriterionResult also carries stdout/stderr tails, which the closing report intentionally omits).

Attributes:

Attribute Type Description
name str
passed bool
duration_seconds float

Class DevelopedWork

The "what was developed" section: links, QA/review outcome, tasks.

Attributes:

Attribute Type Description
jira_issue_key str
pr_url str
pr_number Optional[int]
feature_id str
spec_path str
worktree_path str
branch str
task_ids List[str]
qa_passed Optional[bool]
lint_passed Optional[bool]
code_review_passed Optional[bool]
criteria List[CriterionOutcome]
code_review_findings List[str]
docs_artifact_path str
changeset Optional[ChangeSet]
seat_usage List[SeatUsageSummary]

Class GateReport

Per-gate projection for the closing report's gate audit trail.

Attributes:

Attribute Type Description
kind GateKind
node_id str
title str
status GateStatus
opened_at Optional[float]
resolved_at Optional[float]
resolved_by str
comment str

Class NodeReport

Per-node/agent projection for the closing report's agents table.

Attributes:

Attribute Type Description
node_id str
status NodeStatus
started_at Optional[float]
finished_at Optional[float]
duration_seconds Optional[float]
error str
dispatcher str
message_count int
tool_use_count int
input_tokens Optional[int]
output_tokens Optional[int]
cache_creation_input_tokens Optional[int]
cache_read_input_tokens Optional[int]
total_cost_usd Optional[float]
num_turns Optional[int]
duration_ms Optional[int]
summary dict

Class RunBundle

The full exportable summary of one dev-loop run (any mode).

Attributes:

Attribute Type Description
run_id str
mode str
work_kind str
summary str
outcome RunPhase
created_at float
finished_at Optional[float]
totals RunTotals
nodes List[NodeReport]
gates List[GateReport]
developed DevelopedWork
action_count int
generated_at float

Class RunTotals

Run-wide aggregates. Telemetry fields are None when NO node reported them — a run with no reporting dispatchers must not render fake zeros.

Attributes:

Attribute Type Description
duration_seconds Optional[float]
nodes_completed int
nodes_failed int
nodes_skipped int
dispatch_count int
message_count int
tool_use_count int
input_tokens Optional[int]
output_tokens Optional[int]
total_cost_usd Optional[float]

Function build_run_bundle

Assemble a :class:RunBundle from a run's terminal state.

Pure — no filesystem, no Redis, no network. Must build a usable bundle even for a failed/cancelled run where most shared keys are absent (only mode reliably has a value).

build_run_bundle(snapshot: Snapshot, envelopes: Sequence[ActionEnvelope], shared: Mapping[str, Any]) -> RunBundle

Parameter Type Default Description
snapshot Snapshot The run's terminal :class:Snapshot (authoritative node/gate/link state — the source for links like jira_issue_key/pr_url, already folded via RunClosed at run-close).
envelopes Sequence[ActionEnvelope] The full action-envelope log (only its length is used today — action_count).
shared Mapping[str, Any] The flow's ctx.shared_data at run-close. Every key is optional and read defensively (.get, duck-typed): a failed/cancelled run may only have mode.

Returns: RunBundle — The assembled :class:RunBundle.

Function render_markdown

Render bundle as the human-readable markdown closing report.

Omits empty sections (e.g. no gates were opened, no code-review findings) and never renders None as literal text.

render_markdown(bundle: RunBundle, usage_markdown: str = '') -> str

Parameter Type Default Description
bundle RunBundle The assembled :class:RunBundle.
usage_markdown str '' FEAT-405 Module 7 — an optional, already-rendered per-agent usage section (from :func:~parrot.flows.dev_loop.usage_report.render_usage_markdown), spliced in verbatim after the agents table. Passed as a pre-rendered string rather than importing :mod:~parrot.flows.dev_loop.usage_report here — that module imports helpers from this one, and this keeps the dependency one-directional. Empty string (default) omits the section entirely — byte-identical to pre-FEAT-405 output.

Returns: str — The complete markdown document.

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