Hmbown/CodeWhale · error

Review pass arrived out of order or does not match the…

Error message

Review pass arrived out of order or does not match the immutable manifest; expected pass {expected}

What it means

The multi-pass review accumulator accepts passes strictly in order: pass N must carry manifest.number == N and its manifest must exactly match the immutable manifest entry at index N-1. Anything else (missing, reordered, or manifest-drifted pass) is rejected so partial usage is returned without coverage.

Solutions

  1. Submit passes strictly in manifest order; if one fails, rebuild the plan/manifest before retrying
  2. Re-run all passes from the current manifest instead of mixing old and new
  3. Buffer out-of-order passes and feed them to accept in order
  4. Check that the PR revision did not change between planning and accepting

Example fix

// before
for pass_result in join_all(pass_futures).await { acc.accept(&pass_result.manifest, pass_result.raw)?; }
// after
let mut results: Vec<_> = join_all(pass_futures).await;
results.sort_by_key(|r| r.manifest.number);
for r in results { acc.accept(&r.manifest, r.raw)?; } // strict order enforced
Defensive patterns

Strategy: validation

Validate before calling

// before calling accept
if pass.manifest.number != expected_next { queue_for_later(pass); }

Try / catch

match acc.accept(&pass.manifest, raw) { Err(e) if e.to_string().contains("out of order") => rebuild_plan_and_rerun(pr).await, ... }

Prevention

When it happens

Trigger: Model responses returned out of order; a pass was retried after the manifest was regenerated (revision drift); caller skipped a failed pass and submitted the next one; manifest was mutated between plan and accept.

Common situations: Parallel pass execution completing out of order; a retried pass built against an older manifest after the PR head moved; dropping one pass's output on a transient model error.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/5b60be7558315d17. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/tools/review.rs:704

pub(crate) struct PrReviewAccumulator {
    manifest: PrReviewManifest,
    outputs: Vec<ReviewOutput>,
    raw_outputs: Vec<String>,
}

impl PrReviewAccumulator {
    pub(crate) fn new(plan: &PrReviewPlan) -> Self {
        Self {
            manifest: plan.manifest.clone(),
            outputs: Vec::new(),
            raw_outputs: Vec::new(),
        }
    }

    pub(crate) fn accept(&mut self, pass: &PrReviewPass, raw: String) -> anyhow::Result<()> {
        let expected = self.outputs.len() + 1;
        anyhow::ensure!(
            pass.manifest.number == expected
                && self.manifest.passes.get(expected - 1) == Some(&pass.manifest),
            "Review pass arrived out of order or does not match the immutable manifest; expected pass {expected}"
        );
        let output = ReviewOutput::from_structured_str(&raw).ok_or_else(|| {
            anyhow::anyhow!(
                "Review pass {expected}/{} did not return valid structured JSON; the partial review was not accepted or posted.",
                self.manifest.passes.len()
            )
        })?;
        self.outputs.push(output);
        self.raw_outputs.push(raw);
        Ok(())
    }

    pub(crate) fn finish(
        self,
        complete_diff: &str,

View on GitHub (pinned to 73e0f67d83)