Skip to content

fix(ci): push dev-agent commits with the App token, not GITHUB_TOKEN - #313

Merged
libravault-xyz merged 1 commit into
devfrom
fix/dev-agent-push-token-action-required
Aug 19, 2026
Merged

libravault-xyz merged 1 commit into
devfrom
fix/dev-agent-push-token-action-required

Conversation

@libravault-pipeline-bot

Copy link
Copy Markdown
Contributor

What

dev-agent.yml's revise-mode git push (the commit(s) pushed when QA sends a PR back for fixes) was authenticated as the default GITHUB_TOKEN. GitHub attributes the resulting pull_request: synchronize event to actor github-actions[bot], and that push's checks (iOS App Build & Test, JVM Tests, UI Tests (Emulator)) then land on action_required with zero jobs ever created — even though the PR is same-repo, not a fork. This silently starves every QA revision round of CI signal (confirmed live on PRs #257 and #284).

The initial PR-open push never hit this: the opened event is attributed to whichever call actually created the PR (gh pr create, already routed through APP_GH_TOKEN), not to whichever token pushed the branch first.

Fix

Route every git push dev-agent performs — both the initial triage-mode branch push and every revise-mode push — through the pipeline App token (APP_GH_TOKEN) instead of the default GITHUB_TOKEN, matching the identity that's already known to work for PR creation. This is the "sidestep the setting" option from the issue rather than the "find and fix the repo/org approval setting" option — it doesn't require confirming which specific setting is responsible, and it reuses a token/pattern already in place for the workflow-file-diff case.

Out of scope (left for follow-up, per the issue's "Possible fixes" list)

  • Actually identifying/correcting whichever repo or org setting causes a same-repo bot-attributed push to be treated like a fork PR needing approval. Still unconfirmed — this PR doesn't change any repo/org setting.
  • A pipeline health-check routine that detects PRs stuck on action_required with zero jobs and self-heals by approving the run. That needs a real user token (per the issue, neither GITHUB_TOKEN nor APP_GH_TOKEN can call the approve-run API themselves) — wiring a personal credential into the pipeline is a bigger decision than this fix, and out of scope here.

Risk

risk:high by path — this touches .github/workflows/** (agent-policy.yml's sensitive_paths), so it will always route to human merge regardless of what QA/principal-review conclude. Flagging explicitly per the dev-agent persona's instruction to call this out rather than leave it for the diff alone to explain.

Testing

No unit-test framework applies to GitHub Actions workflow YAML in this repo (no Kotlin/JVM code changed, so ./gradlew testDebugUnitTest is a no-op for this diff). Verified python3 -c "import yaml; yaml.safe_load(...)" parses the edited file cleanly. The real test is behavioral and already underway: this very PR's own creation push and (if QA requests changes) any revision push are the first live exercises of the new path — a revise-mode push landing with pull_request: synchronize checks actually queued (not action_required/zero jobs) will be direct confirmation the fix works, and a repeat of the stuck-checks symptom will disprove the hypothesis.

Closes #311

Revise-mode pushes were authenticated as GITHUB_TOKEN, which GitHub
attributes to actor github-actions[bot] on the resulting `pull_request:
synchronize` event. That leaves the PR's checks stuck on
action_required with zero jobs ever created, even for a same-repo,
non-fork PR — starving every QA revision round of CI signal. The
initial PR-open push never hit this because gh pr create (already on
the App token) is what's attributed to the `opened` event, not
whichever token pushed the branch. Route every git push through the
App token instead, matching that already-working identity.

Closes #311
@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 19, 2026
@libravault-pipeline-bot libravault-pipeline-bot Bot added the status:needs-qa PR open, awaiting qa-agent verification label Aug 19, 2026
@claude

claude Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

QA verification — PR #313 vs issue #311

Issue type: bug report (no acceptance checklist) → checklist is "repro no longer reproduces + regression proof."

Root-cause fix check — PASS

Issue #311 pinned the cause precisely: revise-mode git push used GITHUB_TOKEN, GitHub attributes the resulting pull_request: synchronize event to github-actions[bot], and that lands checks on action_required with zero jobs — even same-repo. The issue's own "Possible fixes" list offered two options: (a) find/fix the underlying repo/org setting, or (b) sidestep it by pushing everything as the App token, matching the pattern already used for the workflow-file-diff case. PR #313 implements (b), explicitly deferring (a) as documented, unconfirmed follow-up — matches the issue's own framing, not scope creep.

Verified in the diff (gh pr diff 313):

  • The APP_GH_TOKEN step comment (.github/workflows/dev-agent.yml ~L299-329) now documents every git push uses the App token, not just workflow-file diffs, and explains why (issue pull_request workflow runs stuck on action_required for same-repo (non-fork) github-actions[bot] pushes #311).
  • The agent-facing prompt text (~L409-421) was correspondingly updated: "Comments and labels use the default token as normal, but every git push — in both triage and revise mode, whether or not your diff touches .github/workflows/** — must use the elevated token instead," with the git push https://x-access-token:$APP_GH_TOKEN@... command spelled out. This is prompt text that drives an LLM-executed agent step (not a literal shell git push in the YAML itself), consistent with how the pre-existing workflow-file-diff exception was already implemented — same mechanism, now unconditional.
  • No other git push/token usage sites in the file were missed — grepped all GH_TOKEN/APP_GH_TOKEN/git push occurrences; the only other push-adjacent tokens (GH_TOKEN for gh pr view/gh pr edit --add-label, github_token for the Claude Code action's own auth) are unrelated to the push-attribution bug and correctly left untouched.

Tests — no test required, correctly so

This is a .github/workflows/** comment + prompt-text change with no executable Kotlin/iOS logic — falls under AGENTS.md's "comment fixes" exemption from the mandatory-unit-test rule. ./gradlew testDebugUnitTest --continue run locally: BUILD SUCCESSFUL, 438 actionable tasks, no failures — confirms no regression, though (as expected) it can't exercise CI-attribution behavior itself.

Regression / behavioral confirmation — partially observed, as expected

This PR's own initial push already went through gh pr create on the App token (per the issue, that path never had the bug), so its own CI checks (JVM Tests, iOS App Build & Test) ran and passed normally — expected either way, not yet evidence for the fix. The actual claim (revise-mode pushes stop landing on action_required) can only be confirmed by a future revise-mode push on a PR under this fixed workflow; the PR body is upfront that this is unverified pending that live exercise. No regression test is possible for this in this repo (no CI-YAML test framework, no actionlint/workflow-lint gate found in .github/workflows/).

AGENTS.md conventions — PASS

No test needed (exempt, see above). Branch naming (fix/dev-agent-push-token-action-required), commit message, and PR description all follow repo conventions. risk:high label correctly applied — diff touches .github/workflows/**, a sensitive path per agent-policy.yml, so this always routes to human merge regardless of QA/principal-review outcome.

Verdict

Fix correctly and completely implements the chosen approach from the issue's own fix list, is internally consistent (both push sites covered, comment and prompt text agree), doesn't overreach into the explicitly-deferred root-cause investigation or self-heal work, and needs no unit test per this repo's own conventions. Full confirmation of the actual behavioral claim is necessarily deferred to a live revise-mode push, which the PR discloses rather than hides.

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 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Principal review — PR #313

Verdict: human-merge — risk:high is correctly applied (diff touches .github/workflows/**, a sensitive_paths entry in .github/agent-policy.yml), so this always routes to a human regardless of findings below. Label isn't stale: the one commit (1ecedcb, 07:01:46Z) predates the risk:high label (07:14:17Z) and nothing has landed since.

Verification performed

  • Read the full diff (gh pr diff 313) — it is a comment-block + agent-prompt-text change only, no literal shell git push exists anywhere in this file (confirmed via grep -n "git push" across .github/workflows/*.yml); the actual push-token selection is entirely LLM-prompt-driven, same mechanism the pre-existing "workflow-file-diff exception" already used — this PR just widens it to unconditional. Consistent with how QA characterized it.
  • python3 -c "import yaml; yaml.safe_load(...)" — parses cleanly, matches the PR description's claim.
  • Confirmed neither dev-agent.yml, qa-agent.yml, nor principal-review.yml trigger on push/synchronize (all three are labeled-only + workflow_dispatch) — the "no self-loop" claim in the new comment holds.
  • gh pr checks 313 — iOS build, JVM tests, iOS UI tests all pass; this PR's own initial push (via gh pr create → App token, pre-existing behavior) never hit the bug described in #311, as the PR body itself acknowledges.
  • Read issue #311 in full — the fix implements option (b) from its own "Possible fixes" list verbatim, correctly defers option (a) (root-causing the repo/org setting) and the self-heal routine as out of scope, matches the PR description.
  • Checked principal-review.yml's git push origin dev (the only other literal git push in .github/workflows/) — that's a direct push to dev for the audit-log commit, unrelated to the PR-branch synchronize-attribution bug this PR fixes. Correctly left untouched.

Finding (minor, confirmed)

.github/workflows/dev-agent.yml (new comment, ~L325-328): "jvm-tests.yml/ios-app-build.yml's own on: push triggers are scoped to dev/main only (issue #244)" — this is factually wrong for ios-app-build.yml. Its actual trigger (.github/workflows/ios-app-build.yml:7-11) is push: branches: [dev, feat/v3-ios-port] — no main, plus an extra branch not covered by the "dev/main" characterization. Issue #244 itself says so explicitly: "Note ios-app-build.yml already does this correctly (push limited to dev and feat/v3-ios-port)." jvm-tests.yml is correctly dev/main — only the conflation of the two files under one description is wrong.

This doesn't affect the correctness of the fix itself (no fix/*/feature/* dev-agent branch will ever literally collide with feat/v3-ios-port, so the "no redundant run" conclusion still holds in practice), but this repo's own convention treats these justification comments as load-bearing ground truth (agents and humans both read them at face value, per the extensive precedent throughout this file citing exact issue numbers). Worth a one-line correction before merge — e.g. "jvm-tests.yml is scoped to dev/main; ios-app-build.yml to dev/feat/v3-ios-port — neither overlaps a fix/*/feature/* branch (issue #244)."

Everything else

  • No new networking dependency/call introduced.
  • No other sensitive_paths entries touched.
  • AGENTS.md's "comment fixes" test exemption correctly applies (no executable logic changed) — QA's assessment checks out.
  • Behavioral confirmation of the actual #311 fix is (as the PR discloses) still pending a live revise-mode push; nothing here to disprove it, and there's no way to test it earlier than that.

Routing to human-merge on the risk:high label as required; the one confirmed finding above is minor and non-blocking on its own but should be fixed while a human is already here for the sensitive-path review.

@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 19, 2026
@libravault-xyz

Copy link
Copy Markdown
Collaborator

Reviewed directly: this is a comment/prompt-text-only change extending the already-trusted APP_GH_TOKEN push pattern (previously only used for workflow-file diffs) to every git push dev-agent makes — no new privilege, just wider use of a path already accepted for the sensitive case. QA's verdict is right that the actual behavioral claim (revise-mode pushes stop landing on action_required) is only provable by a live revise-mode push under this fixed workflow — worth watching the next PR that goes through a QA request-changes round to confirm. Root-cause identification of the underlying repo/org setting (issue #311's other open half) is still outstanding. Merging.

@libravault-xyz
libravault-xyz merged commit 6976f9c into dev Aug 19, 2026
15 checks passed
@libravault-xyz
libravault-xyz deleted the fix/dev-agent-push-token-action-required branch August 19, 2026 08:23
libravault-xyz added a commit that referenced this pull request Aug 19, 2026
…erage

Addresses the QA-agent's blocking finding on the re-review of PR #310
(#309): commit 0057aee fixed a real principal-review-confirmed bug (the
scrub bar called appState.seek(to:), and therefore syncNowPlayingInfo(),
on every drag frame) but shipped with zero test coverage — no regression
guard that would fail against the pre-fix behavior.

Pulls the drag/commit decision out of PlayerView into PlayerScrubberState,
a plain, SwiftUI-free struct: displayValue(elapsedSeconds:) for what the
slider/label should show, updateDragValue(_:) for per-frame drag updates
(local only, no seek), and editingChanged(_:elapsedSeconds:) mirroring
Slider's onEditingChanged — returns the value to commit via
appState.seek(to:) only on the drag-ended transition, nil otherwise.
PlayerView now just holds one @State PlayerScrubberState and forwards
Slider's callbacks into it; behavior is unchanged.

New PlayerScrubberStateTests covers: display tracks live playback while
not dragging, drag start seeds from current position (not a stale 0),
per-frame drag updates never touch playback, drag end commits exactly
once with the final dragged-to value, display resumes following live
playback after the drag ends (so a remote/Control Center command during
a drag still shows up once released), and a full simulated drag gesture
commits exactly once — the direct regression guard for the original bug.

Merged origin/dev in first to pick up #313's dev-agent.yml fix (this
branch's copy was stale enough that GitHub's own anti-tampering check on
pull_request + id-token: write workflows was blocking OIDC minting,
skipping the automated QA retry — see issue #254).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
libravault-xyz added a commit that referenced this pull request Aug 19, 2026
…rol Center (#310)

* feat(ios): wire MPNowPlayingInfoCenter/MPRemoteCommandCenter for Control Center

AppState now publishes book/chapter/elapsed/rate metadata to Control
Center/the lock screen on start/pause/resume/seek/chapter-change/speed-change,
and routes the system's play/pause/skip commands back into the existing
playback controls, reusing whatever real cover art is already cached.

Real MediaPlayer calls (SystemNowPlayingManager) are guarded off under
XCTest, mirroring TTSEngineBridge/AudioPlaybackEngine's existing
isRunningUnderXCTest pattern for AVAudioSession/AVSpeechSynthesizer,
since MPNowPlayingInfoCenter/MPRemoteCommandCenter talk to a similar
system daemon and there's no local Simulator available here to confirm
that's safe in the headless CI Simulator.

Closes #309

* fix(ios): don't let playbackSpeed's Now Playing sync fire before nowPlayingBook is set

The dev-agent's run for #309 crashed on max_turns (90) after opening this PR
with real, substantial content — not a bug in itself, but CI caught 3 real
test failures in AppStateNowPlayingTests, all an identical off-by-one in
clearCallCount.

Root cause: startPlayback's isNewSession branch did
`playbackSpeed = defaultPlaybackSpeed` *before* `nowPlayingBook = book`.
playbackSpeed's didSet now also runs `defer { syncNowPlayingInfo() }` (this
PR's own change) — so that reassignment fired the sync while nowPlayingBook
still pointed at the previous session (or nil, on the very first
startPlayback ever), reading a stale/absent book and spuriously clearing
Control Center — one extra clear() call before this function's own trailing
sync ran moments later with the correct book. Three tests caught it:
starting an unsupported format while another book plays (expected 0 clears,
got 1), stopPlayback (expected 1, got 2), and sleep-timer expiry (expected 0,
got 1) — each off by exactly the one spurious clear from the *preceding*
startPlayback call.

Fix: move the `playbackSpeed = defaultPlaybackSpeed` reset to after
`nowPlayingBook = book`, still gated on isNewSession exactly as before —
doesn't change what speed gets applied or when it's consumed later in the
function, only ensures the didSet observes a consistent nowPlayingBook when
it fires.

Verified by static trace against all 17 AppStateNowPlayingTests cases (not
executed — no local Xcode/Simulator in this environment); pushing for CI to
confirm.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* fix(ios): suppress playbackSpeed's didSet during startPlayback's default-speed seeding

Amends the previous commit — that fix (reordering nowPlayingBook before the
playbackSpeed reset) cleared the 3 original AppStateNowPlayingTests failures
but introduced a new, CI-caught regression: for an audio book, playbackSpeed's
didSet now saw a real nowPlayingBook at seed time and called
audioEngine.setRate() redundantly, right before startAudioPlayback's own
play(rate:) call moments later — testChangingSpeedForAnAudioBookApplies-
ItLiveWithoutRecomputingDuration expected setRateCalls == [2.0] but got
[1.0, 2.0].

Root problem either way: startPlayback's `playbackSpeed = defaultPlaybackSpeed`
is bookkeeping (seeding a new session), not a live speed change — it shouldn't
run playbackSpeed's didSet's side effects (setRate, Now Playing sync) at all,
regardless of exactly when nowPlayingBook happens to get set relative to it.

Reverts the reordering and instead adds isSeedingPlaybackSpeedForNewSession,
set true only around that one assignment, which the didSet checks first and
bails out on entirely. startPlayback's own trailing `defer { syncNowPlayingInfo() }`
already publishes the real, final state once setup finishes, and
startAudioPlayback's play(rate:) already applies the real rate — neither
needs anything from the seeding didSet run.

Traced by hand against all 17 AppStateNowPlayingTests + the playbackSpeed
sections of AppStatePlaybackTests/AppStateAudioPlaybackTests (not executed —
no local Xcode/Simulator in this environment); pushing for CI to confirm.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* fix(ios): scrub bar now seeks/syncs Now Playing only on drag end, not every frame

Addresses the principal-review CONFIRMED finding on PR #310: PlayerView's
Slider was bound directly to appState.seek(to:) via a plain Binding<Double>,
which SwiftUI calls continuously (many times per second) while the thumb is
being dragged — and seek(to:) now also calls syncNowPlayingInfo(), doing a
synchronous cover-art disk read plus setting MPNowPlayingInfoCenter.
nowPlayingInfo and reassigning the skip-command intervals (an IPC round-trip
to nowplayingd) on every single one of those calls. Real, user-visible jank
on the one control most likely to be dragged rapidly and continuously.

Tracks the drag's own live position in local @State (scrubberDragValue/
isDraggingScrubber) via Slider's onEditingChanged, and only calls
appState.seek(to:) once, when the drag ends. The displayed value (both the
slider thumb and the elapsed-time label) still tracks appState.elapsedSeconds
live whenever the user isn't actively dragging, so external changes (skip
buttons, a remote command) still show up immediately. Correct per
syncNowPlayingInfo's own existing rationale: the system interpolates
elapsed time between updates using the reported playback rate, so it never
needed per-frame precision to begin with.

No AppState changes — the fix is entirely in how PlayerView drives seek(to:).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* test(ios): extract PlayerScrubberState so the drag/commit fix has coverage

Addresses the QA-agent's blocking finding on the re-review of PR #310
(#309): commit 0057aee fixed a real principal-review-confirmed bug (the
scrub bar called appState.seek(to:), and therefore syncNowPlayingInfo(),
on every drag frame) but shipped with zero test coverage — no regression
guard that would fail against the pre-fix behavior.

Pulls the drag/commit decision out of PlayerView into PlayerScrubberState,
a plain, SwiftUI-free struct: displayValue(elapsedSeconds:) for what the
slider/label should show, updateDragValue(_:) for per-frame drag updates
(local only, no seek), and editingChanged(_:elapsedSeconds:) mirroring
Slider's onEditingChanged — returns the value to commit via
appState.seek(to:) only on the drag-ended transition, nil otherwise.
PlayerView now just holds one @State PlayerScrubberState and forwards
Slider's callbacks into it; behavior is unchanged.

New PlayerScrubberStateTests covers: display tracks live playback while
not dragging, drag start seeds from current position (not a stale 0),
per-frame drag updates never touch playback, drag end commits exactly
once with the final dragged-to value, display resumes following live
playback after the drag ends (so a remote/Control Center command during
a drag still shows up once released), and a full simulated drag gesture
commits exactly once — the direct regression guard for the original bug.

Merged origin/dev in first to pick up #313's dev-agent.yml fix (this
branch's copy was stale enough that GitHub's own anti-tampering check on
pull_request + id-token: write workflows was blocking OIDC minting,
skipping the automated QA retry — see issue #254).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: LibraVault <rob@libravault.xyz>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.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.

pull_request workflow runs stuck on action_required for same-repo (non-fork) github-actions[bot] pushes

1 participant