Repository navigation
Description
Parent
- epic(codex): context-compiled, conflict-safe subagent orchestration for campaign work #1631 — context-compiled, conflict-safe Codex subagent orchestration
Problem
The repository describes how scouts, adversarial reviewers, builders, and verifiers should behave, but there is no versioned machine contract for the unit delegated to a Codex subagent or the result returned to the root thread.
Today a prompt can say “inspect this surface” or “run these tests,” but the root thread has no validator for:
- whether the worker saw the same repo/work-item snapshot;
- whether its role was read-only or write-capable;
- which files/resources it could touch;
- what context was selected or omitted;
- what output size and schema were required;
- whether a conclusion is evidence, a hypothesis, a contradiction, or a self-report;
- whether raw logs were kept out of the main context;
- whether a separate verifier actually checked a builder claim.
This makes subagent results easy to over-trust and expensive to synthesize.
Required outcome
Define additive, versioned DTOs and validators for one orchestration run:
OrchestrationRun
SubtaskPacket
SubtaskResult
VerificationReceipt
SynthesisInput
The contracts are agent-neutral. Codex is one consumer; no provider-specific thread ID or API object becomes repository truth.
Run identity
An OrchestrationRun binds:
schema/version
run_id
repo/work-item/context packet identity
base/head SHA and working-tree state
root session / orchestrator label
budget profile and task-set version
created/volatile fields outside semantic digest
status = planned | active | blocked | completed | abandoned
run_id may be local and opaque, but stale packet/result checks must compare the portable input identity.
SubtaskPacket
Required fields:
task_id
run/input/work_item identity
role = scout | adversary | builder | verifier | reviewer | cleanup
objective / bounded question
expected decision contribution
prerequisites / depends_on[]
conflict_resources[]
read_scope[]
allowed_edit_surface[]
forbidden_paths/resources[]
write_policy = none | generated_only | isolated_source_edit
worktree policy and required base identity
tool/process/network policy
context references and inline budget
expected result schema and result budget
required evidence references
validation or observation commands, when applicable
stop conditions and ask-back triggers
non-goals
A task packet must distinguish what the worker may inspect from what it may edit. An empty edit surface never means unrestricted write access.
Role-specific invariants
Scout
write_policy = none;- returns observations, candidate claims, evidence references, missing proof, and next questions;
- cannot report implementation complete or verified.
Adversary
- receives a named premise/claim/result to challenge;
- returns concrete discrepancies or
none_foundplus inspected surfaces; - cannot silently broaden into a new implementation plan.
Builder
- requires
isolated_source_edit, an explicit worktree/base, and non-empty edit cage; - returns changed files/diff or commit identity, commands attempted, and unresolved blockers;
- its
passed/fixedwording remains an author claim until verified.
Verifier
- consumes a builder diff/commit identity and required proof routes;
- does not modify source; generated test/build artifacts are allowed only under declared paths;
- records actual exit status, duration, output artifact digest, denominator, and inspected diff state;
- cannot repair the implementation in the same result.
Reviewer
- receives the scoped change/evidence contract and independently reports findings or an inspection record;
- no empty “LGTM” result.
SubtaskResult
Required common shape:
schema/version
run_id / task_id / role
input_identity actually consumed
status = completed | partial | blocked | contradicted | failed | superseded
summary with strict byte limit
claims[] with claim_kind and confidence basis
evidence_refs[] with path/line or artifact pointer and digest
findings[] with stable fingerprint, severity, category, and recommended next action
assumptions[]
contradictions[]
missing_evidence[]
files_read[]
files_changed[]
commands[] and actual result status
produced_artifacts[]
context_usage: selected/omitted/inline/result bytes
raw_output_refs[]
next_recommendation
stop/ask-back reason
Evidence and claim types
Use a closed distinction such as:
observation
hypothesis
author_claim
verified_fact
contradiction
limitation
recommendation
Only a matching VerificationReceipt or pre-existing authoritative artifact may promote an author claim to verified_fact.
Raw output and overflow
- Raw command output, stack traces, broad diffs, and search dumps do not appear inline by default.
- They are stored under a local ignored orchestration artifact root and referenced by digest/path.
- Results report selected/omitted/total rows and bytes.
- Missing overflow artifacts make the result incomplete; they do not silently disappear.
- Secret/environment/path redaction rules apply before a raw artifact is retained.
Validation
Add commands equivalent to:
cargo xtask orchestrate validate-task --input <task.json>
cargo xtask orchestrate validate-result --task <task.json> --result <result.json>
cargo xtask orchestrate verify-receipt --task <task.json> --result <result.json> --receipt <receipt.json>
The validators check identity, role/write compatibility, path containment, dependency/resource declarations, output budgets, required evidence, command status, and forbidden claim promotion.
Acceptance
- Fixture packets/results exist for every role and every terminal status.
- A scout result claiming “fixed” or “verified” fails validation.
- A builder with no isolated worktree/base or with a changed file outside
allowed_edit_surfacefails closed. - A verifier that changes source or verifies a different diff/commit identity fails closed.
- A passing command with zero discovered tests/subjects is recorded as
not_run/insufficient denominator, not verified evidence. - A timed-out or truncated command preserves the output reference and limitation; it cannot become a pass.
- An adversary contradiction remains a first-class result and cannot be merged away by majority count.
- Equivalent portable inputs/results yield stable semantic digests across absolute roots.
- Large logs stay out of normalized result JSON while remaining retrievable through checked references.
- Unknown schema major versions and stale input identities fail visibly with a recompile route.
- Human Markdown, if emitted, is derived from the DTO and cannot strengthen claim status.
Non-goals
- No model/provider invocation or Codex thread management.
- No source patch application or merge.
- No automatic task decomposition or business priority ranking.
- No attempt to standardize every agent's internal reasoning.
- No raw chain-of-thought storage.
- No replacement for RIPR repair packets, PR bodies, or verification contracts; this composes them.
Likely seams
- new focused
xtaskorchestration DTO/validation modules - output-contract/schema fixtures
- role/result golden corpus
- shared path/command validation, including protocol: add a typed non-shell CommandSpec for verify, receipt, regeneration, and inspection routes #1617
CommandSpecwhen available - generated local artifacts under
target/ripr/orchestration/
Relationships
- context: implement the typed repo graph and role-scoped work-item packet compiler #1632 supplies role-scoped context references and input identity.
- orchestration: validate dependency- and conflict-aware subagent waves against real repo capacity #1634 plans safe waves over these packets.
- orchestration: enforce local task claims, isolated writer worktrees, and contamination-safe cleanup #1635 allocates worktrees/resource claims for write-capable packets.
- orchestration: ingest bounded worker results and emit contradiction-aware root-thread synthesis #1636 ingests and synthesizes validated results.
- integration(codex): add project-scoped subagent roles, delegation rules, and packet-driven prompts #1637 maps these roles to project-scoped Codex custom agents.
Claim boundary
This issue makes delegated work and worker output machine-checkable. It does not make a subagent reliable by itself; independent evidence and root-thread judgment remain required.
Activity
EffortlessSteven commentedon Jul 15, 2026
Issue update — 2026-07-14
Title: orchestration: define versioned SubtaskPacket, SubtaskResult, and verification r
Status
This issue is part of the Codex orchestration epic (#1631) — context-compiled, conflict-safe subagent orchestration. Based on codebase research:
Recommendations
EffortlessSteven commentedon Jul 15, 2026
Identity correction
All
OrchestrationRun,SubtaskPacket,SubtaskResult,VerificationReceipt, andSynthesisInputcontracts must bind:Do not use
active goalor one current work item as portable run authority. Relevant campaign references are optional context; legacy fields are compatibility-only.Validation must reject wrong repository, portfolio snapshot, selected issue/action, branch/worktree, diff/head, or role. A portfolio refresh that is semantically compatible with the selected transition may be rebound explicitly; it is never assumed compatible from timestamps or prose.
Add fixtures for standalone issue work, multiple relevant campaigns, wrong-repository result, unrelated portfolio refresh, newly conflicting portfolio refresh, and legacy goal attempting to promote an author claim.
EffortlessSteven commentedon Jul 17, 2026
Codebase Context & Plan Review
Reviewed: 2026-07-17
Current Implementation State
The repository relies on cargo xtask goals commands but lacks versioned machine-readable DTOs for the exact work packets sent to subagents, or verification receipts. The xtask codebase does not have orchestrate subcommands yet.
Relevant Files
Plan Review
The plan outlines clear constraints (SubtaskPacket, SubtaskResult, VerificationReceipt) mapping directly to the work item roles (scout, adversary, builder, verifier, reviewer). The exact required fields and explicit evidence types are well-specified. The focus on out-of-band artifact logs and explicit byte budgets aligns perfectly with the Epic's goal to prevent context flooding.
Blockers
Blocked by #1632 (requires the context identity and role-scoped context references).
Readiness Assessment
blocked
Next Action
Wait for #1632 to land, then implement SubtaskPacket schemas and validators.
EffortlessSteven commentedon Jul 18, 2026
Deep Research Follow-up
Reviewed: 2026-07-17
Current Implementation State
No DTOs currently exist for
OrchestrationRun,SubtaskPacket,SubtaskResult, orVerificationReceipt. The only existing packet type isContextPacket(crates/ripr/src/domain/context_packet.rs), which is scoped strictly to LSP analyzer evidence, not orchestration.Relevant Files
crates/ripr/src/domain/— Should house the new DTOs or a dedicatedorchestrationcrate should be created.xtask/src/main.rs— Missing theorchestratesubcommands.Plan Review
The plan successfully defines strict boundaries for agent behaviors (e.g., separating "what an agent can inspect" from "what it can edit"). The requirement that a builder's claim cannot become a
verified_factwithout an independentVerificationReceiptaligns perfectly with the project's evidence-first philosophy.Blockers
Requires the input context identity definitions from #1632.
Readiness Assessment
ready-to-implement (pending #1632)
Next Action
Create the Rust domain structures for
SubtaskPacketandSubtaskResultwith role-specific invariants.EffortlessSteven commentedon Jul 18, 2026
Status review (2026-07-17)
Current status:
not-started (design/spec only). This is the linchpin contract the rest of the epic (#1634–#1639) consumes; nothing else can be validated without it. Per AGENTS.md:582-587, not an assumed command surface.Evidence nothing landed
SubtaskPacket,SubtaskResult,VerificationReceipt,OrchestrationRun, orSynthesisInputtype anywhere incrates/orxtask/(grep→ zero).orchestrate validate-task|validate-result|verify-receiptcommands.ContextPacketatcrates/ripr/src/domain/context_packet.rsis the LSP analyzer evidence packet — unrelated.What it defines (worth preserving as the first artifact)
Versioned DTOs + validators, plus role invariants (scout read-only; adversary challenges one premise; builder needs isolated worktree; verifier binds exact diff/commit; reviewer no empty LGTM) and the closed claim-kind distinction (
observation/hypothesis/author_claim/verified_fact/contradiction/limitation/recommendation).Recommended next step
Land the versioned DTO schemas as a checked spec/ADR with golden JSON fixtures for every role/status before any orchestration command. This is the highest-leverage first artifact of the epic — and it doesn't depend on the #1692 portfolio model as tightly as the identity-binding issues (#1632/#1634/#1635), so it can proceed in parallel with #1692's resolution. The
author_claim vs verified_factpromotion rule already lives as prose in AGENTS.md:534-551; this gives it machine enforcement.EffortlessSteven commentedon Aug 2, 2026
Earnest review (2026-08-02)
Orchestration: versioned SubtaskPacket, SubtaskResult, VerificationReceipt contracts. Slices #1759 (DTOs + golden fixtures) and #1760 (validate commands) are the execution.
Action: keep open; track via #1759/#1760. Contract-first is the right ordering.
EffortlessSteven commentedon Aug 3, 2026
Deep re-review (2026-08-02)
STATUS: stale
EVIDENCE:
status/blocked-upstream. (Orchestration: define versioned SubtaskPacket/SubtaskResult/verification receipt contracts.)grep -rniE 'SubtaskPacket|SubtaskResult|subtask.*receipt' crates/ xtask/-> 0 hits; no typed DTOs. #1732 owns the claim-kind/next-verdict vocabulary these DTOs consume. The DTO shapes themselves are reasonable versioned contracts, but they exist to serve the #1631 orchestration layer which is now doctrine-constrained (AGENTS.md:576-579).PLAN QUALITY: needs-update
ACTION: update (depends on re-baselined #1631 + #1732 freeze; the DTO design is sound but has no consumer until #1631 is re-scoped)
test(orch): freeze orchestration attempt receipts contract (#4925) (#…
feat(orch): migrate orchestration consumers to selected-work portfoli…