Skip to content

fix(ci): give pr-intake.yml a fallback for PRs with no linked issue - #344

Merged
libravault-xyz merged 1 commit into
devfrom
fix/pr-intake-unlinked-issue-fallback
Aug 20, 2026
Merged

libravault-xyz merged 1 commit into
devfrom
fix/pr-intake-unlinked-issue-fallback

Conversation

@libravault-pipeline-bot

Copy link
Copy Markdown
Contributor

What

pr-intake.yml is the deterministic backstop that risk-classifies and labels PRs opened outside the dev-agent pipeline (a human, or a session pushing directly with a personal PAT). Its guard step required a resolvable linked issue (resolve_linked_issue.sh) before doing anything — a PR with no Closes #N-style line exited early with "not a pipeline PR, nothing to do," leaving it with no risk:*/status:* label at all. principal-review.yml never fires (it triggers on status:needs-review, which nothing applied), and a human has to notice and hand-label it manually — confirmed live this session for PRs #326, #335, #342 (the latter two self-authored automation work with no filed issue to link to).

Fix

The guard step no longer exits early when no issue is linked. It still runs classify_pr_risk.py and applies the resulting risk:* label either way. For the status label, it branches:

  • Issue linked (existing behaviour, unchanged): applies status:needs-qa, same as before.
  • No issue linked (new): applies status:needs-review instead, not status:needs-qa.

Why status:needs-review and not status:needs-qa for the no-issue case

I checked both downstream workflows' own guard steps before picking a label:

  • qa-agent.yml's guard step (.github/workflows/qa-agent.yml:74-81) hard-stops when it can't resolve a linked issue — it posts "add a Closes #N line" and sets skip=true. For a genuinely issue-less PR (no filed issue exists to link to), that instruction can never be satisfied, so routing these to status:needs-qa would just dead-end there silently — the exact same "stuck with no visible progress" failure mode this issue is about, just one hop further downstream.
  • principal-review.yml's guard step (.github/workflows/principal-review.yml:100-113) already tolerates a missing linked issue gracefully by design (its own comment: "Deliberately non-fatal here, unlike dev-agent.yml/qa-agent.yml... proceeding without the issue-level status:blocked check").

So an issue-less PR skips QA (there's no acceptance criteria to verify against anyway) and lands directly on status:needs-review for principal review, which is built to handle exactly this case.

Risk

.github/workflows/pr-intake.yml is a sensitive_paths match (.github/workflows/**) in agent-policy.yml, so classify_pr_risk.py will force risk:high on this PR regardless of diff size — flagging explicitly per the dev-agent persona rather than leaving the principal reviewer to rediscover why. The status-label branch (status:needs-qa vs status:needs-review) is a new decision point I made confidently based on reading both downstream guard steps directly (cited above), not a guess — but it's still worth a human's own look given the sensitive path.

No JVM/Kotlin code is touched (workflow YAML + inline bash only), so no unit tests apply here — verified the YAML parses (python3 -c "import yaml; yaml.safe_load(...)") and both inline bash blocks pass bash -n.

Closes #343

Previously a manually-opened PR with no resolvable "Closes #N" line
exited pr-intake.yml's guard early with no risk:*/status:* label
applied at all, requiring a human to notice and hand-label it (as
happened for PRs #326, #335, #342). Now it still runs
classify_pr_risk.py and routes into the pipeline — status:needs-qa
when an issue is linked (unchanged), status:needs-review when it
isn't, since qa-agent.yml hard-stops on a missing linked issue (no
acceptance criteria to check) while principal-review.yml already
tolerates one gracefully.

Closes #343
@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

@github-actions github-actions Bot added the risk:high Touches a sensitive path or exceeds diff-size threshold — always human merge label Aug 20, 2026
@libravault-pipeline-bot libravault-pipeline-bot Bot added the status:needs-qa PR open, awaiting qa-agent verification label Aug 20, 2026
@claude

claude Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

QA verification — PR #344 vs issue #343

Scope: .github/workflows/pr-intake.yml only (workflow YAML + inline bash). No Kotlin/JVM code touched.

Acceptance criteria (issue #343's "Ask")

  • Still risk-classify issue-less PRs. Guard step no longer exits early when resolve_linked_issue.sh returns empty (.github/workflows/pr-intake.yml guard step); classify_pr_risk.py --apply-label now always runs regardless of whether ISSUE_NUMBER is set.
  • Route into the pipeline instead of dead-ending. New branch applies status:needs-review (via the App token) when no issue is linked, status:needs-qa (unchanged) when one is.
  • Don't skip labeling entirely. Confirmed no path left where an issue-less PR gets neither a risk:* nor a status:* label.

The PR body's justification for status:needs-review over status:needs-qa in the no-issue case checks out against the actual downstream code, not just its own claim:

  • qa-agent.yml's guard (lines ~74–81) hard-stops and posts a "add Closes #N" comment when resolve_linked_issue.sh returns empty — confirmed by reading the step directly. Routing issue-less PRs there would dead-end exactly as described.
  • principal-review.yml's guard already treats a missing linked issue as non-fatal (own comment: "Deliberately non-fatal here, unlike dev-agent.yml/qa-agent.yml... proceeding without the issue-level status:blocked check") — confirmed by reading the step directly.
  • Label→trigger wiring double-checked: qa-agent.yml fires on label.name == 'status:needs-qa', principal-review.yml fires on label.name == 'status:needs-review' — the new branch's label choices actually trigger the intended next workflow.

What I ran

  • ./gradlew testDebugUnitTest --continue — BUILD SUCCESSFUL in 9m 2s, 438 actionable tasks, no test failures in any module's XML results (checked failures=" counts directly, not just gradle's summary line). Expected to be a no-op regression check since no Kotlin/JVM source changed, and it was — no diffs in behavior anywhere outside pr-intake.yml.
  • python3 -c "import yaml; yaml.safe_load(...)" on pr-intake.yml — parses cleanly.
  • Extracted both run: blocks from the workflow YAML and ran bash -n on each — both syntactically valid.
  • Manually traced the idempotency guard (existing pipeline status label ⇒ skip) and the status:blocked check — both correctly scoped to only run their issue-dependent branch when ISSUE_NUMBER is non-empty, no crash/regression for the issue-less path.

Gap found (not blocking)

docs/agent-team-pipeline.md's "PR intake backstop" section (~line 246–253) still describes pr-intake.yml as running "the exact same deterministic classify-and-label step dev-agent.yml's tail runs for its own PRs" and only mentions status:needs-qa — it doesn't mention the new issue-less → status:needs-review branch this PR adds. Doc is stale, not wrong about anything this PR changed functionally. Worth a follow-up doc touch-up but not a functional or test gap, so not failing QA over it.

AGENTS.md conventions

Verdict

All three acceptance-criteria items from issue #343 are met and independently verified against the actual downstream workflow code (not just the PR's own description of it). Real test suite is green with no regressions. Only issue found is non-blocking doc staleness.

QA verdict: PASS

@github-actions github-actions Bot removed the status:needs-qa PR open, awaiting qa-agent verification label Aug 20, 2026
@libravault-pipeline-bot libravault-pipeline-bot Bot added the status:needs-review QA passed, awaiting principal-review-agent label Aug 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Principal review — PR #344

Outcome: human-merge (routing purely on risk:high, not on any finding — the change itself looks correct).

Risk label sanity check

risk:high is correctly and freshly set: only one commit exists on this branch, and re-running classify_pr_risk.py origin/dev origin/HEAD locally reproduces it — .github/workflows/pr-intake.yml matches the sensitive_paths glob .github/workflows/**. No re-classification needed.

Verification performed (ground truth, not the PR's/QA's word for it)

  • Read the full diff directly (not a summary) — .github/workflows/pr-intake.yml only, +55/-24, inline bash + comments.
  • Confirmed both downstream-guard claims the PR body makes by reading the actual code, not trusting the description:
    • qa-agent.yml's guard (lines ~74–81) does hard-stop with a "add Closes #N" comment when resolve_linked_issue.sh returns empty.
    • principal-review.yml's guard does already tolerate a missing linked issue non-fatally (own comment confirms this verbatim).
  • Re-parsed the YAML (yaml.safe_load) and extracted both run: blocks to run bash -n on each independently — both syntactically valid, matching the PR's own claim rather than just accepting it.
  • Traced the guard step's control flow by hand: issue_number is written to $GITHUB_OUTPUT unconditionally before any of the step's exit paths, so it's available to the later classify step regardless of which guard branch fires. The idempotency check and the status:blocked check are correctly scoped (the latter now guarded behind if [ -n "$ISSUE_NUMBER" ], which is right — there's no issue to check status:blocked against otherwise).
  • Confirmed the label→trigger wiring: status:needs-qa and status:needs-review are applied via the App token (needed to cross workflow boundaries), while the risk label and PR comments correctly stay on GITHUB_TOKEN (they don't need to trigger anything) — consistent with the rest of the pipeline's documented token-use rules.
  • No new networking dependency/call — pip install pyyaml predates this diff, unchanged.
  • Sensitive-path touch (.github/workflows/**) is explicitly flagged in the PR's own "Risk" section, as required.
  • QA's report (test run, YAML/bash syntax checks, acceptance-criteria trace) independently reproduces to the same results I got re-doing the checks myself — no discrepancies.

Finding (non-blocking)

docs/agent-team-pipeline.md's "PR intake backstop" section (~line 248–255) still describes pr-intake.yml as running "the exact same deterministic classify-and-label step dev-agent.yml's tail runs for its own PRs" and only mentions status:needs-qa — it doesn't mention the new issue-less → status:needs-review branch this PR adds. Confirmed by reading that section directly; it's now slightly stale relative to the behavior this PR ships. Not a functional defect and QA already flagged the same gap — worth a small follow-up doc touch-up, not worth blocking on.

AGENTS.md conventions

Branch name and commit message follow convention. No dedicated test added for the inline bash guard logic, but that's consistent with this file's own precedent (resolve_linked_issue.sh has a standalone test script because it's a sourced, reusable function; the guard step's inline bash in pr-intake.yml doesn't, matching prior changes to this same file).

No CONFIRMED findings. Landing on status:needs-human-merge solely because of the risk:high sensitive-path classification, per .github/agent-policy.yml — a human should still give this its own look given the pipeline-config sensitivity, but I found nothing that should block the merge itself.

@github-actions github-actions Bot added status:needs-human-merge Principal review done, requires human merge decision and removed status:needs-review QA passed, awaiting principal-review-agent labels Aug 20, 2026
@libravault-xyz
libravault-xyz merged commit a42ce07 into dev Aug 20, 2026
15 checks passed
@libravault-xyz
libravault-xyz deleted the fix/pr-intake-unlinked-issue-fallback branch August 20, 2026 12:43
github-actions Bot added a commit that referenced this pull request Aug 20, 2026
The PR intake backstop section only described the linked-issue path
(status:needs-qa). PR #344 added a second branch for issue-less PRs
(status:needs-review, routing to principal-review.yml since qa-agent.yml
hard-stops without a linked issue). Document both.

Closes #346

Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
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-human-merge Principal review done, requires human merge decision

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ci] pr-intake.yml leaves manually-opened PRs with no linked issue completely unlabeled

1 participant