Skip to content

A failed second-model review names the cause that stopped it, and never deletes its own prompt (GST-3188) - #4519

Merged
capy-ai[bot] merged 2 commits into
mainfrom
second-model-review-final-failure-decides
Nov 19, 2026
Merged

capy-ai[bot] merged 2 commits into
mainfrom
second-model-review-final-failure-decides

Conversation

@garrytan

@garrytan garrytan commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

When a second-model review fails, gstack now reports the failure that actually ended it: Codex's final error decides, a stray "402" in a request id no longer reads as a used-up budget, and a Claude Code 402 or usage limit reads as a budget stop with no Codex advice.
Why: these were the four follow-ups ruled below the blocking bar on #4515; each one could send someone to fix the wrong thing.
Nothing to do. The prose rule that reads "auth", "login" or "API key" in stderr as a login failure is not changed here (see below).

What changed
  • The final failure decides. When Codex's --json events hold failures, only the last one (turn.failed) is classified, so an early 402 retry followed by a final 401 stays an execution failure with the 401 in its detail (lib/outside-review-result.ts).
  • A 402 counts only as a status. HTTP 402, status 402, "status":402, "status_code": 402, statusCode: 402, Error: 402, 402 Payment Required or "payment required"; a request id like req_9c3f402ab or req-402-payment-abc, or "after 402 ms", no longer does.
  • Claude Code budget stops. Claude Code exiting 0 with subtype: error_during_execution and a 402 in result is now a budget failure, not a generic provider error. A Claude Code usage limit is read as budget_exhausted instead of Codex's quota_exhausted, whose advice names Codex and a Codex-only setting. The budget_exhausted summary and its troubleshooting entry now name the Claude Code usage limit.
  • The prompt file is protected. gstack-outside-voice run refuses (exit 2) a --prompt that is --out or one of the files the run writes beside it (.events.jsonl, .stderr, .last-message, .meta.json), symlinks resolved; the codex-cli runner refuses the same pair itself (prompt_is_output) before deleting anything.
  • Which result file wins. Codex's complete closing message replaces a reviewer file that has no final verdict, unless that file holds a Critical or High finding the closing message doesn't. A reviewer file that lacks the result markers, or (for plan reviews) whose first line (INPUT: <phase> <sha>) names another snapshot, gives way to a marked closing message, as on main. A reviewer file that says it is not ready is kept, and a file written for another snapshot is never reported clean. The snapshot is read from the last result-format block in the prompt.
Not changed

Retries, budgets and when the review runs. The shared prose rule ("auth", "login" or "API key" in stderr means a login failure) is rendered into review/sections/adversarial.md, a pinned reviewer file, so changing it needs its own no-loss replay; it stays open for a separate PR. Reviewer prompts are byte-identical.

Open notes (not fixed in this PR)
  • The prose rule the skills share still reads stderr containing "auth", "login" or "API key" as a login failure. It is rendered into a pinned reviewer file, so it needs its own no-loss replay and a separate PR.
  • A .meta.json that is a hard link to the prompt file still passes the prompt check, which compares paths, not inodes (also true on main).
  • Claude Code's "You've hit your session limit" banner (an HTTP 429) still reads as a generic failure, not a usage stop (also true on main).
  • The host-subagent runner is refused for --prompt X.last-message --out X even though it never writes .last-message; it refuses safely.
  • Once Codex's --json events hold a failure, a cyber-policy or quota line that appears only on stderr is not read.
  • "Error: 402 ms elapsed" still reads as a budget stop, and "status code (402)", "API Error (402)" or "got 402 from proxy" read as a general failure rather than a budget stop.
  • A reviewer file with only Medium or Low findings and no final verdict is replaced by a complete closing message that says VERDICT: CLEAN, so the run reads clean and those advisory findings are lost; on main it read unverified.
  • A reviewer file with a Critical or High finding but no result markers is still replaced by a marked clean closing message, as on main.
  • A plan-review closing message written for another snapshot can still read clean in the runner; plan review rejects it when the result is submitted, as on main.
Tests

Seven new tests, each failing on main at 957fab7, and three more from review that fail at b58f1f4, all passing here: final-failure order, 402 in a request id or duration, Claude error_during_execution 402, Claude usage limit wording, unverified reviewer file, result for another snapshot, prompt-is-output refusal (runner and CLI). Focused suites (outside-review-result, claude-code-runner, outside-runner-contract, troubleshooting-anchors, model-catalog-isolation, outside-voice-failure-policy, outside-voice-invocation, outside-review-cyber-policy): 630 pass, 0 fail. Typecheck clean.

Agent notes

Lane GSTA-646 for GStack Minder, issue GST-3188, follow-up to #4515 (957fab7). Item 5 of the brief (prose auth rule) left out under CREW rule 15. Decision trail: captain drive reports/GSTA-646-decisions.tsv.

Ruled note: red-team#1 at 76795c1 ruled by Captain GStack Minder (GSTA-36) at 2026-11-19T11:41:56.400Z: parser artifact: the red-team reader listed it among checks that passed and declared blocking=0 (approval a-24d1ee802f06)

Approvals

Approved: yes (record r-d810a4c711ed). The full approval record stays private.
Plan: exempt: bug fix with failing-first tests
Plan check: PLAN_EXEMPT_UNKNOWN (gstack-approvals plan-check says why)

{
  "schema_version": 1,
  "pr": 4519,
  "head": "76795c11bb865d3ed4bb3d6b1210642aecfe8b8d",
  "version": "1.101.0.0",
  "base": "main",
  "ci_carried": [
    {
      "lane": "test",
      "run": 44515163013,
      "attempt": 1,
      "tree": "42315eacf53a28493d84f02f9c3701e295a04733"
    }
  ],
  "calls": 23,
  "session_kind": "unattended",
  "head_tree": "42315eacf53a28493d84f02f9c3701e295a04733",
  "product_patch_id": "7f587a3b41413cc145b7f753bc6c81ac0c410eb5",
  "gstack_version": "1.101.0.0",
  "review_depth": {
    "depth": "full",
    "class": "gate",
    "runtime_lines": 63,
    "rules": "1afa38a4be3b5eef",
    "base": "55aaa6c4a5dff86e02d9bf9bfc7557c491f98a37",
    "registry": "55aaa6c4a5dff86e02d9bf9bfc7557c491f98a37",
    "gate_scan": {
      "tagged": 0,
      "head": "76795c11bb865d3ed4bb3d6b1210642aecfe8b8d"
    },
    "reasons": [
      "gate-class",
      "risk:money",
      "risk:security",
      "runtime=63"
    ],
    "risk": [
      "money",
      "security"
    ],
    "mode": "panel"
  },
  "pregate": "requires-remote cleared @42315eacf53a (8 checks, current for 76795c11bb86)",
  "requires_remote": [
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/44509975031/attempts/1",
    "pregate.json/remote_gate: remote-gate tree=42315eacf53a tests=37945 skipped=68 runs=44515163013/1 profiles=ci-reuse/free-tests heads=76795c11bb86 verified=2026-11-19T11:39:40.457Z"
  ],
  "docs": {
    "status": "current",
    "scope": "docs/ and README.md (read-only audit docs-4519-76795c1-a1, base 957fab79 to 76795c11)"
  },
  "review_loop": {
    "passes": 1,
    "blocking_found": 0,
    "deferred": 0,
    "noted": 0,
    "fixed": 0,
    "scope": "frozen",
    "rounds": 1,
    "dispatches": {
      "specialist": 3,
      "red-team": 1
    }
  },
  "ruled_notes": [
    {
      "finding": "red-team#1",
      "head": "76795c11bb865d3ed4bb3d6b1210642aecfe8b8d",
      "by": "Captain GStack Minder (GSTA-36)",
      "reason": "parser artifact: the red-team reader listed it among checks that passed and declared blocking=0",
      "at": "2026-11-19T11:41:56.400Z",
      "approval": "a-24d1ee802f06"
    }
  ],
  "gate_dispositions": [],
  "review_targeted": {
    "classes": [
      "money"
    ],
    "rules": "23eb808423669ba0",
    "brief_sha": "7f92a0d0a8319c3c0e076fb3b1a4689c45120b2be2c14dfc7d4cb03aafa9d6a5",
    "product_patch_id": "7f587a3b41413cc145b7f753bc6c81ac0c410eb5",
    "status": "done",
    "findings": 0,
    "raised_by": "targeted"
  }
}
{"head":"76795c11bb865d3ed4bb3d6b1210642aecfe8b8d","run":"ship-4519-76795c1","status":"started","review_loop":{"passes":1,"blocking_found":0,"deferred":0,"noted":0,"fixed":0,"scope":"frozen","rounds":1,"dispatches":{"specialist":3,"red-team":1}}}
{
  "schema_version": 1,
  "pr": 4519,
  "head": "76795c11bb865d3ed4bb3d6b1210642aecfe8b8d",
  "version": "1.101.0.0",
  "base": "main",
  "ci_carried": [
    {
      "lane": "test",
      "run": 44515163013,
      "attempt": 1,
      "tree": "42315eacf53a28493d84f02f9c3701e295a04733"
    }
  ],
  "calls": 23,
  "session_kind": "unattended",
  "head_tree": "42315eacf53a28493d84f02f9c3701e295a04733",
  "product_patch_id": "7f587a3b41413cc145b7f753bc6c81ac0c410eb5",
  "gstack_version": "1.101.0.0",
  "review_depth": {
    "depth": "full",
    "class": "gate",
    "runtime_lines": 63,
    "rules": "1afa38a4be3b5eef",
    "base": "55aaa6c4a5dff86e02d9bf9bfc7557c491f98a37",
    "registry": "55aaa6c4a5dff86e02d9bf9bfc7557c491f98a37",
    "gate_scan": {
      "tagged": 0,
      "head": "76795c11bb865d3ed4bb3d6b1210642aecfe8b8d"
    },
    "reasons": [
      "gate-class",
      "risk:money",
      "risk:security",
      "runtime=63"
    ],
    "risk": [
      "money",
      "security"
    ],
    "mode": "panel"
  },
  "pregate": "requires-remote cleared @42315eacf53a (8 checks, current for 76795c11bb86)",
  "requires_remote": [
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/44509975031/attempts/1",
    "pregate.json/remote_gate: remote-gate tree=42315eacf53a tests=37945 skipped=68 runs=44515163013/1 profiles=ci-reuse/free-tests heads=76795c11bb86 verified=2026-11-19T11:39:40.457Z"
  ],
  "docs": {
    "status": "current",
    "scope": "docs/ and README.md (read-only audit docs-4519-76795c1-a1, base 957fab79 to 76795c11)"
  },
  "review_loop": {
    "passes": 1,
    "blocking_found": 0,
    "deferred": 0,
    "noted": 0,
    "fixed": 0,
    "scope": "frozen",
    "rounds": 1,
    "dispatches": {
      "specialist": 3,
      "red-team": 1
    }
  },
  "ruled_notes": [
    {
      "finding": "red-team#1",
      "head": "76795c11bb865d3ed4bb3d6b1210642aecfe8b8d",
      "by": "Captain GStack Minder (GSTA-36)",
      "reason": "parser artifact: the red-team reader listed it among checks that passed and declared blocking=0",
      "at": "2026-11-19T11:41:56.400Z",
      "approval": "a-24d1ee802f06"
    }
  ],
  "gate_dispositions": [],
  "review_targeted": {
    "classes": [
      "money"
    ],
    "rules": "23eb808423669ba0",
    "brief_sha": "7f92a0d0a8319c3c0e076fb3b1a4689c45120b2be2c14dfc7d4cb03aafa9d6a5",
    "product_patch_id": "7f587a3b41413cc145b7f753bc6c81ac0c410eb5",
    "status": "done",
    "findings": 0,
    "raised_by": "targeted"
  }
}

Open in Capy

…er deletes its own prompt (GST-3188)

Codex's final failure decides the cause, a 402 counts only as an HTTP
status, a Claude Code 402 or usage limit reads as a budget stop, the
runner refuses a prompt file it would overwrite, and a reviewer file
with no final verdict or another snapshot's first line loses to Codex's
complete closing message.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@trunk-io

trunk-io Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

… that would hide it (GST-3188)

The closing message replaces the reviewer's file only when that file has
no verdict, no markers, or another snapshot's INPUT line, and only when
the closing message is complete and would not hide a P0 or P1 finding.
A 402 in a status_code, statusCode or http_status field counts again; a
402 inside a request id does not.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@capy-ai
capy-ai Bot merged commit f82b6f7 into main Nov 19, 2026
83 of 84 checks passed
capy-ai Bot added a commit that referenced this pull request Nov 19, 2026
… reading reviewers' scope lists as findings (GST-3201) (#4527)

Pre-commit /verify now fails a check that times out and runs its checks
on one time budget; a reviewer's scope-list bullets no longer need an
owner ruling to clear; stack tests fail when git can't list a PR's
tests.

Why: each let a result read clean with nothing proving it, or block on
nothing (#4518, #4519). Goal: gates never pass on missing evidence.

Nothing to do; `gstack-checks quick --timeout` is now one budget the
checks share (540 s default).

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Review-Finding: p1/outside-voice#1 reader=outside-voice
Review-Finding: p1/outside-voice#2 reader=outside-voice
@garrytan garrytan mentioned this pull request Nov 19, 2026
capy-ai Bot added a commit that referenced this pull request Nov 19, 2026
- `gstack-artifact validate` no longer passes a run.json that gstack-autoplan never wrote. (#4494)
- /ship's changed-number check no longer stops on tests that only share a word with the change (#4478). (#4496)
- On Capy, /ship no longer edits or comments on pull requests as you. (#4518)
- The destructive-command check stops asking about scratch deletes and catches the real damage it used to miss. (#4513)
- The destructive-command check reads commands more carefully, closing gaps found after the last release. (#4525)
- The Codex readiness check and the second-model review now pick the same model for a custom Codex provider (GST-3089). (#4491)
- gstack's Codex hooks work when your Codex folder's path has a `(`, `&` or other shell character in it. (#4528)
- Uninstalling gstack keeps your own Codex hooks trusted. (#4528)
- Codex hook setup matches Codex more closely. (#4528)
- On Windows, setup copies the Claude Code hook code that gstack's Codex hooks import (#4528)
- /review's checklist on Codex reads shell commands more carefully. (#4528)
- On Codex, gstack now suggests the right skill for a prompt and stops destructive commands before they run. (#4512)
- On Codex, /review is now held once when it tries to finish without its adversarial pass or its report, as it already is on Claude Code. (#4522)
- On Codex, gstack's skill suggestion now names the skill the way Codex lists it. (#4523)
- On Codex, gstack's suggested prompts and docs now name skills the way Codex lists them. (#4524)
- /review on Codex with gpt-6.1-sol is no longer held back for a second-model pass it already ran. (#4526)
- On Codex, office-hours, plan-design-review and gstack-upgrade work again when you name them. (#4510)
- gstack knows when Codex is running unattended. (#4510)
- Codex reviewers start with a clean context. (#4510)
- Docs no longer say Codex has no hook support. (#4510)
- A command whose output was cut off no longer counts as a finished read. (#4492)
- A folder marked as published data can no longer hide source code or agent files from /ship's review. (#4516)
- Correction to the on-by-default helper hooks entry: the hook still routes only to /review, /qa and /verify, so skills you've installed yourself aren't suggested yet. With gstack's skills it routes 14 of 60 real bug reports (was 17), and long prompts are no longer skipped. (#4505)
- /sync-gbrain's read check now works when the first page in your code source is over 64 KB. (#4497)
- Free-suite CI no longer fails before any test runs when Ubuntu's package mirror is slow. (#4530)
- Syncing a second repo no longer makes the first one ask for /sync-gbrain again. (#4532)
- gstack's helper hooks are now on by default in Claude Code, OpenClaw and Hermes, and the prompt-routing hook fires on real bug reports. (#4503)
- `gstack-pregate clear --receipt` accepts a remote gate run from before a merged release when the release only regenerated a declared release output. (#4483)
- The second-model review now keeps the reviewer's own result, and reports a used-up budget as a budget stop. (#4515)
- When the reviewer wrote its review to the result file it was asked for, Codex then replaced that file with its short closing message ("Done, I wrote the review"), so the review was thrown away and reported as missing its markers. (#4515)
- When the provider refuses the call with HTTP 402 Payment Required (usually a metering proxy that hit its allowance, or an account out of credits or quota), gstack used to record only "exit 1". (#4515)
- The pre-commit /verify check now fails a check that times out, and its checks share one time budget (GST-3201). (#4527)
- /ship's review collector no longer reads a reviewer's own scope list or list of passed checks as findings (GST-3201). (#4527)
- Merge-queue stack tests fail when git cannot list a PR's added test files (GST-3201). (#4527)
- /ship can now review results PRs that publish raw session data. (#4511)
- /ship's review pass works when the checkout you ship isn't the project's default checkout. (#4507)
- A second review round no longer reports done when nothing was reviewed. (#4520)
- The prompt-routing hook now suggests skills you install yourself, and no longer sends ordinary bug reports to /qa (GST-3123). (#4506)
- gstack's script runner and merge-queue checks now also refuse cut-off output. (#4502)
- A failed second-model review reports the cause that actually stopped it, and the runner never deletes its own prompt. (#4519)
- `gstack-ship-queue ready` now fills in the trial merges and the second-model trail read instead of printing lines to fill. (#4529)
- Five small ship-tool fixes. (#4529)
- A ruling the owner gives while a `/ship` run is open can be relayed. (#4529)
- /ship no longer kills a working test run as stalled when the test command starts its workers in their own session. (#4533)
- /ship no longer stops a review because the state-machine reader started its reply the way its instructions say. (#4504)
- When Claude Code runs /verify right before a commit, it now gets a quick check instead of the full fix loop (GST-3150). (#4508)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
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.

1 participant