โ† Back to Pull requests

๐Ÿ› fix(gates): keep a red gate's failure report when output is clipped #177

Closed
unknown closed this pull request without merging on Oct 23, 2026 19:35 UTC
View on GitHub
unknown unknown commented on Oct 23, 2026 19:20 UTC
Author

User description


Summary

On erp's S-0004 night, T-0007's e2e gate failed on two tests. The retry got the failed tests' names but none of their tracebacks, debugged blind, and hit the agent timeout.

pytest prints the FAILURES section first, then the coverage table, then the short summary. Every clip between the gate and the retry kept only the tail:

| Clip | Where | Before |
|---|---|---|
| gate output | base/shell.py truncate | head 2000 + tail 6000 of 8000 |
| recorded result | application/telemetry.py _recorded_result | last 4000 |
| retry's context | application/contextpack.py _red_gates | last 2000 |

The fix shares one marker and one helper:

  • FAILURE_REPORT finds where pytest's FAILURES or ERRORS report opens.

  • truncate gives that report the 6000-character share in place of the head when the report falls in the clipped middle. The tail keeps the last 2000 characters, which hold the summary.

  • clip(text, limit) keeps three quarters from the report and the last quarter. The recorded result and the retry's context use it.

  • Output with no such report keeps its tail, as before. A harness stream is JSON lines, so the anchored marker can't match it, and the final-line rescue is unchanged.
  • Tests

  • test_a_failure_report_survives_every_clip_down_to_the_retry runs a synthetic e2e output through all three clips. At each one it asserts the traceback and the summary line survive within the bound.

  • test_output_without_a_failure_report_keeps_its_tail and test_a_failure_report_already_in_the_tail_keeps_the_plain_tail cover the unchanged behaviour.

  • Full pytest passes, as do ruff check, ruff format --check and mypy src. mypy . reports 8 errors under sandboxes/; main reports the same 8.
  • Only pytest's report is recognised. Other runners keep the tail as before.

    ๐Ÿค– Generated with Claude Code

    https://claude.ai/code/session_01X5XatXv3dQLan6TyQoHFyF

    <!-- This is an auto-generated description by cubic. -->
    ---

    Summary by cubic


    Keeps a red gate's pytest failure report across every output clip, so a retry sees the tracebacks instead of just the failed test names.

    Bug Fixes

  • pytest prints the FAILURES report before the coverage table and summary, so tail-only clips dropped the tracebacks.

  • truncate gives the failure report the head's larger share โ€” including reports that open within the head โ€” and the tail keeps the summary.

  • The new clip helper keeps three quarters from the report and the last quarter, and is used by the recorded result and the retry's context; bounds too small for the elision keep a plain tail.

  • Output without a failure report keeps its tail as before.
  • <sup>Written for commit 6d9ac4308bdfcf99c7f2b5cbab76cf5fd7476609. Summary will update on new commits.</sup>

    <a href="https://cubic.dev/pr/morzecrew/torve/pull/177?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="View guided diff" src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a> <a href="https://www.cubic.dev/action/auto-fix/pr/morzecrew/torve/177?returnTo=https%3A%2F%2Fgithub.com%2Fmorzecrew%2Ftorve%2Fpull%2F177&source=description" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img alt="Turn on auto-fix" src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a>

    <!-- End of auto-generated description by cubic. -->

    ___

    CodeAnt-AI Description


    Keep pytest tracebacks in clipped failed-gate output

    What Changed


  • When failed pytest output is shortened, it now preserves the failure report and traceback alongside the final summary in gate output, recorded results, and retry context.

  • Output without a pytest failure report continues to keep its tail, and harness verdict lines remain intact.
  • Impact


    โœ… Tracebacks available to failed-test retries
    โœ… Pytest diagnostics retained in failed-gate records
    โœ… Existing tail behavior preserved for other output
    <details><summary><strong>๐Ÿ’ก Usage Guide</strong></summary>

    Checking Your Pull Request


    Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

    Talking to CodeAnt AI


    Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
    <pre>
    <code>@codeant-ai ask: Your question here</code>
    </pre>
    This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

    Example


    <pre>
    <code>@codeant-ai ask: Can you suggest a safer alternative to storing this secret?</code>
    </pre>

    Preserve Org Learnings with CodeAnt


    You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
    <pre>
    <code>@codeant-ai: Your feedback here</code>
    </pre>
    This helps CodeAnt AI learn and adapt to your team's coding style and standards.

    Example


    <pre>
    <code>@codeant-ai: Do not flag unused imports.</code>
    </pre>

    Retrigger review


    Ask CodeAnt AI to review the PR again, by typing:
    <pre>
    <code>@codeant-ai: review</code>
    </pre>

    Check Your Repository Health


    To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

    </details>

    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    <!-- coderabbit-ai-generated:v1 -->

    Summary by CodeRabbit

    Bug Fixes
    Long pytest output now retains the failure report and failed-test names when output is clipped, while still displaying the coverage table and final summary.
    Failure details are preserved in gate output, recorded results, and retry context without retaining tracebacks.
    Output without a failure report continues to keep its usual tail.

    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: Misery7100 Review duration: 15m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) ร— (1 โˆ’ Review Confidence (0.59)). Review depth and reviewer attention state are adequate.
    Model 1 ยท Change Risk (XGBoost)
    Score: 0.52 ยท 650 lines diff across 8 files
    0.52
    Model 2 ยท Review Depth (DistilBERT)
    Depth Score: 0.17 ยท 1 substantive comment(s)
    0.17
    Model 3 ยท Review Timing & Attention
    Session adequacy: 94% ยท Reviewer familiarity: 35%
    59%
    Bedrock Claude 3 ยท Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 ยท Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #177"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 59.1% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk ยท Model 1 (XGBoost)
    Predicted defect probability (0.00โ€“1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) ยท Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence ยท Models 2 & 3
    Scrutiny score (0.00โ€“1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 59.1% ยท Lower = rushed or shallow review
    59.1%
    Residual Risk
    Residual Risk ยท Core Equation
    Residual = Change ร— (1 โˆ’ Confidence)
    Unmitigated risk surviving review. โ‰ฅ 0.65 triggers an automated re-queue to protect production.
    Score: 21.3% ยท Safe to merge
    21.3%