Skip to content

orchestration: define versioned SubtaskPacket, SubtaskResult, and verification receipt contracts #1633

Closed as not planned

Description

@EffortlessSteven

Parent

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_found plus 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/fixed wording 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_surface fails 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

Relationships

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

  1. EffortlessSteven commented on Jul 15, 2026

    @EffortlessSteven
    MemberAuthor

    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

    1. Priority: low-medium. This is a future capability, not a current blocker.
    2. The epic depends on typed repo graph (context: implement the typed repo graph and role-scoped work-item packet compiler #1632) and subtask packet contracts (orchestration: define versioned SubtaskPacket, SubtaskResult, and verification receipt contracts #1633) as foundations.
    3. Adversarial review: Orchestration must not become a parallel authority — it composes ripr evidence, it does not re-analyze.
  2. EffortlessSteven commented on Jul 15, 2026

    @EffortlessSteven
    MemberAuthor

    Identity correction

    All OrchestrationRun, SubtaskPacket, SubtaskResult, VerificationReceipt, and SynthesisInput contracts must bind:

    repository identity
    PortfolioBasis
    SelectedWorkIdentity
    exact base/head/worktree or read-only snapshot as applicable
    

    Do not use active goal or 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.

  3. EffortlessSteven commented on Jul 17, 2026

    @EffortlessSteven
    MemberAuthor

    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

    • xtask/src/command.rs — Target for cargo xtask orchestrate ... subcommands.
    • arget/ripr/orchestration/ — Proposed location for generated local artifacts.

    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.

  4. EffortlessSteven commented on Jul 18, 2026

    @EffortlessSteven
    MemberAuthor

    Deep Research Follow-up

    Reviewed: 2026-07-17

    Current Implementation State

    No DTOs currently exist for OrchestrationRun, SubtaskPacket, SubtaskResult, or VerificationReceipt. The only existing packet type is ContextPacket (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 dedicated orchestration crate should be created.
    • xtask/src/main.rs — Missing the orchestrate subcommands.

    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_fact without an independent VerificationReceipt aligns 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 SubtaskPacket and SubtaskResult with role-specific invariants.

  5. EffortlessSteven commented on Jul 18, 2026

    @EffortlessSteven
    MemberAuthor

    Status review (2026-07-17)

    Codebase review against current main. Read-only; no code changed.

    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

    • No SubtaskPacket, SubtaskResult, VerificationReceipt, OrchestrationRun, or SynthesisInput type anywhere in crates/ or xtask/ (grep → zero).
    • No orchestrate validate-task|validate-result|verify-receipt commands.
    • The existing ContextPacket at crates/ripr/src/domain/context_packet.rs is the LSP analyzer evidence packet — unrelated.
    • No RIPR-SPEC-* for these contracts exists; the issue text is the de-facto spec.

    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_fact promotion rule already lives as prose in AGENTS.md:534-551; this gives it machine enforcement.

  6. added
    status/blocked-upstream
    on Jul 18, 2026
  7. EffortlessSteven commented on Aug 2, 2026

    @EffortlessSteven
    MemberAuthor

    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.

  8. EffortlessSteven commented on Aug 3, 2026

    @EffortlessSteven
    MemberAuthor

    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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status/blocked-upstream

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions