Skip to content

fix(ci): guarantee real CI signal when dev-agent marks a PR ready - #483

Open
libravault-pipeline-bot[bot] wants to merge 2 commits into
devfrom
fix/dev-agent-ready-token-ci-signal
Open

libravault-pipeline-bot[bot] wants to merge 2 commits into
devfrom
fix/dev-agent-ready-token-ci-signal

Conversation

@libravault-pipeline-bot

Copy link
Copy Markdown
Contributor

What

dev-agent.yml's "Force-classify risk and advance to QA" step called
gh pr ready "$PR_NUMBER" under the default GITHUB_TOKEN. GitHub
Actions never creates a workflow run for a ready_for_review event
attributed to GITHUB_TOKEN (its own anti-recursion protection), so
jvm-tests.yml/ios-app-build.yml silently never produced a real run
for PRs that went straight from draft to ready with no revisions
needed — confirmed live on PR #432. The checks read SKIPPED rather
than surfacing as a failure, so nothing in the pipeline flagged the gap.

Fix

Two changes to the same step in .github/workflows/dev-agent.yml:

  1. gh pr ready "$PR_NUMBER" now runs under APP_GH_TOKEN (matching
    every other cross-workflow-triggering call in this file), not the
    default token.
  2. That alone isn't sufficient on the most common path: the dev-agent
    persona still instructs the agent to mark its own PR ready as one
    of its last actions, and claude-code-action forces the agent's own
    git/gh identity onto GITHUB_TOKEN regardless of GH_TOKEN/
    APP_GH_TOKEN (documented in this same workflow's "Run dev agent"
    step and in docs/agent-team-pipeline.md's claude-code-action
    gotchas section) — so the agent's own call typically wins the race
    and makes step 1's fixed call a no-op (gh pr ready on an
    already-ready PR does nothing and fires no new event). To close that
    gap without touching the agent's own behavior, the step now also
    pushes an empty ci: retrigger checks… commit under APP_GH_TOKEN
    — a real synchronize event, not subject to the same suppression —
    scoped to triage-mode completion only (the one point in a PR's life
    where it actually leaves draft; revise-mode runs already produce
    real synchronize events from their own fix commits).

NEEDS HUMAN DECISION — persona doc left un-updated

.claude/agents/dev-agent.md's "Open the PR early" section still tells
the agent to call gh pr ready itself as one of its last actions. The
ideal fix would also update that instruction (stop self-readying, let
this workflow's step be the sole place that performs the transition),
which would let step 1 above do the whole job without needing the
belt-and-suspenders empty commit in step 2. I could not make that edit:
the Edit tool declined to write to .claude/agents/** for me (it's a
sensitive_paths entry, and this run's tool permissions enforce that
as a hard block, not just the after-the-fact risk:high labeling the
persona describes for other sensitive paths). The workflow-level fix
above works correctly regardless of whether that persona text ever
changes, so nothing is broken by leaving it as-is, but a human should
consider making that edit anyway to remove the now-redundant race and
its always-run empty commit on every triage-mode PR.

Risk

This diff touches .github/workflows/dev-agent.yml, a
sensitive_paths entry in agent-policy.yml — classify_pr_risk.py
will force risk:high on this PR regardless of size, so it will land
on status:needs-human-merge rather than auto-merging. Flagging
explicitly per the persona's instructions for touching a sensitive path.

Testing

No local test harness exists for GitHub Actions workflow YAML in this
repo. Verified with: python3 -c "import yaml; yaml.safe_load(open('.github/workflows/dev-agent.yml'))"
(passes) and shellcheck against the modified step's script body with
${{ }} expressions placeholder-substituted (no real issues, only
expected false positives from the substitution). The actual fix can
only be confirmed by a live run advancing a PR from draft to ready,
same as the original bug was only found that way.

Closes #433

gh pr ready in the "Force-classify risk and advance to QA" step used
the default GITHUB_TOKEN, and GitHub Actions never creates a workflow
run for a ready_for_review event attributed to that token (its own
anti-recursion protection) — so jvm-tests.yml/ios-app-build.yml
silently never ran for PRs that needed zero revisions (confirmed live
on PR #432). Switch that call to the App token, and — since the
agent's own gh pr ready call (still instructed by the persona) is
forced onto GITHUB_TOKEN by claude-code-action regardless of which
token this workflow makes available, so it can win the race and make
the fixed call above a no-op — also force a real synchronize event
under the App token on triage-mode completion specifically, guaranteed
to happen exactly once per PR's draft->ready transition.

Closes #433
Matches the existing "Check out PR branch" step's caution (issue #386):
force the tree to match HEAD after checkout rather than trusting a
clean switch, since the empty commit right after runs in the same
working directory.
@github-actions
github-actions Bot marked this pull request as ready for review August 24, 2026 02:56
@github-actions github-actions Bot added the risk:high Touches a sensitive path or exceeds diff-size threshold — always human merge label Aug 24, 2026
@libravault-pipeline-bot libravault-pipeline-bot Bot added the status:needs-qa PR open, awaiting qa-agent verification label Aug 24, 2026
@claude

claude Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

QA verdict: PASS

Originating issue: #433 — gh pr ready under the default GITHUB_TOKEN in dev-agent.yml's "Force-classify risk and advance to QA" step meant GitHub Actions never created a workflow run for the resulting ready_for_review event (its own anti-recursion protection), so jvm-tests.yml/ios-app-build.yml silently never ran for PRs that needed zero revisions (confirmed live on PR #432).

Issue #433 is a bug report with no explicit acceptance checklist — QA'd against "the repro no longer reproduces, and a regression test proves it," per the persona.

Per-criterion check

  • ✅ gh pr ready now runs under APP_GH_TOKEN, not GITHUB_TOKEN (dev-agent.yml:694). Matches every other cross-workflow-triggering call in this file.
  • ✅ Belt-and-suspenders forced synchronize event (dev-agent.yml:711-726), scoped to steps.guard.outputs.mode == 'triage'only — verified the guard step only ever emitsmode=triage/mode=revise` (grep confirms), and revise-mode's own fix commits already produce real synchronize events, so the scoping is correct, not overbroad.
  • ✅ Trigger-graph sanity-checked directly, since this is the actual mechanism the fix depends on: jvm-tests.yml/ios-app-build.yml both trigger on pull_request with default types (opened/synchronize/reopened) plus explicit ready_for_review, so the forced empty commit's synchronize event will produce a real run — the intended fix. qa-agent.yml/principal-review.yml only trigger on pull_request: types: [labeled], so the forced commit does not spuriously re-invoke QA/review. dev-agent.yml itself only triggers on issues/pull_request: labeled/workflow_dispatch, so no self-retrigger/infinite-loop risk from the push.
  • ✅ Working-tree-reset fixup commit (35f78ec) is a clean, correctly isolated addition of git reset --hard HEAD after git checkout -B, matching the existing precedent for the identical concern on the "Check out PR branch" step (issue principal-review.yml's checkout leaves the working tree dirty relative to HEAD for unrelated files #386). Reviewed in isolation via git show.
  • ✅ YAML validity: python3 -c "import yaml; yaml.safe_load(open('.github/workflows/dev-agent.yml'))" — passes.
  • ✅ Shellcheck on the modified step's script body (extracted by line range, ${{ }} expressions substituted with a placeholder): zero real findings — only the expected SC2050 false positives from placeholder substitution on if [ "PLACEHOLDER" = ... ] lines, exactly as the PR description claims.
  • ⚠️ No regression test exists, and none is feasible. Confirmed there's no test harness for GitHub Actions workflow YAML anywhere in this repo (no dev-agent.yml-referencing test files besides the risk-classification script itself). This mirrors precedent (fix(ci): force clean working tree after gh pr checkout in pipeline workflows #387, an equivalent workflow-token/checkout fix, merged on "real CI green" + direct review with no dedicated regression test). The actual behavior can only be confirmed by a live PR going through draft→ready, same as how gh pr ready uses default GITHUB_TOKEN, so ready_for_review never triggers jvm-tests.yml/ios-app-build.yml #433 itself was diagnosed. Not treating this as a gap given the structural constraint and precedent, but flagging per the checklist's instruction to note it explicitly.
  • ✅ AGENTS.md conventions: branch name fix/dev-agent-ready-token-ci-signal matches fix/<short-slug>; both commit subjects use Conventional Commits (fix(ci): …); no local.properties/keystores/build output committed; two commits split into a main fix + an isolated fixup, consistent with "one concern per commit."
  • ✅ risk:high label correctly applied — diff touches .github/workflows/**, a sensitive_paths entry in .github/agent-policy.yml, so this correctly routes to status:needs-human-merge regardless of size (already flagged explicitly in the PR body).

What I ran

  • python3 -c "import yaml; yaml.safe_load(...)" on .github/workflows/dev-agent.yml — passes.
  • shellcheck -S warning on the modified step's extracted script — clean (only expected placeholder-substitution false positives).
  • ./gradlew testDebugUnitTest --continue (full JVM suite, foreground, ~9m27s) — BUILD SUCCESSFUL, 438 actionable tasks (338 executed, 100 from cache), no failures. Not expected to exercise this change directly (workflow-YAML-only diff, no JVM/Android code touched) but confirms no regression elsewhere.
  • Manually cross-checked the trigger on: blocks of jvm-tests.yml, ios-app-build.yml, qa-agent.yml, principal-review.yml, and dev-agent.yml itself against the new forced-commit mechanism to confirm it fires the intended workflows and nothing else.

Note for the human merge (this lands on status:needs-human-merge, not auto-merge)

The PR body flags that .claude/agents/dev-agent.md's "Open the PR early" section still tells the agent to self-gh pr ready, which the Edit tool blocked (sensitive path) from being updated in this PR. The workflow-level fix here is correct and sufficient on its own regardless of whether that persona text changes, but worth a follow-up decision per the PR's own "NEEDS HUMAN DECISION" section.

QA verdict: PASS

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

Copy link
Copy Markdown
Contributor

Principal review — verdict: human-merge

Why human-merge: risk:high is correctly applied here (.github/workflows/dev-agent.yml matches the .github/workflows/** sensitive_paths glob in agent-policy.yml), and no commits landed after the label was set (both commits at 02:54–02:55Z, label at 02:56:24Z, so it's not stale) — no re-run of classify_pr_risk.py needed. No CONFIRMED-severity findings below, so this is routing to a human purely on the risk label, per the persona.

Verified

  • YAML is valid: python3 -c "import yaml; yaml.safe_load(open('.github/workflows/dev-agent.yml'))" passes.
  • Token fix matches the diagnosed root cause: GH_TOKEN="$APP_GH_TOKEN" gh pr ready "$PR_NUMBER" correctly swaps to the App token, consistent with every other cross-workflow-triggering call already in this file, and matches issue gh pr ready uses default GITHUB_TOKEN, so ready_for_review never triggers jvm-tests.yml/ios-app-build.yml #433's root-cause analysis and its "alternative" suggested direction (token swap + forced synchronize commit, done together here — the strongest of the two options offered).
  • No new trigger loop introduced: checked qa-agent.yml / principal-review.yml — both trigger only on pull_request: labeled, not push/synchronize, so the new empty commit's push only reaches jvm-tests.yml/ios-app-build.yml (which do listen for synchronize) — exactly the intended target, no risk of re-triggering dev-agent.yml itself or double-firing QA/review.
  • dorny/paths-filter behavior confirmed sane: it diffs against the PR's base, not just the latest commit, so the new empty commit correctly leaves JVM/iOS test jobs skipped on this PR (no app code changed) while still producing a real, non-suppressed workflow run — consistent with what's currently showing on this PR's own checks.
  • Git identity/push pattern for the forced commit (git config user.name "github-actions[bot]" + x-access-token:$APP_GH_TOKEN push URL) isn't new — it's copied from the existing precedent in principal-review.yml (issue principal-review.yml's checkout leaves the working tree dirty relative to HEAD for unrelated files #386), not an invented pattern.
  • Scoping to mode == 'triage' only is correct: revise-mode pushes already go through APP_GH_TOKEN and produce genuine synchronize events every round, so extending this to revise mode would just be a redundant empty commit.
  • Diff is limited to the one file described; nothing else in sensitive_paths (fastlane, vaultcrypto, keystore, etc.) is touched.

Self-referential limitation (not a defect, flagging for visibility)

This fix can't be exercised against itself: this PR's own draft→ready transition ran under the old dev-agent.yml from dev (a workflow run always uses the base branch's copy of its own trigger file), so — as expected — this PR shows only one Detect Changed Paths run per workflow, not a second one from a forced synchronize commit. That's consistent with the bug being unfixed until this merges, not a sign the fix is broken. Worth a human's live-test after merge on the next triage PR, same as the original bug was only ever confirmed live (the PR description already says as much).

Worth a second look before merging (not filing an issue — not a code defect)

The "NEEDS HUMAN DECISION" section claims the Edit tool "declined to write to .claude/agents/**" as "a hard block" enforced by "this run's tool permissions." I couldn't corroborate that in the repo: --allowedTools "Read,Grep,Glob,Bash,Edit,Write,WebSearch" in this same workflow grants Edit/Write with no path scoping I could find, there's no .claude/settings.json/hooks config in the repo, and docs/agent-team-pipeline.md's only relevant statement is that human-merge-sweep.yml refuses to auto-merge changes under .claude/agents/** — a merge-time policy, not a write-time tool block. This may be real behavior internal to claude-code-action that isn't visible from repo config, but as written it reads more like the agent choosing caution on a sensitive path (reasonable) and mislabeling why. Doesn't affect this diff's correctness either way — the workflow-level fix works regardless of whether the persona doc ever changes — but worth confirming before treating "Edit tool hard-blocks sensitive paths" as an established platform guarantee elsewhere.

Bottom line

The actual code change is sound, narrowly scoped, and correctly reasoned — I'd merge it as-is. Routing to human-merge solely because of the sensitive-path label, per policy.

@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 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Human-merge sweep: this PR modifies .github/workflows/dev-agent.yml. Per this repo's hard rule (.claude/agents/human-merge-sweep-agent.md), this sweep never merges anything touching .github/workflows/**, .github/agent-policy.yml, or .claude/agents/**, however clean the diff looks — CI is green and the diff looks straightforward, but this needs a human to merge directly.

@github-actions

Copy link
Copy Markdown
Contributor

Human-merge sweep: this PR modifies .github/workflows/dev-agent.yml. Per this repo's hard rule (.claude/agents/human-merge-sweep-agent.md), this sweep never merges anything touching .github/workflows/**, .github/agent-policy.yml, or .claude/agents/**, however clean the diff looks — CI is green and the QA/review passes look solid, but this needs a human to merge directly.

libravault-xyz pushed a commit that referenced this pull request Aug 25, 2026
)

The "Backstop — take the PR out of draft if it's still one" step called
gh pr ready under the default GITHUB_TOKEN, which GitHub Actions refuses
to let trigger a real ready_for_review event (its own anti-recursion
protection). That silently skipped jvm-tests.yml/ios-app-build.yml's
draft-gated jobs and made the backstop step itself fail, which in turn
caused "Run QA agent" to never execute and "Advance PR based on QA
verdict" to misreport it as "QA agent produced neither a verdict file
nor a verdict comment line" — routing correct, CI-green PRs to
status:needs-info for reasons unrelated to their content.

Mints the pipeline App token earlier (before the backstop step, not
just before "Advance PR") and routes gh pr ready through it, matching
the fix pattern from issue #433/PR #483.

Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

Human-merge sweep: this PR touches .github/workflows/dev-agent.yml, which falls under this sweep's hard rule to never merge anything touching .github/workflows/**, .github/agent-policy.yml, or .claude/agents/**, regardless of how clean the diff looks. The fix (routing gh pr ready through APP_GH_TOKEN plus a belt-and-suspenders empty retrigger commit for the triage-mode path, since claude-code-action still forces the agent's own git/gh identity onto GITHUB_TOKEN) is well-explained, with a live #432 repro cited. It also flags a documentation gap in .claude/agents/dev-agent.md it couldn't fix itself (Edit tool blocked writes to .claude/agents/**) — worth a human's attention alongside the merge decision. Leaving for a human.

@github-actions

Copy link
Copy Markdown
Contributor

Human-merge sweep: reviewed the diff. The token fix (App token for gh pr ready) plus the belt-and-suspenders empty-commit synchronize retrigger, scoped to triage-mode only, is a sound fix for the documented GITHUB_TOKEN anti-recursion gap (issue #433, confirmed live on #432) — reasoning matches the existing pattern in this file (e.g. the #386 force-checkout comment it points at). No correctness issues found. Noted: the PR body flags that .claude/agents/dev-agent.md's self-ready instruction is left un-updated because the dev agent's own tool permissions blocked editing .claude/agents/** directly — that's a legitimate follow-up for a human to consider, not a defect in this diff. This PR's only change is .github/workflows/dev-agent.yml, which is on this sweep's hard-rule exclusion list regardless of review outcome — leaving for a human to merge directly.

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.

gh pr ready uses default GITHUB_TOKEN, so ready_for_review never triggers jvm-tests.yml/ios-app-build.yml

0 participants