Skip to content

fix(xtask): retain actionable child failures in PR-evidence diagnostics - #5187

Merged
EffortlessSteven merged 1 commit into
mainfrom
cursor/xtask-pr-evidence-child-diagnostics-3975
Oct 4, 2026
Merged

EffortlessSteven merged 1 commit into
mainfrom
cursor/xtask-pr-evidence-child-diagnostics-3975

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Oct 3, 2026 •

Copy link
Copy Markdown
Member

Closes #5150

Summary

PR-evidence diagnostics in xtask/src/reports/pr_evidence.rs kept only the first line of a child failure and omitted native process status. A real diff_scope_oversized child therefore surfaced as ripr check for PR evidence failed. This PR preserves a bounded, actionable child reason plus the available exit/signal/timeout/unknown distinction through the production packet and console path.

Swarm / Source Boundary

This PR targets EffortlessMetrics/ripr-swarm, the normal development trunk for trusted same-repo ripr work. Confirm the change belongs here:

  • ordinary feature, analyzer, editor, docs, spec, fixture, badge, dependency, or repo-ops development for ripr-swarm
  • repair or follow-up for a same-repo swarm PR
  • swarm-only CI, runner, routing, source-of-truth, or agent-operating surface
  • other swarm-scoped work:

If this PR moves crates.io publishing, VS Marketplace publishing, Open VSX publishing, GitHub Release assets, signing, release environments, or release secrets, close or retarget it. Those surfaces belong in EffortlessMetrics/ripr unless a dedicated release-boundary change has already been approved.

Source-of-truth Links

Proposal:
Spec: docs/specs/RIPR-SPEC-0147-analysis-outcome-projection.md (existing producer success/failure/timeout mapping); no new spec
ADR:
Plan item:
Governing issue or accepted claim: Closes #5150 (follow-up to #3262 fail-fast and #4367 timeout recovery)
Acceptance delta (one sentence): A child ripr check failure keeps its named guard, observed/configured scope, recovery text, and native exit/signal/timeout/unknown status in the error packet and console, without dumping unlimited output or inventing typed analysis authority.

Candidate Relationships

Candidate branch (GitHub PR head is authoritative after publication): cursor/xtask-pr-evidence-child-diagnostics-3975
Stack parent or prerequisite PR (if any): none
Proposed replacement of PR (if any; not yet accepted): none
Acceptance retained from a replaced candidate (if any): none
Accepted winner and losing candidate disposition (when decided): n/a

#5148 (corpus packaging / fixture regex oracle) stays a neighbor. #4861 / draft #4882 typed CoreError has not reached this producer on current main; this PR does not start that migration.

Scope

xtask PR-evidence child-failure diagnostics only. Fail-fast, sentinel consumer blocking, stale check.json removal, snapshot-timeout wording, and the existing shell-safe retry authority are preserved.

Scope Classification

This PR is scoped by:

  • One production behavior
  • One public contract
  • One architectural seam
  • Docs/spec/test-only evidence package
  • Other:

Production delta:

  • run_ripr_check_binary reports native status (exit, signal, timeout, or unknown) instead of dropping it.
  • Error packets keep a bounded child diagnostic, preferring a diff_scope_oversized: guard when present.
  • Truncation is explicit. JSON stdout from a failing child is not copied into the diagnostic or promoted to a successful analysis artifact.

Evidence/support delta:

  • Unit and process tests for multiline stderr, empty stderr, timeout vs snapshot timeout, oversized output, successful JSON, unknown status, Unix signal, and a production-path oversized-diff packet/console control.

Single acceptance criterion:

  • A real oversized-diff child retains its named guard, observed/configured scope, and safe recovery text through the production packet and console path.

Non-goals:

Support-tier Impact

  • none
  • updates docs/status/SUPPORT_TIERS.md
  • changes a README, release, docs, CLI, JSON, editor, CI, or package claim

Claim/proof notes:

  • Diagnostic text only. Public schema still uses warnings[].kind = tool_error and status = error.

Policy Impact

  • none
  • doc artifacts
  • CI lane
  • package boundary
  • lint / Clippy
  • no-panic
  • file policy
  • generated artifact
  • dependency
  • process/network

Ledger or exception notes:

  • none

Proof

git diff --name-only origin/main...HEAD   # xtask/src/reports/pr_evidence.rs
cargo test -p xtask --bin xtask reports::pr_evidence::tests
cargo xtask precommit
cargo xtask check-fast

Result, failures, or skipped proof:

  • Focused tests: 36 passed (0 failed), including multiline stderr, empty stderr, timeout vs snapshot wording, oversized output truncation, successful JSON, unknown status, Unix signal 15, and the production-path oversized-diff packet/console control.
  • cargo xtask precommit: passed.
  • cargo xtask check-fast: ran 10 gates, skipped check-fixture-contracts, independently confirmed 1 changed file vs origin/main.
  • Hosted required checks on published head f3d2bf9e7654a8e64c4c9e8aea1bf9ffe0455a59 were still in progress at review time. Windows process execution was not run on this Linux host. Signal-specific proof is Unix-only as specified.

Claim Boundary

What may be claimed after this PR? What must not be claimed yet?

May claim: xtask PR-evidence error packets and console output retain a bounded child failure reason and native process-status distinction.

Must not claim: typed CoreError migration, analyzer classification change, mutation outcomes, or that hosted CI has passed until the published-head checks are green.

Rollback

How can this PR be reverted safely?

Revert the squash commit. Fail-fast and timeout retry behavior remain as before this diagnostic repair.

Spec-Test-Code Traceability

Static Language Check

  • Static output avoids killed, survived, untested, proven, and adequate.
  • Unknowns include stop reasons where applicable.

CI Economics

Complete this section when the PR changes workflows, policy gates, branch protection expectations, CI artifacts, report uploads, release checks, or the cost/posture of existing lanes. Use n/a for ordinary PRs that do not affect CI behavior.

  • LEM impact: n/a
  • Workflows touched: n/a
  • Branch protection impact: n/a
  • Failure mode caught: n/a
  • Cheaper signal considered: n/a
  • Required lanes affected: n/a
  • Advisory lanes affected: n/a
  • On-demand/release lanes affected: n/a
  • Labels that alter behavior: n/a
  • Artifact families affected: n/a
  • Rollback path: n/a

Engineering Check

  • No new panic, unwrap, expect, todo, or unimplemented in production code.
  • No new panic, unwrap, expect, todo, or unimplemented in tests.
  • New non-Rust programming files are allowlisted with owner, surface, and reason.
  • New generated, dependency, process-spawn, or network surfaces are allowlisted with owner and reason.
  • Errors are reported with actionable context.
  • Public JSON/schema changes are documented.

Gates

Local precommit passed. Hosted required checks remain the merge authority.

Extension changes:

  • n/a
Open in Web Open in Cursor 

PR-evidence error packets previously kept only the first line of a child
failure, so oversized-diff guards and native process status disappeared
behind "ripr check for PR evidence failed". Preserve a bounded child
reason plus the available exit/signal/timeout/unknown distinction.

Closes #5150

Co-authored-by: Steven Zimmerman, CPA <EffortlessSteven@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 776c89ac-7ed8-45b4-9c72-d7264ec2816c
📥 Commits

Reviewing files that changed from the base of the PR and between e6026bd and f3d2bf9.

📒 Files selected for processing (1)
  • xtask/src/reports/pr_evidence.rs
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.


Summary by CodeRabbit

  • Bug Fixes
    • Failure reports now include clearer process status information, including exit codes and Unix signals.
    • Reports surface actionable error output and preserve more context in multiline warnings, with a fallback for empty messages.
    • Long diagnostic messages are limited to a readable length and marked when truncated.
    • Timeout failures and oversized-diff errors are reported more distinctly.

Walkthrough

Child-process failures now report native exit status and bounded diagnostics from stderr or eligible stdout. Error-packet warnings preserve bounded multiline messages. Tests cover status reporting, oversized-diff details, truncation, timeouts, signals, and Windows fake-process output.

Changes

Child-process diagnostic reporting

Layer / File(s) Summary
Build bounded child-process diagnostics
xtask/src/reports/pr_evidence.rs
Failure diagnostics report exit codes or Unix signals. The code selects stderr or eligible stdout, prioritizes details beginning at the oversized-diff guard, and bounds diagnostic text with a truncation marker.
Preserve diagnostics in error packets
xtask/src/reports/pr_evidence.rs
Error-packet warnings now use bounded multiline messages and a fallback for empty errors. Tests cover packet details, truncation, timeout wording, signal status, and Windows fake-process output.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to f3d2b

The oversized-diff diagnostic remains available in error packets, and no actionable merge risk was established. The change is mergeable after normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 47.06% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 34 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the change: preserving actionable child-failure details in PR-evidence diagnostics.
Description check ✅ Passed The description follows the repository template and provides the scope, acceptance criterion, proof results, claim boundaries, rollback plan, and traceability. It also states that hosted checks remain…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit reads the stderr stream,
And finds the exit code in view.
It trims long notes with care and skill,
Keeps guard-line details clear and true.
Then hops away through tests anew.

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

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request improves error reporting and diagnostics for PR evidence generation failures in xtask/src/reports/pr_evidence.rs. It introduces logic to format, bound, and truncate child process output (stdout/stderr) to prevent oversized diagnostics, and captures native exit codes or Unix signals. It also includes comprehensive unit tests to verify these behaviors. The review feedback suggests optimizing the prefer_named_guard function to avoid intermediate allocations when searching and slicing the input text, which is a valuable performance improvement.

Comment thread xtask/src/reports/pr_evidence.rs Resolved

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Author self-review on exact head f3d2bf9e7654a8e64c4c9e8aea1bf9ffe0455a59. GitHub cannot request changes from the author; this COMMENT is the disposition record, not approval.

reviewed_head_sha: f3d2bf9e7654a8e64c4c9e8aea1bf9ffe0455a59
integration_basis: origin/main e6026bdc65976b2c39ac025e4a6112c931481f89
claim_boundary: xtask PR-evidence child-failure diagnostics only. Preserve a bounded actionable child reason and native exit/signal/timeout/unknown distinction through the packet and console. No typed-error migration, guard increase, workflow bypass, analyzer classification change, or #5148 packaging repair.
changed_surfaces_and_semantic_owners_inspected: xtask/src/reports/pr_evidence.rs (producer run_ripr_check_binary, pr_evidence_error_packet, reject_pr_evidence_error_packet consumer, markdown renderer). CI consumer remains cargo xtask ripr-pr. Product crate first_line path is in-process and out of this claim.
blocking_findings: none in source/oracle on this head.
non_blocking_suggestions: Markdown still flattens newlines via md_warning; packet/console retain the multiline child text. crates/ripr/src/app/pr_evidence.rs still uses first_line for the in-process producer.
refuted_or_stale_findings: none.
proof_and_ci_observed: cargo test -p xtask --bin xtask reports::pr_evidence::tests — 36 passed, including multiline stderr, empty stderr, timeout vs snapshot wording, oversized output truncation, successful JSON, unknown status, Unix signal 15, and production-path oversized-diff packet/console control. cargo xtask precommit passed. cargo xtask check-fast ran 10 gates, skipped check-fixture-contracts, independently confirmed 1 changed file vs origin/main.
proof_or_review_missing: hosted exact-head required checks are still in progress (Ripr Rust Small on GitHub Hosted / Rust gates in_progress). Windows process proof is covered by cfg(windows) fakes but was not executed on this Linux host. Signal-specific proof is Unix-only as specified.
affected_currentness_dimensions: production implementation, test stimulus, test oracle. Public schema unchanged (warnings[].kind remains tool_error; status remains error).
residual_assumptions_and_non_claims: child prose is diagnostic text, not typed CoreError or analysis_scope. Unknown native status stays unknown. Truncation is explicit. No claim that hosted CI has passed.
disposition: REVIEW_INCOMPLETE

Oracle challenge: restoring first_line(error) would drop the named guard/recovery from error_packet_retains_multiline_child_failure_and_native_status and write_pr_evidence_keeps_oversized_diff_child_in_error_packet. Omitting native status would fail the exit/signal/unknown tests. Treating timeout as native status: signal would fail the timeout control. Dumping JSON stdout on empty stderr would fail child_failure_prefers_named_guard_and_ignores_json_stdout.

Re-enter published-head review-pr after required hosted checks on this SHA are terminal.

@github-actions github-actions Bot 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.

Confirmed findings

  • actionable_child_reason drops stdout entirely when stderr is empty, so a non-zero-exit child that emits only non-JSON stdout (e.g. a Rust panic message) is summarised by describe_native_status alone with no actionable child line, regressing the 'retain actionable child failures' claim for the empty-stderr path.

Verification questions

  • Confirm fake_ripr_invocation now writes child stdout/stderr to sidecar .stdout.txt/.stderr.txt files and uses 'type "%~dpn0.stdout.txt"' on Windows; the diff hunk only shows Windows branch change, and the Unix branch is not shown, so any non-trivial Unix path divergence is hidden from this lane.
  • Confirm unsafe-review card UR-workspace-...-box_from_raw-from-raw-09ba5fbebe4d at line 1278 references box_from_raw in a synthetic ExitStatus helper that the diff itself adds and gates on cfg(unix)/cfg(windows).
  • Confirm run_ripr_check_truncates_oversized_child_output still relies on stderr.chars().count() > err.chars().count() as a coarse length sanity check; this only proves the bounded diagnostic is smaller, not that the truncation occurred at the documented cap. A stronger assertion would assert err.chars().count() <= CHILD_DIAGNOSTIC_MAX_CHARS + TRUNCATED_MARKER.chars().count() to mirror the unit-test invariant in error_packet_truncates_oversized_tool_error_explicitly.

Refuted

  • A Box::from_raw or Vec::from_raw allocator-failure objection applies to this PR; refuted because: No raw pointer construction, no allocator-failure call site, and no claim in the diff, PR body, or seeded thread raises allocation-failure analysis. The unsafe-review sensor card is about pointer validity (UR-workspace-xtask-src-reports-pr-evidence-rs-synthetic-exit-status-operation-box_from_raw-from-raw-09ba5fbebe4d-pointer_validity-c1) on a test-only synthetic ExitStatus helper, not a production handoff. Allocation failure on Box::from_raw does not return None/empty and would be a refuted false-premise here.
  • No Box::from(slice) / Box::<[u8]>::from(slice) allocation-failure path exists in this diff; calibration says do not raise this objection unless the diff/PR explicitly does.
  • A second xtask child-failure formatter or native-status describer exists and this fix must be mirrored there; refuted because: Single-file diff; no second formatter surfaced in PR body, review thread, or unsafe-review card. first_line is removed from the same file and not re-introduced elsewhere.
  • ExitStatus value can be detached, resized, or invalidated between reads in this diff, risking a stale code/signal snapshot.; refuted because: Rust std::process::ExitStatus is Copy when constructed and only exposes accessors .code() and .signal() over the captured WaitStatus; describe_native_status is a pure function on Option with no inter-thread sharing or storage beyond the call. No active-view resize/detach surface exists in this file or diff.
  • prefer_named_guard collects every line into a Vec<&str> and joins to a new String even when the first line already matches the named guard, which is exactly the common path for a real oversized-diff child.
  • native_status_reports_unix_signal_without_inventing_an_exit_code could tautologically return 'native status: signal 15' while also including 'exit ' elsewhere and still pass; refuted because: The assertion is describe_native_status(Some(status)) == 'native status: signal 15' equality AND !describe_native_status(Some(status)).contains('exit '); both shafts must hold, eliminating tautology.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.

Parked follow-ups

  • Smoke test on Windows .cmd fake-ripr invocation now redirects stdout/stderr through temp files instead of inline echo, which raises a small reentrancy concern if %~dpn0.stdout.txt is later read by the same script, but the script only types it once and does not re-read.

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Incorrect finding: actionable_child_reason does not drop non-JSON stdout when stderr is empty.

finding: empty-stderr path drops stdout, so a panic-on-stdout child is summarised by native status alone
classification: incorrect finding
production_path: xtask/src/reports/pr_evidence.rs actionable_child_reason + format_ripr_check_child_failure

When stderr is nonempty, stderr wins (named-guard preference). When stderr is empty, the function falls through to stdout and only then drops empty or JSON-looking payloads:

let stdout = stdout.trim();
if stdout.is_empty() || looks_like_json_payload(stdout) {
    return String::new();
}
bounded_text(&prefer_named_guard(stdout), ...)

A non-zero-exit child that writes a Rust panic (or any other non-JSON prose) to stdout with empty stderr is retained as the bounded child reason after native status: exit N. JSON stdout on empty stderr is the documented negative control (child_failure_prefers_named_guard_and_ignores_json_stdout): limited-check JSON must not become a diagnostic or a successful check.json. Completely empty stdout+stderr keeps native status only, which is the empty-stderr process control.

Head unchanged. This is not a production repair.

Verification answers:

  • Windows fake_ripr_binary writes sidecar .stdout.txt / .stderr.txt and type "%~dpn0.stdout.txt". The Unix branch is unchanged: printf '%s\n' via /bin/sh and sh_single_quote. There is no Unix sidecar path.
  • synthetic_exit_status / ExitStatus::from_raw is a test-only helper behind cfg(unix) / cfg(windows). It is not a production handoff. The unsafe-review box_from_raw card is that helper, not allocator-failure analysis of this diagnostic path.
  • run_ripr_check_truncates_oversized_child_output is a production-path witness that the captured child is truncated (TRUNCATED_MARKER and strictly smaller than the raw stderr). The documented cap is already asserted by error_packet_truncates_oversized_tool_error_explicitly. Tightening the process test to <= CHILD_DIAGNOSTIC_MAX_CHARS + marker would duplicate that unit invariant, not change packet/console behavior. Non-blocking oracle suggestion; not applying on this head.

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

reviewed_head_sha: f3d2bf9
integration_basis: main
claim_boundary: Retain actionable child failures, stderr context, and native exit status in xtask PR-evidence diagnostics without swallowing errors or misattributing timeouts.
changed_surfaces_and_semantic_owners_inspected:

  • xtask/src/reports/pr_evidence.rs: child capture, timeout retry formatting, prefer_named_guard, and diagnostic status reporting
    blocking_findings: none
    non_blocking_suggestions: none
    refuted_or_stale_findings:
  • Gemini comment on prefer_named_guard: refuted with source evidence (text.find(line) introduces substring collisions on earlier lines; Vec<&str> slice indexing is bounded by bounded_text to 12 lines / 2048 chars). Thread resolved.
    proof_and_ci_observed:
  • Unit/integration tests in pr_evidence.rs pass.
  • Remote CI: ub-review (passed), Rust-only feature lane (passed), security checks (passed); Rust gates in progress.
    proof_or_review_missing:
  • Required check (Ripr Rust Small Result) in progress on hosted runner.
    affected_currentness_dimensions: none
    residual_assumptions_and_non_claims: PR-evidence diagnostic reporting only; does not change cargo/git child execution semantics.
    disposition: REVIEW_INCOMPLETE

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 4, 2026 00:26
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-04T00:30:19.870590Z f3d2bf9 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Exact-Head Merge Review: REVIEW_READY

  • repository: EffortlessMetrics/ripr-swarm
  • pull_request: #5187
  • reviewed_head_sha: f3d2bf9
  • controlling_issue: #5150
  • review_timestamp: 2026-10-04T00:26:15Z

Review Lanes & Invariants

  • review_contract:exact_head_binding: Bound to published head f3d2bf9e7654a8e64c4c9e8aea1bf9ffe0455a59.
  • review_contract:semantic_owner_and_consumers: Semantic owner is xtask/src/commands/pr_evidence.rs, rendering child failures in PR-evidence diagnostics.
  • review_contract:wrong_behavior_oracle_challenge: Tests assert that child failure output (including multi-line diagnostics) is retained and actionable, rather than swallowed or truncated blindly.
  • review_contract:exact_head_ci_receipts: All required and advisory checks completed on f3d2bf9e7654a8e64c4c9e8aea1bf9ffe0455a59:
    • Ripr Rust Small Result: SUCCESS (Ripr Rust Small on GitHub Hosted / Rust gates completed in 36m54s)
    • ub-review: SUCCESS
    • build and inspect Linux x64 wheel: SUCCESS
    • clean pip install and useful Python journey: SUCCESS
    • clean uv install and useful Python journey: SUCCESS
    • cargo-deny: SUCCESS
    • dependency-review: SUCCESS
    • pr-plan: SUCCESS
    • CodeRabbit: SUCCESS
    • All review threads resolved.

Disposition

REVIEW_READY (candidate ready for merge convergence).

@EffortlessSteven
EffortlessSteven merged commit 9da89e2 into main Oct 4, 2026
41 of 42 checks passed
@EffortlessSteven
EffortlessSteven deleted the cursor/xtask-pr-evidence-child-diagnostics-3975 branch October 4, 2026 00:26

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f3d2bf9e76

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

{
"kind": "tool_error",
"message": first_line(error),
"message": bounded_tool_error_message(error),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Escape child diagnostics before rendering Markdown

When the retained oversized-diff diagnostic reaches repo-exposure.md, its recovery text ends with RIPR_MAX_DIFF_CHANGED_RUST_LINES=<number>. render_pr_evidence_markdown passes this warning through md_warning, whose non-timeout branch only flattens newlines, so CommonMark treats <number> as an HTML tag and the rendered artifact loses the placeholder, displaying an invalid RIPR_MAX_DIFF_CHANGED_RUST_LINES=. recovery instruction. Escape general warning prose or render the environment assignment as code, and add an assertion against rendered Markdown rather than only checking that the source contains Repair route.

AGENTS.md reference: AGENTS.md:L242-L243

Useful? React with 👍 / 👎.

@github-actions github-actions Bot 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.

Confirmed findings

  • xtask/src/reports/pr_evidence.rs:2174 — write_pr_evidence_keeps_oversized_diff_child_in_error_packet re-parses the packet and uses only three raw substring assertions on the JSON string. The earlier error_packet_retains_multiline_child_failure_and_native_status already shows how to assert on packet["warnings"][0]["message"] directly; reuse that shape and also assert the bounded-length contract on the production-path message.
  • Markdown renderer flattens newlines via md_warning so the diagnostic message is single-line in PR-comment output even though packet and console retain multiline child text; this is a pre-existing contract, not a regression, but the PR claim 'retain through packet and console' should not be read as covering the rendered Markdown body line shape.

Verification questions

  • Confirm write_pr_evidence_keeps_oversized_diff_child_in_error_packet re-serializes the whole packet with serde_json::to_string and re-parses it, then only checks 'diff_scope_oversized:' and 'native status: exit 2' substrings plus 'weakly_exposed' absence. The whole packet round-trip is exercised but the assertion reduces to three cheap string contains on a JSON blob, weakening oracle value vs. asserting on packet["warnings"][0]["message"] directly.
  • Confirm run_ripr_check_truncates_oversized_child_output asserts err.chars().count() < stderr.chars().count(), but the unbounded err also includes 'ripr check for PR evidence failed (native status: exit 4)\n' prefix (~50 chars). With 80 lines × ~70 chars ≈ 5600 chars of stderr, the bounded diagnostic could still exceed stderr when capped at 2048+marker, and 2048 < 5600 only holds because stderr is large. A direct length-cap assertion would be more discriminating.
  • Confirm fake_ripr_invocation Windows path now writes sidecar .stdout.txt/.stderr.txt and uses 'type "%~dpn0.stdout.txt"'; the Unix branch in fake_ripr_invocation is not shown in the diff hunk. PR proof says Windows process execution was not run on this Linux host. The source-route claim ('production-path oversized-diff packet/console control') is exercised by write_pr_evidence_keeps_oversized_diff_child_in_error_packet, but only via the Unix shell. Windows fake-shell semantics for type/redirection are uncovered by any test in this diff.
  • Confirm coarse length sanity check stderr.chars().count() > err.chars().count() proves bounded is smaller but not that truncation occurred at the documented cap.
  • Confirm bounded_tool_error_message keeps child stderr up to TOOL_ERROR_MAX_CHARS (4096) and 24 lines without stripping env-style leaks if the child emits them. PR body forbids env-data exposure; no test asserts the cap excludes RIPR_BIN/PATH= substrings. Coverage is in production-path packet test which only checks absence in the unknown-status branch.

Refuted

  • unsafe-review card UR-workspace-...-box_from_raw-from-raw-09ba5fbebe4d at line 1278 targets synthetic_exit_status, which only calls ExitStatus::from_raw (cfg-gated) and does not construct a Box<[u8]> or any buffer; pointer-validity contract_coverage is advisory, not a confirmed UB.
  • synthetic_exit_status ExitStatus::from_raw could expose a dangling pointer or uninitialized memory when consumed by describe_native_status; refuted because: ExitStatus::from_raw on std::process::ExitStatus stores an integer (Unix wait-status or Windows u32 code); describe_native_status only invokes .code() and ExitStatusExt::signal(), which are pure decoders of that integer with no pointer dereference. The value is consumed by format! and never escapes the function.
  • actionable_child_reason drops stdout when stderr is empty, regressing 'retain actionable child failures' for panic-on-stdout children.; refuted because: false-premise: function falls through to stdout after empty stderr and only drops stdout when empty or JSON-looking; non-JSON prose panic on stdout is bounded and retained after native status. Covered by error_packet_retains_multiline_child_failure_and_native_status and child_failure_prefers_named_guard_and_ignores_json_stdout.
  • bounded_text / format_ripr_check_child_failure duplicates an existing xtask stderr/stdout normalizer that should be shared and widened as part of this PR.; refuted because: Scanned xtask/src for prior stderr/stdout trimming and child-failure formatting helpers; the only pre-existing helper was first_line (a single-line clip), which this diff removes. There is no shared normalizer to reuse, and the new bounded_text + DIFF_SCOPE_OVERSIZED_GUARD prefix are PR-evidence-specific. Broadening to a shared helper would violate the #5150 claim boundary.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.

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.

fix(xtask): retain actionable child failures in PR-evidence diagnostics

2 participants