Skip to content

fix(ci): raise principal-review.yml's turn cap and stop discarding a valid verdict on crash - #298

Merged
libravault-xyz merged 1 commit into
devfrom
fix/principal-review-turn-cap-crash-verdict
Aug 19, 2026
Merged

libravault-xyz merged 1 commit into
devfrom
fix/principal-review-turn-cap-crash-verdict

Conversation

@libravault-xyz

Copy link
Copy Markdown
Collaborator

Closes #297.

--max-turns 40 was too tight for principal-review.yml's "Run principal review agent" step — the agent's last action before ending is writing principal-verdict.txt, so hitting the cap one turn later than a clean finish is common, not rare. At least 4 same-day crashes (PRs #257, #264, #281, plus one flagged earlier on #279 without the cap being raised) discarded a verdict the agent had already written, routing good review work to status:needs-info instead of using it (PR #281's job log: "num_turns": 41 vs the 40 cap).

  • Raised --max-turns to 65.
  • Changed the crash branch in "Advance PR based on review verdict" to check principal-verdict.txt even when steps.agent.outcome == 'failure'. A crash with a valid verdict already on disk now proceeds on that verdict (with a PR comment flagging the crash for visibility) instead of being discarded to status:needs-info. A crash with no usable verdict file still routes to status:needs-info, unchanged.

Scoped to principal-review.yml only — qa-agent.yml has the same --max-turns 40 / discard-on-crash shape but hasn't shown this exact failure mode yet, noted in the issue as a possible follow-up.

Sensitive path (.github/workflows/**) — opening as a direct human-authored PR for that reason.

…valid verdict on crash

Closes #297. --max-turns 40 was too tight — the agent's last action is
writing principal-verdict.txt, so hitting the cap one turn later is
common (PR #281's job log: num_turns 41 vs cap 40). At least 4 same-day
crashes (PRs #257/#264/#281, plus one flagged earlier on #279) threw
away a verdict the agent had already written, routing good work to
status:needs-info instead of using it.

Raised the cap to 65, and changed the crash-handling branch in
'Advance PR based on review verdict' to check principal-verdict.txt
even when the agent step reports failure — only routes to
status:needs-info when there's truly no usable verdict on disk.

Sensitive path (.github/workflows/**) — opening as a direct
human-authored PR for that reason.
@github-actions github-actions Bot added the risk:high Touches a sensitive path or exceeds diff-size threshold — always human merge label Aug 19, 2026
@libravault-pipeline-bot libravault-pipeline-bot Bot added the status:needs-qa PR open, awaiting qa-agent verification label Aug 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR was opened outside the automated pipeline (author isn't libravault-pipeline-bot[bot]), so dev-agent.yml's own end-of-run classification step never ran for it — it would otherwise have sat with no risk/status label and nothing downstream would pick it up (see issue #223's actual history). This deterministic backstop (pr-intake.yml) classified its risk and applied status:needs-qa to route it into the normal pipeline from here.

@claude

claude Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

QA verdict: PR #298 vs issue #297

Scope: .github/workflows/principal-review.yml only (CI orchestration, no app code) — matches the PR's stated scoping.

Acceptance criteria (issue #297)

  • ✅ Raise --max-turns — 40 → 65 (line 249), comfortably above the observed 41-turn near-miss (PR fix(reader): clear stale readAloudNextChapterProvider on external TTS stop #281).
  • ✅ Crash branch checks principal-verdict.txt before discarding — the "Advance PR based on review verdict" step now only routes to status:needs-info when principal-verdict.txt is missing or contains something other than auto-merge/human-merge. A crash with a valid verdict on disk now proceeds on that verdict and posts an extra PR comment flagging the crash for visibility (lines 308–335, 377–379). Traced the fall-through path by hand: on a salvaged crash-verdict it re-enters the same normal-path parsing/label logic below rather than duplicating it, so both code paths stay in sync.
  • ✅ Scoped to principal-review.yml only — confirmed via grep that qa-agent.yml/dev-agent.yml are untouched by this diff.

What I ran

One thing I chased down and ruled out

The new claude_args block (lines 241–249) puts a 7-line #-comment block before --max-turns 65. claude-code-action's claude_args parser has a known history of a real bug here (shell-quote treats # as "rest of input is a comment," silently swallowing every flag after it — anthropics/claude-code-action#802) that would have completely defeated this PR's own fix by dropping --max-turns 65 entirely. I verified this isn't live here: the fix (stripShellComments(), filtering out any line starting with # before handing the string to shell-quote) merged in anthropics/claude-code-action#1055 back in April 2026, and the repo pins the moving @v1 tag (currently v1.0.195, well after that fix). Confirmed stripShellComments is present in the v1-tag copy of base-action/src/parse-sdk-options.ts. So this is safe as written, but it's a pattern the other two pipeline workflows (dev-agent.yml, qa-agent.yml) don't use — worth keeping in mind if either of those ever pins an older/pre-April-2026 action ref.

Heads up, not a QA blocker on this PR itself

PR #299 (fix/principal-review-max-turns-and-crash-verdict, dev-agent-authored) is open concurrently and also closes #297, with materially the same fix (--max-turns raised to 70 instead of 65, same crash-salvage logic). Both can't merge cleanly — a human should pick one and close/superseded the other before this goes further in the pipeline.

QA verdict: PASS

@github-actions github-actions Bot removed the status:needs-qa PR open, awaiting qa-agent verification label Aug 19, 2026
@libravault-pipeline-bot libravault-pipeline-bot Bot added the status:needs-review QA passed, awaiting principal-review-agent label Aug 19, 2026
@github-actions github-actions Bot added status:needs-info Dev/QA agent needs more detail before proceeding and removed status:needs-review QA passed, awaiting principal-review-agent labels Aug 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR's branch is stale relative to dev — specifically, .github/workflows/principal-review.yml differs between this branch and dev. GitHub Actions refuses to mint the OIDC token claude-code-action needs when a pull_request-triggered, id-token: write workflow's own file doesn't byte-match the base branch (its own anti-tampering check), so the principal review agent step was skipped rather than silently no-opping (see issue #254 for the full diagnosis). Rebase/merge dev into this branch and re-add status:needs-review to retry.

@github-actions

Copy link
Copy Markdown
Contributor

📱 iOS Build Status: PASSED

✅ iOS Simulator Build & Unit Tests - success
✅ Android Core Modules - success

iOS UI tests run in a separate, informational job and are not reflected above — check "iOS UI Tests (informational)" for those.

View run details

@libravault-xyz
libravault-xyz merged commit ed0e6ba into dev Aug 19, 2026
16 checks passed
@libravault-xyz
libravault-xyz deleted the fix/principal-review-turn-cap-crash-verdict branch August 19, 2026 05:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:high Touches a sensitive path or exceeds diff-size threshold — always human merge status:needs-info Dev/QA agent needs more detail before proceeding

Projects

None yet

Development

Successfully merging this pull request may close these issues.

principal-review.yml: --max-turns 40 is too tight and a crash discards a valid verdict

1 participant