Skip to content

fix(first-pr): stop on unusable review cards instead of reporting no gap - #4019

Merged
EffortlessSteven merged 16 commits into
mainfrom
claude/onboarding-first-pr-chain
Sep 25, 2026
Merged

EffortlessSteven merged 16 commits into
mainfrom
claude/onboarding-first-pr-chain

Conversation

@claude

@claude claude Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Steven · project thread

Before: on a fresh checkout of a Rust PR with a repair-ready seam, a new user ran ripr first-pr --root . --base origin/main --head HEAD, the step that doctor suggests. They then followed its printed next commands: repo exposure, then gap ledger. The third run said State: no actionable gap and printed no next command. The ledger built from repo exposure only holds repo-scoped records, so the PR's repair start can only come from the review cards, and the cards had never been generated. first-pr was giving a verdict on evidence it had not read.

After: the same walk reaches State: top_gap / Start repair: ripr agent repair --root . --seam-id … --phase before on the fourth run. The third run now says Missing artifact: PR repair cards at target/ripr/review/comments.json and names ripr review-comments --root . --base origin/main --head HEAD --out target/ripr/review/comments.json.

How: when the ledger yields no top gap on a Rust root, first-pr stops on the cards if it cannot use them, instead of falling through to no-action. The recovery states are:

  • missing: missing_artifact;
  • not a RIPR report, or it records no status/root/base/head: malformed_artifact;
  • status not advisory: blocked_artifact;
  • another root: wrong_root;
  • another base or head: stale_artifact.

Each names the seam-level command. Current cards with no repair start, and cards rendered from the gap ledger, still end in no-action with the reason naming the route.

This builds on the review-card source #3960 added. #3960 is now on main as a squash commit, so this branch was brought onto main by replaying only its own changes (merge dd6a87b62); the diff against main is this PR's six files.

Summary

Onboarding re-walk F60-10: "no actionable gap" is no longer an intermediate state on the first-pr regeneration chain.

Swarm / Source Boundary

ripr-swarm development PR.

Source-of-truth Links

Scope Classification

Output behaviour fix in output/first_pr.rs: new selected.state values on an existing path, all from the state set the editor projection already supports (firstPrProjection.ts). No new fields.

Decisions

  • Recover, don't compose. The finding offered two fixes: say every needed artifact at step 1, or compose them. first-pr's limits state "Does not run hidden analysis", so it still names one missing input per run. The chain is now three regeneration steps with no dead end. The PR does not shorten it.
  • Artifact table corrected. The artifacts[] entry for the cards on a Rust root named ripr review-comments … --gap-ledger …. That form produces cards that cannot carry a repair start (the code's own comment says so). It now names the seam-level command. Preview-language roots keep the gap-ledger form because they have no seam analysis. Four Rust-root goldens in fixtures/first_successful_pr/ change by that one string.
  • --mode instant left alone. The finding noted that first-pr regenerates repo exposure with --mode instant while pilot and CI use ready. The ledger from instant mode is only a stepping stone here, and the repair start comes from the review cards, which do their own seam analysis. Switching to ready would slow step 1 on large repositories without changing where the walk ends.

Support-tier Impact

Changes CLI and JSON output for first-pr in the recovery states above; docs/FIRST_PR_WORKFLOW.md updated.

Policy Impact

None.

Proof

  • review_card_repair_start_fails_closed_on_stale_or_missing_reports now asserts status: blocked, the state per case, and commands.next equal to the seam-level command. Negative control: restoring the old missing-cards branch fails it with status: no_action.
  • no_repairable_gap_is_advisory_no_action now writes a current, empty card report, so its no-action is a verdict on cards that were read.
  • End-to-end re-walk on a fresh clone of the pricing repo (feature branch with a > to >= change): runs 1 to 3 each name one missing input, and run 4 is top_gap with ripr agent repair --root . --seam-id 0d196886bad1b124 --phase before. On the base branch the same walk ends at run 3 with no actionable gap.

Claim Boundary

This fixes the dead end. It does not collapse the three regeneration steps into one.

Rollback

Revert the commit.

Spec-Test-Code Traceability

Tests in output/first_pr.rs (above) and the first-successful-PR fixture corpus; doc in docs/FIRST_PR_WORKFLOW.md.

Static Language Check

No new outcome claims.

CI Economics

No new jobs.

Engineering Check

Local, on head dd6a87b62 (main ee067207d plus this PR's own changes), each exit 0:

  • cargo fmt --check
  • cargo clippy -p ripr --all-targets -- -D warnings
  • cargo test -p ripr --lib: 5456 passed
  • cargo test -p ripr --test cli_smoke --test generated_review_workflow: 233 and 7 passed
  • cargo xtask goldens check, check-fixture-contracts, check-output-contracts, markdown-links
  • cargo xtask precommit

Gates

Hosted CI pending on dd6a87b62. Review status: REVIEW_INCOMPLETE.

🤖 Generated with Claude Code

https://claude.ai/code/session_01JR38133FoyEXqWZtnC9UeK

Claude added 7 commits September 23, 2026 01:08
…outes

Where a review card, gate repair route, or inline PR comment already
names a seam that passes the repair-packet flip, lead with
`ripr agent repair --root . --seam-id <id> --phase before` instead of
the snapshot verify command. The command is computed once in
evidence_record::canonical_repair_command_for, gated on
repair_packet_eligibility(entry).eligible(), and carried (never
derived) by review_comments, the gate repair route, and the inline
comment publisher. Non-actionable routes and gap-record routes emit
nothing and keep the existing verify guidance.

Refs #3906 (outcome 3, gate and repair-card surfaces).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JR38133FoyEXqWZtnC9UeK
…e flip

The repo-exposure evidence record, the dogfood gate-adoption receipts, and
the gate-decision verification fixture now carry repair_command. The
first-useful-action unchanged-after-attempt snapshots are regenerated
through the corpus test's own normalizer, and the verify and receipt
artifacts are rebound to the new snapshot bytes; their movement is
unchanged. The evidence-record test now calls the builder with an
actionable state directly, so removing the eligibility check fails it.

Refs #3906.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JR38133FoyEXqWZtnC9UeK
… CI comments with it

agent repair refuses an edit target outside a test surface, so a seam
whose recommended test lives in an inline #[cfg(test)] module was
offered a repair start it could not use. repair_start_command_for now
also requires the recommended test file to be a test surface, and
canonical_repair_command_for goes through it.

The generated CI's compact inline comment headline read only the Verify
line, so a card carrying "Start the repair:" still led with Verify. The
jq now captures the repair start and leads with it when present.

Refs #3906

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JR38133FoyEXqWZtnC9UeK
…e-repair-route

# Conflicts:
#	crates/ripr/src/output/gate/tests.rs
…d repair

Generated CI builds the gap ledger from repo-exposure, whose records are all
repo-scoped, so `ripr first-pr` always fell to no_action for Rust even when
the review-comments file held a card that passed the repair-packet flip. The
review-comments input was only checked for existence.

first-pr: when the ledger yields no top gap, read the review-comments input
and select the first actionable card in comments[] then summary_only[] that
carries a non-empty llm_guidance.repair_command. The command is carried
byte-for-byte; first-pr never builds `agent repair` from a seam, gap, or
probe id. Every selected field comes from that same card (source_artifact is
the review-comments path, repair.route is AgentRepairTransaction, verify and
receipt are the card's), never mixed with a ledger record. The card is used
only when the report is tool=ripr, status=advisory, and names this
invocation's root, base, and head; otherwise it fails closed to no_action.
The selection keeps state top_gap so the editor projection and pr-summary
consume it unchanged. receipt_path and agent_packet_command are null for a
card selection: the card is not a ledger gap and first-pr does not parse
commands for paths. selected.repair_command is present only when carried, so
ledger-selected packets are byte-identical to before.

The repair start is not added to `commands`: the VS Code first-pr projection
fails the whole packet closed (unsafeCommand) on any `commands` value outside
its allowlist, and `ripr agent repair` is not on it.

CLI and Markdown render a "Start repair" line before Verify. A no_action
reason now says why no card supplied a start and, when the cards are missing
or were rendered from the gap ledger, names the seam-level
`ripr review-comments --root --base --head --out` route.

pr-summary: carry start-here selected.repair_command into TopRepair (never
read review comments directly, which could mis-pair a card with start-here's
top gap), render a "start repair" line before verify in both Markdown
surfaces, and make it the first local reproduction command when present.

Docs: OUTPUT_SCHEMA start-here and pr-evidence-summary contracts,
FIRST_PR_WORKFLOW, RIPR-SPEC-0075 field tables.

Refs #3906

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JR38133FoyEXqWZtnC9UeK
…r starts

The fail-closed test covered base, status, root, scope and a missing
report but not a report generated for another head. Removing the head
check from review_comments_currentness_problem now fails it.

Refs #3906

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JR38133FoyEXqWZtnC9UeK
Re-walk F60-10. On a fresh Rust checkout, following first-pr's own next
commands (repo exposure, then gap ledger) ended in `State: no actionable
gap` with no next command, while the PR had a repair-ready seam. The
repo-exposure ledger holds only repo-scoped records, so first-pr's second
source, the review cards, decides; with the cards missing, first-pr gave
a no-action verdict on evidence it never read.

Now a Rust root stops on the cards instead:
- missing: `missing_artifact` for `PR repair cards`, next command the
  seam-level `ripr review-comments --root . --base <base> --head <head>
  --out target/ripr/review/comments.json`;
- not a RIPR report, or no status/root/base/head: `malformed_artifact`;
- status not advisory: `blocked_artifact`;
- another root: `wrong_root`; another base or head: `stale_artifact`.
Current cards with no repair start, and cards rendered from the gap
ledger, still end in no-action with the reason naming the route.

The `artifacts[]` entry for the cards on a Rust root now names the same
seam-level command. It named the `--gap-ledger` form, whose cards cannot
carry a repair start. Preview-language roots keep the gap-ledger form.

Fresh-checkout re-walk on the pricing repo: repo exposure, gap ledger,
review cards, then `top_gap` with `Start repair: ripr agent repair ...
--phase before`.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JR38133FoyEXqWZtnC9UeK
@coderabbitai

ghost commented Sep 24, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 4136e1be-3a1a-429a-91e8-9548a1aca004

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

ghost left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decision

  • Needs reviewer attention before upstream: findings remain.

Confirmed findings

  • currentness helper branches for tool!=ripr and missing-root have no direct test case in the new fail-closed loop; risk is low because both map to malformed_artifact in the helper.

Verification questions

  • Confirm negative control claim 'restoring the old missing-cards branch fails it with status:no_action' is asserted in PR body but no #[cfg] toggle or inline mirror is in the diff; proof relies on the new green invariants, which is acceptable but leaves the negative-control claim unverified by a paired test.
  • Confirm review_comments_regeneration_command picks the seam-level form for Rust roots and the gap-ledger form for preview-language roots, aligning the artifact table with the route the code actually reads.
  • Confirm each test case now asserts status: blocked, selected.state in {stale_artifact, blocked_artifact, wrong_root, missing_artifact}, and commands.next equal to the seam-level command; negative control by 'agent repair' absence preserved.

Refuted

  • Restoring the old missing-cards branch makes the new test fail with status:no_action (negative control).; refuted because: The PR body states this negative control exists, but no #[ignore] or paired toggle is in the diff. The green invariants (status=blocked, !contains 'agent repair', commands.next=seam_route) would fire under the old branch, so the proof is implicit. Classifying as gap, not refuted.

Parked follow-ups

  • Green path is covered for malformed (parse error), wrong root, stale base/head, and blocked status; the empty-but-current cards path is added in no_repairable_gap_is_advisory_no_action. No adversarial fixture for tool!=ripr or status=advisory+root-string missing is in the new loop, but those map to malformed_artifact via the helper and are exercised by the helper's own unit coverage if any.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.
  • Artifact-verifier failed exit 2 with no receipt detail in packet; cannot trust goldens or build outputs until receipt is inspected.
  • Cargo-test is scheduled-late; tests that gate this behavior are not yet receipted.

Claude added 7 commits September 24, 2026 04:53
…st-pr-repair-start

# Conflicts:
#	docs/OUTPUT_SCHEMA.md
#	docs/specs/RIPR-SPEC-0075-pr-evidence-summary.md
`cargo test -p ripr --lib` does not compile on main since 64f3b92.
#3936 added `repair_route_leads_with_the_repair_start_when_carried`,
which calls `push_repair_route(out, route)`. #3968, branched before
#3936 landed, added a third `changed_line_anchored: bool` parameter.
Each PR was green on its own base; the combined tree fails with E0061
at output/gate/presentation.rs:630 and :642.

The test now passes `true`. The start-repair line it pins does not
depend on the flag.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JR38133FoyEXqWZtnC9UeK
(cherry picked from commit 9884f9b)
…single Start here block

#4011 made dogfood_report_packet_index_scenarios_have_checked_receipts render
the corpus instead of comparing two goldens, and #3973 removed the second
"Start here:" block from the rendered index. Each merged green against a
main without the other, so main now fails that required xtask test on its
first case. Regenerated all seven cases with the corpus canonical_command.
Six index.md files lose the duplicate block; every index.json is unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JR38133FoyEXqWZtnC9UeK
(cherry picked from commit 3a0d679)
…lt-base change

#4002 made CheckInput::default().base None and reblessed every --diff
fixture on its base. #3944 (python_src_layout_package_import) and #3985
(tail_comparison_boundary) were blessed on bases without #4002, so each
merged with "base": "origin/main" and base_revision "origin/main", and
`cargo xtask goldens check` on main reports both as drift. Reblessed with
a RIPR-SPEC-0084 reason; only base/base_revision change, the same delta
#4002 applied to the other fixtures. goldens check: 0 drift entries.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JR38133FoyEXqWZtnC9UeK
(cherry picked from commit 7930fef)
…closed loop

Another tool's report, and reports that do not record their status, root or
head, each stop first-pr as malformed_artifact with the seam-level
regeneration command. Only the stale, blocked, wrong-root and missing cases
were exercised before. Disabling the tool check fails the test.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JR38133FoyEXqWZtnC9UeK
Keeps #3962 (stacked on this branch) measurable: #3962 already carries
main, so while this base lacked it, #3962's PR-evidence diff counted all
of main's recent changes (8191 changed Rust lines against the 7500
budget) and the Rust gates job failed. Clean merge.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JR38133FoyEXqWZtnC9UeK
Keeps this stacked branch's base current so its PR-evidence diff
measures only its own change.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JR38133FoyEXqWZtnC9UeK
Base automatically changed from claude/onboarding-first-pr-repair-start to main September 24, 2026 15:26
Claude added 2 commits September 24, 2026 15:30
…anch

#3960 landed as one squash commit, so this branch's copy of its history
no longer matches main. Replayed only this PR's own changes (the diff
from #3960's last head to this branch) onto current main, which also
carries #3962; they applied cleanly.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JR38133FoyEXqWZtnC9UeK
One conflict, in docs/FIRST_PR_WORKFLOW.md. #3987 rewrote the review-card
paragraph (after-phase step, manual verify and receipt labels, CI
summary). This branch replaced that paragraph's no-action ending with
the fail-closed recovery states. Kept #3987's paragraph up to "never
builds one from a seam id" and this branch's recovery paragraph after
it, dropping #3987's old no-action sentence that the recovery paragraph
supersedes.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JR38133FoyEXqWZtnC9UeK

ghost left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exact-head review — read-only

Identity. Head e646e8ef19224408654697a22518706d7a69978b; draft; base main; mergeable. Effective diff vs main is exactly this PR's six files (verified with git diff origin/main...origin/pr/4019 --stat; the branch's extra commits are main-merge commits, no carried foreign changes).

CI at review time. Required check Ripr Rust Small Result pass (run 36042864155; Rust gates 23m36s pass); ub-review pass (10m41s); droid-review pending (run 36042863484); rest pass or policy-skipped.

Claim verification (against head source, not the body)

  1. The stop path derives from real card validity checks — verified, and fail-closed. review_card_repair_start (first_pr.rs:1016) maps every unusable-cards condition to CardFallback::Recover(Selection) with a state, and only cards that were read AND current fall to CardFallback::NoCard → no-action:
    • missing → missing_artifact (Selection::missing_artifact, first_pr.rs:675) with the seam-level ripr review-comments --root . --base … --head … --out target/ripr/review/comments.json as commands.next;
    • not a RIPR report / no status / no root / no base / no head → malformed_artifact;
    • status not advisory → blocked_artifact;
    • other root → wrong_root; other base or head → stale_artifact (review_comments_currentness_problem, first_pr.rs:1084–1145, returns (state, problem) pairs; Selection::blocked at :691).
      Both constructors render status: "blocked", which suppresses repair claims downstream. The missing case on a preview-language root correctly stays NoCard (no seam-level route exists there).
  2. State set is projection-supported — verified. editors/vscode/src/firstPrProjection.ts handles missing_artifact (:344), stale_artifact (:350), wrong_root (:356), malformed_artifact (:362), blocked_artifact (default branch) and lists all of them in FIRST_PR_PACKET_BLOCKED_STATES (:390–395). No new field, as claimed.
  3. Tests discriminate. review_card_repair_start_fails_closed_on_stale_or_missing_reports exercises nine recover cases (base, status, root, head, non-ripr tool, unrecorded status/root/head, missing), each asserting status == "blocked", the per-case selected.state, commands.next == <seam-level command>, the reason needle, and no agent repair anywhere in the packet. The old behavior (missing cards → no_action) fails these pins. The gap-ledger-scoped case is pinned separately to stay no_action with the "rendered from the gap ledger" reason. no_repairable_gap_is_advisory_no_action now writes a current, empty card report first, so its no-action is a verdict on evidence first-pr actually read — honest absence rendering.
  4. Artifact-table correction is routed, not special-cased. review_comments_regeneration_command (first_pr.rs:1148) picks the seam-level command on Rust roots and the --gap-ledger form only when uses_check_output_gap_ledger(root) (:1871: no Cargo.toml + python/ts markers). The four changed goldens (blocked-ledger, boundary-gap, empty-diff, output-contract-gap — all marker-less Rust roots) change by exactly the one string; python-preview-gap (pyproject.toml) and typescript-preview-gap (package.json) keep the old form. The goldens therefore discriminate the routing branch, not just the text.
  5. Docs parity. docs/FIRST_PR_WORKFLOW.md matches the new behavior, including the honest "three regeneration steps … Each run names the next one" framing.

Findings

  • Non-blocking (observation, no change requested): for a root that is neither Rust nor preview-Python/TypeScript (no Cargo.toml, no pyproject/package.json), a missing-cards stop also names the seam-level review-comments route; running it there yields cards with no repair start and the walk ends in an honest no-action. Not a dead end; noting only so a future multi-language root doesn't mistake the state name for a Rust-only path.
  • No blocking findings.

What remains for merge readiness

The candidate itself looks merge-ready except for ceremony:

  1. Un-draft.
  2. droid-review settling (not on the required path — protection requires only Ripr Rust Small Result, currently green on this head — but keep the hosted record current for the final head).
  3. Reconfirm the required check on the final head if anything moves, and current-head review currency (this comment is on e646e8ef).
  4. No unresolved review threads today.

Disposition: REVIEW_READY

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review September 25, 2026 05:27
@chatgpt-codex-connector

ghost commented Sep 25, 2026

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@EffortlessSteven
EffortlessSteven merged commit 7e6c57e into main Sep 25, 2026
@EffortlessSteven
EffortlessSteven deleted the claude/onboarding-first-pr-chain branch September 25, 2026 05:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants