Repository navigation
fix(ci): route dev-agent triage failures to needs-info when a PR was found - #239
Conversation
…found Force-classify risk and advance to QA checked steps.agent.outcome for two of three PR_NUMBER cases (revise mode with a known PR, and triage mode with no PR found) but not the third: triage mode where a PR was opened or located via find_linked_pr.sh before the agent step failed (crashed or exhausted its turn budget). That gap let an unconfirmed PR be silently risk-classified and advanced to status:needs-qa as if the run had completed cleanly. Live-reproduced on run 31998889829 (issue #233 -> PR #234): the dev agent exceeded its 40-turn budget, but had already opened the PR, so Force-classify proceeded straight to QA. PR #234 only ended up on status:needs-info because qa-agent's own run separately failed and hit its own backstop -- the dev-agent failure itself was never surfaced. Add the same failure check used in the other two cases: if the agent step failed, label the PR status:needs-info and stop instead of classifying and forwarding to QA.
📱 iOS Build Status: FAILED❌ iOS Simulator Build & Unit Tests - cancelled iOS UI tests run in a separate, informational job and are not reflected above — check "iOS UI Tests (informational)" for those. |
|
Re-opening to re-trigger PR Intake now that the body links #241. |
|
This PR was opened outside the automated pipeline (author isn't |
📱 iOS Build Status: FAILED❌ iOS Simulator Build & Unit Tests - cancelled iOS UI tests run in a separate, informational job and are not reflected above — check "iOS UI Tests (informational)" for those. |
QA verification — PR #239 vs issue #241Scope: Acceptance criteria (issue #241)
Tests run
AGENTS.md conventions
No gaps found against the issue's acceptance criteria or repo conventions. QA verdict: PASS |
📱 iOS Build Status: PASSED✅ iOS Simulator Build & Unit Tests - success iOS UI tests run in a separate, informational job and are not reflected above — check "iOS UI Tests (informational)" for those. |
Principal review — PR #239Verdict: risk:high (label correct, confirmed) → human-merge. No CONFIRMED findings against the diff itself. What I verified directly
Known, called-out limitation (not a blocking finding)The PR body explicitly flags that once a PR exists, this step only ever edits PR labels, never the originating issue's — so issue #233 (and future cases hitting this same path) will be left on stale Outcome
|
QA verdict: verified against issue #241Acceptance criteria (from #241):
What I ran:
No gaps found. This PR does exactly what #241 asks, doesn't touch the two existing failure-handling branches, and the new branch's control flow is sound. QA verdict: PASS |
Principal review — PR #239Verdict: risk:high (confirmed) → human-merge. No CONFIRMED findings against the diff. What I independently verified (not just re-reading the prior comments on this thread)
OutcomeSole changed file matches |
…r-found-failure-check
📱 iOS Build Status: PASSED✅ iOS Simulator Build & Unit Tests - success iOS UI tests run in a separate, informational job and are not reflected above — check "iOS UI Tests (informational)" for those. |
…r-found-failure-check
📱 iOS Build Status: PASSED✅ iOS Simulator Build & Unit Tests - success iOS UI tests run in a separate, informational job and are not reflected above — check "iOS UI Tests (informational)" for those. |
) * fix(ci): self-heal stale branch during principal-review auto-merge "Auto-merge if approved" treated any gh pr merge failure the same way -- conflict, branch protection, or a merely-stale branch all fell through to status:needs-human-merge with a generic error message. In a busy pipeline, dev routinely advances between approval and the actual merge call (other PRs from the same pipeline landing concurrently), which makes gh pr merge fail on "the head branch is not up to date with the base branch" -- a transient, self-resolvable race, not a real problem with the PR. Live-hit manually merging PR #239 (issue #246): the branch went BEHIND twice within ~15 minutes from ordinary pipeline throughput, each requiring a manual git-merge-and-push before gh pr merge would succeed. Before each merge attempt, check mergeStateStatus: - BEHIND -> request GitHub's server-side "Update branch" (PUT /pulls/{n}/update-branch) and retry, bounded. - DIRTY (real conflict) -> don't retry, route to status:needs-human-merge immediately, same as before. - UNKNOWN (mergeability still computing) -> brief bounded wait, then re-check. Bounded outer retry (5 attempts) so a burst of concurrent merges doesn't defeat auto-merge, while a genuinely stuck/failing merge still terminates and routes to a human instead of spinning indefinitely. * fix(ci): guard mergeStateStatus lookup against transient gh failures QA on PR #247 (issue #246) found a real gap: MERGE_STATE=$(gh pr view ... -q .mergeStateStatus) is an unguarded command substitution under set -euo pipefail. A transient gh API failure there (timeout, rate-limit) kills the whole step before it ever reaches the DIRTY/status:needs-human-merge fallback, leaving the PR silently stuck on status:approved-auto-merge with no comment -- ironic given this step exists specifically to add resilience against transient failures. Guard it the same way the CI-wait loop above already guards its own gh pr checks call (2>/dev/null || echo "pending"): a failed lookup now falls into the existing bounded UNKNOWN wait-and-recheck branch instead of crashing the step. The dev agent diagnosed and wrote this exact fix during PR #247's automated revise round but couldn't push it -- GitHub blocks App tokens from pushing to .github/workflows/** without an explicit `workflows` permission grant this pipeline's installation doesn't have (same standing gap noted in issue #246's history). Applying it manually as the human it routed to.
What
Force-classify risk and advance to QAin dev-agent.yml checkssteps.agent.outcome == 'failure'in two of the threePR_NUMBERcases:but not the third: triage mode where a PR was found (either written by the agent to
dev-agent-pr-number.txt, or recovered viafind_linked_pr.sh's fallback) before the "Run dev agent" step itself failed. In that case the workflow fell straight through to risk-classification andstatus:needs-qa, treating an unconfirmed PR as if the run had completed cleanly.Live repro
Run 31998889829: the dev agent was triaging issue #233, reported a successful result, but took 43 turns against the configured 40-turn cap, so the "Run dev agent" step failed. It had already opened PR #234. Force-classify found PR #234 via the fallback lookup and advanced it straight to
status:needs-qa— the dev-agent failure was silently dropped. PR #234 only ended up onstatus:needs-infobecause qa-agent's own run separately failed (no verdict produced) and hit its own backstop. If QA had happened to pass an unconfirmed diff, nothing would have caught it.Fix
Add the same
steps.agent.outcome == 'failure'check used in the other two cases, right before risk-classification: if the agent step failed, label the PRstatus:needs-info(with an explanatory comment) and stop, instead of classifying and forwarding to QA.Not addressed here (separate, lower-priority): once a PR exists, Force-classify only ever edits labels on the PR, never on the originating issue — so issue #233 is still sitting on stale
status:ready-for-dev+status:in-progresslabels. Filing as a follow-up if wanted, out of scope for this fix.Testing
This logic lives inline in the workflow's bash step (no standalone script to unit-test, unlike
find_linked_pr.sh/resolve_linked_issue.sh). Validated:python3 -c "import yaml; yaml.safe_load(...)"— YAML parses cleanly.PR_NUMBER/steps.agent.outcomecombinations against the new control flow.No live workflow run to verify against without triggering a real dev-agent invocation.
Closes #241