← Back to Pull requests

[Fix] Reject invalid fit-probe answer keys before inference #50

Closed
unknown closed this pull request without merging on Oct 07, 2026 13:19 UTC
View on GitHub
unknown unknown commented on Oct 07, 2026 09:13 UTC
Author

Why

s1a probe accepted a JSONL case whose accept key was absent from options. A typo in the expected key made a valid model choice score as wrong, potentially changing the fit verdict after a paid inference call. Empty options and empty accept also passed file validation.

How

Validate offered options and accepted keys in s1a/probe.py:read_cases while reading the file, before building a model. Errors identify the file, line, and invalid key. Add regression cases for all three invalid inputs.

What

  • Reject probe cases with no offered options, no accepted answer, or an accept key outside options.

  • Document the input rule in the builder walkthrough and changelog.

  • Existing valid case format and model calls are unchanged.
  • Authored code diff: 22 added lines in source and tests; total diff: 27 changed lines. No generated artifacts are committed.

    Verification

  • uv run --no-sync ruff format --check . && uv run --no-sync ruff check . && uv run --no-sync ty check — passed.

  • PATH=/Users/danyangchen/.cache/codex-runtimes/codex-primary-runtime/dependencies/node/bin:$PATH uv run --no-sync pytest -q — 624 passed, 43 skipped, 89 subtests passed.

  • scripts/smoke.sh — passed.

  • CHANGELOG.md and docs/skills.md updated.
  • The first full test run had one unrelated Node subprocess abort because the machine's Homebrew Node is missing libsimdjson.29.dylib; rerunning with the bundled Node v24.19.0 passed. No model key or inference service was used.

    Demo / evidence

    A one-line JSONL file with options: {"a": "only choice"} and accept: ["typo"] was accepted on base e7b7d2b; on head 2578141, probe.read_cases reports cases.jsonl:1: accept names keys not in options: typo. The new regression test reproduces this with a temporary file. A video is N/A because this change only validates local input before inference.

    Diff: 236 lines (+177 / -59) across 2 files Reviewer: hsliuustc0106 Review duration: 246m
    All Vouch review confidence checks passed
    Residual risk 0.15 = Change Risk (0.37) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.37 · 236 lines diff across 2 files
    0.37
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    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.327
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #50"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% 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: 37.2% (MEDIUM) · Higher = larger blast radius
    37.2%
    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: 60.5% · Lower = rushed or shallow review
    60.5%
    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: 14.7% · Safe to merge
    14.7%