Skip to content

fix: refresh outdated daily package updates - #1013

Closed
Karibhou wants to merge 31 commits into
projectbluefin:mainfrom
Karibhou:fix/864-fresh-bump
Closed

Karibhou wants to merge 31 commits into
projectbluefin:mainfrom
Karibhou:fix/864-fresh-bump

Conversation

@Karibhou

@Karibhou Karibhou commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary: A daily bump PR that falls behind main under strict freshness (ruleset: strict_required_status_checks_policy: true, no merge queue) could never land: the SHA-pinned merge answers 405. This sends a behind head back through update-branch and a fresh gate instead of merging an unbuilt head.

What the no-queue landing step in bump-upstream-enqueue.yml now does

  1. Watches the built head's required checks (unchanged).
  2. Reads the PR's mergeStateStatus with gh pr view after the watch (re-reading while GitHub reports UNKNOWN), and refuses if the head is no longer the built SHA.
  3. BEHIND: PUT pulls/<n>/update-branch with expected_head_sha=<built SHA>, waits for the new head, then dispatches bump-upstream-gate.yml on the daily branch (only bump/upstream-sources or bump/rawhide-imports). The new merge commit earns its own build verdict; the gate hands it back here.
  4. Otherwise: the single SHA-pinned squash merge (unchanged).

The app token gains permission-actions: write for that dispatch; the mergeraptor installation already holds actions: write. mergeStateStatus is a real gh pr view / GraphQL field (unlike behindBy, which sank #940).

Tests (tests/test_bump_gate.py): BEHIND → update + regate, never merge; checks watched before the update; UNKNOWN re-read before merging; head moved during the checks → no merge; failed update → no dispatch, no merge. The gh stub returns real gh pr view shapes in sequence.

Docs: docs/skills/rawhide-recipe-reimports.md.

Supersedes #940 (kylerankin's tools/land_bump.py approach to the same issue).

Closes #864

Verification: just check green (1569 passed); actionlint clean. Maintainer Canary: run on canary/pr-1013 at the head.

Original author: @Karibhou. Read-after-checks change and tests added by a maintainer.

Rebuild the updated head before landing it.

Hive-Run: projectbluefin#864
Hive-Plan: refresh-behind-bump
Hive-Spec: bump-gate#exact-head
Assisted-by: openai-codex/gpt-6.1-terra via GitHub Copilot
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Karibhou <157208370+Karibhou@users.noreply.github.com>
@Karibhou

Copy link
Copy Markdown
Contributor Author

Summary: This update is ready for automated checks. Those checks will show whether the change works as intended.


hive/awaiting-ci: CI pending — sweep will merge when green. The pull request is partial; see its remaining race before merging.

— hive: agent=scanner backend=omp model=openai-codex/gpt-6.1-terra

@hivecommons-hive

hivecommons-hive Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor
cd4d11b

⚠️ Sentinel alert — maintainer review required

Hive flagged this PR (author @Karibhou, head cd4d11b73195) because it matches behaviors that can override security controls, escalate privileges or damage the codebase. This is a heuristic, not an accusation — a maintainer should confirm the change is intended before it merges.

  • sensitive_path — changes 1 sensitive path(s) (Touches a sensitive path (OWNERS, workflows, policies, hive config, security docs, …))
    • .github/workflows/bump-upstream-enqueue.yml
  • permission_escalation — widens workflow permissions or uses pull_request_target (Widens GitHub Actions permissions or switches to pull_request_target)
    • .github/workflows/bump-upstream-enqueue.yml
  • ci_gate_weakening — CI configuration is deleted, softened or has gate checks removed (Disables or softens CI gates (continue-on-error, || true, removed checks))
    • .github/workflows/bump-upstream-enqueue.yml

Hive added the sentinel-alert label. While it is present, Hive will not approve this PR, apply LGTM/approval labels, or merge it through any auto-merge lane. Remove the label once reviewed; Hive will not re-apply it unless new commits are pushed. Tune paths and behaviors under sentinel in hive.yaml or the dashboard Security tab.

@hivecommons-hive hivecommons-hive Bot added author/clanker A contributor's own hive authored this PR under their login dco All commits are DCO signed-off stage/072-returned-to-contributor Contributor PR: CI red, changes requested or conflicting; diagnosis posted, author must act labels Nov 14, 2026
@hivecommons-hive

hivecommons-hive Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

@Karibhou this PR is back in your court (stage/072-returned-to-contributor). The hive will not merge it until the head changes.

Failing checks:

  • Canary

Reply here or push a new head to this branch (same sign-off); CI and the review swarm re-run automatically and the PR returns to the normal path.

Your relay session received this as a fix-pr task; your current task is parked (claim kept alive) until this PR is green.

@Karibhou

Copy link
Copy Markdown
Contributor Author

Canary failed because this is a fork PR with no maintainer-run proof, not because a build failed (failed job). This PR changes .github/, so canary-fork-pr.yml refuses its automated copy. A maintainer must review the workflow change and sentinel alert, then manually push the exact reviewed head 78843c32f464a4903c12008904d8da722bb921a4 to canary/pr-1013 and dispatch canary.yml on that branch; after a successful run, re-run the PR Canary. My account has no push permission to the base repository. A new fork commit alone cannot provide this proof.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

@Karibhou the hive has adopted this PR (stage/074-adopted-by-hive): CI stayed red for 2h after the nudge and the relay nudge went unanswered. The hive will rebase this branch on main and fix CI here; your commits and sign-off stay. Push a new head yourself at any time and the hive yields it back to you. The merge stays manual: the PR edits CI workflow / action files, which the lane never merges unattended; once CI is green a maintainer reviews and merges it (stage 085).

@hivecommons-hive hivecommons-hive Bot added stage/074-adopted-by-hive Contributor PR adopted: author unavailable after red CI; the hive is finishing it (takeover path) and removed stage/072-returned-to-contributor Contributor PR: CI red, changes requested or conflicting; diagnosis posted, author must act labels Nov 15, 2026
@Danathar

Copy link
Copy Markdown
Contributor

Stand-in note (the hive's agents are out of quota), answering the 11-14 request for a maintainer canary run. I'm not pushing this to canary/pr-1013 yet. Two things need a maintainer decision first:

  1. Permission increase. bump-upstream-enqueue.yml gives the app token permission-actions: write, so it can dispatch bump-upstream-gate.yml, and it adds an update-branch call. The fork guard exists so that code like this only runs with that token after a maintainer has reviewed it, and permission changes on the landing path are Doug's to approve. sentinel-alert stays on.
  2. Overlap with fix(landing): re-sync and rebuild a bump PR that fell behind main #940. hanthor's fix(landing): re-sync and rebuild a bump PR that fell behind main #940 solves the same problem ([reviewer] Review backlog (intent-alignment): No-queue path still cannot land a bump PR that falls BEHIND main under strict freshness #864: a bump PR that fell behind main) in tools/land_bump.py. Only one approach should land. fix(landing): re-sync and rebuild a bump PR that fell behind main #940 currently has changes requested: it reads a nonexistent behindBy field and runs gh pr checkout outside a clone. This PR uses the real mergeStateStatus == "BEHIND" and restricts the branch to the two bump branches, which is a point in its favour.

Once a maintainer picks the approach and OKs the permission, someone with write access can push 78843c3 to canary/pr-1013 and dispatch canary.yml.

@Karibhou

Copy link
Copy Markdown
Contributor Author

Thanks for reviewing. The actions: write permission and overlap with #940 need the maintainer decision you identified; I cannot approve that permission or run the protected workflow from the fork. I am leaving the reviewed head unchanged rather than invalidating a future Canary run.

@Karibhou

Copy link
Copy Markdown
Contributor Author

hive-base-moved: merged main at c014abe into this PR branch.

@Karibhou

Copy link
Copy Markdown
Contributor Author

Base drift required a merge; the new head is c0ae73e, so my earlier Canary instructions naming 78843c3 are stale. The permission increase and overlap with #940 still need the maintainer decision identified in review; fork workflow changes require maintainer-run Canary proof on the reviewed head.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

@Karibhou this PR has a new head without confirmed hive push evidence, so the hive has handed this PR back to you (stage/074-adopted-by-hive → stage/072-returned-to-contributor). It will nudge again if CI stays red.

@hivecommons-hive hivecommons-hive Bot added stage/072-returned-to-contributor Contributor PR: CI red, changes requested or conflicting; diagnosis posted, author must act and removed stage/074-adopted-by-hive Contributor PR adopted: author unavailable after red CI; the hive is finishing it (takeover path) labels Nov 16, 2026
@Karibhou

Copy link
Copy Markdown
Contributor Author

Canary is blocked on maintainer review and proof for the current head ae6bd54f3c3127dabaca56ffb8c83067886ca23d. This PR changes .github/workflows/bump-upstream-enqueue.yml, so the fork Canary workflow explicitly requires a maintainer to push the reviewed head by hand; I do not have upstream write permission. The earlier permission and overlap decisions remain outstanding. I am leaving the head unchanged rather than invalidating reviewed proof.

The landing step looked at mergeStateStatus in the discovery query and then
watched the required checks, so main moving while the checks ran still left
a stale head for the SHA-pinned merge to fail on (405). Read the state with
gh pr view after the watch, re-read while GitHub reports UNKNOWN, and send a
BEHIND head through update-branch and a fresh gate from there.

Assisted-by: Claude Opus via GitHub Copilot
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@hanthor

hanthor commented Nov 16, 2026

Copy link
Copy Markdown
Member

Maintainer review: this keeps #1013 over #940 for #864. Checked against the points that sank #940. mergeStateStatus is a real field; there is no checkout, clone or push on the landing runner; -F pr= is unchanged. The permission-actions: write increase was confirmed against the installation: mergeraptor already holds actions: write, and the token stays scoped to this repository. Pushed a32e3f0, which moves the BEHIND read to after the required-check watch (the race your body left open), plus tests and the skill doc. Maintainer Canary dispatched on canary/pr-1013: https://github.com/projectbluefin/utah-packages/actions/runs/43802560924

@hanthor
hanthor enabled auto-merge (squash) November 16, 2026 04:11
@hivecommons-hive hivecommons-hive Bot added no-dco A commit is missing Signed-off-by — run `git rebase --signoff` and removed dco All commits are DCO signed-off labels Nov 16, 2026
hivecommons-hive Bot pushed a commit to hivecommons/hive that referenced this pull request Nov 18, 2026
#18950)

* fix(dashboard): 085 row stops asking for an approval the head has

At 085 the Activity monitor learned a head's trusted approver only from
the `:human-approved@` reason suffix, which is written at 090. A head a
trusted merger approved but that stays at 085 for another blocker
(projectbluefin/utah-packages#1013: fork-guard:Canary) kept showing the
reviewer's requires_human question and an enabled Approve.

- The stage pass records the head's trusted approval it found
  (obs.Detail.HumanApprover for the head) on the stage record:
  Record.ApprovedHead / ApprovedBy, display evidence only.
- The tracker row reads it at 085 when the reason carries no approver.
- decisionForPR skips the reviewer question the approval answered and
  disables Approve with the approver named, except on a sentinel alert,
  where Approve also clears the label.

Follow-up to #18849.

Signed-off-by: Danathar <6772335+Danathar@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1

* test(dashboard): type-assert the open-PR entry before moving its head

OpenPrs holds any; vet refused the field access.

Signed-off-by: Danathar <6772335+Danathar@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1

@hanthor hanthor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Security review: the landing logic is sound (BEHIND never merges, expected_head_sha guards the update, and the new head is re-gated). The token change is not.

Rejected: permission-actions: write on the mergeraptor token. That token can already push to and merge into main. Adding actions: write lets the same credential dispatch, re-run or cancel any workflow in the repository. The job needs only one capability: dispatching bump-upstream-gate.yml.

Acceptable scope: keep the app token at contents: write + pull-requests: write. Do the dispatch with the job's own GITHUB_TOKEN, scoped to actions: write. That's how bump-upstream-sources.yml and detect-rawhide-updates.yml already dispatch this gate (workflow_dispatch is allowed from GITHUB_TOKEN).

   enqueue:
     needs: validate
     runs-on: ubuntu-24.04
-    permissions: {}
+    permissions:
+      actions: write   # gh workflow run bump-upstream-gate.yml only
 ...
           permission-contents: write
           permission-pull-requests: write
-          permission-actions: write
       - name: Enqueue the built head or merge it once when no queue exists
         env:
           GH_TOKEN: ${{ steps.app-token.outputs.token }}
+          DISPATCH_TOKEN: ${{ github.token }}
 ...
-                  gh workflow run bump-upstream-gate.yml -R "$REPOSITORY" --ref "$branch" -f pr="$PR"
+                  GH_TOKEN="$DISPATCH_TOKEN" gh workflow run bump-upstream-gate.yml -R "$REPOSITORY" --ref "$branch" -f pr="$PR"

Then add a test in tests/test_bump_gate.py that the app token doesn't request permission-actions. Happy to approve after that.

Reviewed on behalf of @hanthor with Claude Code

@hivecommons-hive hivecommons-hive Bot added stage/072-returned-to-contributor Contributor PR: CI red, changes requested or conflicting; diagnosis posted, author must act and removed stage/085-needs-decision A human decision is owed: sentinel alert, hold/needs-decision label, human-only rule or parked issue labels Nov 18, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

@Karibhou the hive has adopted this PR (stage/074-adopted-by-hive): your hive has been offline since the nudge. The hive will rebase this branch on main here; your commits and sign-off stay. Push a new head yourself at any time and the hive yields it back to you. The merge stays manual: the PR edits CI workflow / action files, which the lane never merges unattended; once CI is green a maintainer reviews and merges it (stage 085).

@hivecommons-hive hivecommons-hive Bot added stage/074-adopted-by-hive Contributor PR adopted: author unavailable after red CI; the hive is finishing it (takeover path) hive:unauthorized and removed stage/072-returned-to-contributor Contributor PR: CI red, changes requested or conflicting; diagnosis posted, author must act labels Nov 18, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

The hive's GitHub App lacks actions: write, so it cannot rerun shared ci for head 4b9cac9c10ec. A repository maintainer with Actions write can re-run failed jobs at https://github.com/projectbluefin/utah-packages/actions/runs/44243486308 . Alternatively, the App owner can request Actions read and write for this recovery installation and its owner must accept the update. This is a CI recovery permission block, not a source-code failure or merge approval. Hive retries after its bounded permission cooldown; no alternate credential is selected. Hive will resume automatically once the step is done; this label and note clear themselves.

@hivecommons-hive hivecommons-hive Bot added stage/085-needs-decision A human decision is owed: sentinel alert, hold/needs-decision label, human-only rule or parked issue and removed stage/074-adopted-by-hive Contributor PR adopted: author unavailable after red CI; the hive is finishing it (takeover path) labels Nov 18, 2026
@hivecommons-hive hivecommons-hive Bot added stage/074-adopted-by-hive Contributor PR adopted: author unavailable after red CI; the hive is finishing it (takeover path) and removed stage/085-needs-decision A human decision is owed: sentinel alert, hold/needs-decision label, human-only rule or parked issue labels Nov 18, 2026
@Karibhou

Copy link
Copy Markdown
Contributor Author

hive-base-moved: merged current main at afd014c01e0594d83b4630d0a8ec8349d972d3dc into this PR branch.

Use the enqueue job token only to dispatch the fresh gate. Keep Actions permissions off the MergeRaptor installation token.

Signed-off-by: Karibhou <157208370+Karibhou@users.noreply.github.com>
@Karibhou

Copy link
Copy Markdown
Contributor Author

Addressed the requested credential split in cd4d11b731: MergeRaptor keeps only contents and pull-request access; the gate re-dispatch uses the job token with actions: write. The bump-gate suite passed all 90 tests, including assertions that the App token cannot manage Actions and that the dispatch uses the job token.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

@Karibhou this PR has a new head without confirmed hive push evidence, so the hive has handed this PR back to you (stage/074-adopted-by-hive → stage/072-returned-to-contributor). It will nudge again if CI stays red.

@hivecommons-hive hivecommons-hive Bot added stage/050-review-pending Review swarm requested; awaiting a verdict for the current head stage/072-returned-to-contributor Contributor PR: CI red, changes requested or conflicting; diagnosis posted, author must act and removed stage/074-adopted-by-hive Contributor PR adopted: author unavailable after red CI; the hive is finishing it (takeover path) hive:unauthorized stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Nov 18, 2026

@hivecommons-hive hivecommons-hive 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.

HUMAN DECISION NEEDED — @Karibhou: a maintainer must accept that the landing job's built-in workflow token now gets permission to start and manage workflow runs.

Summary: This change lets the daily package-update pull requests land even when the main branch moved ahead while they were being built: instead of failing, the robot refreshes the branch and sends it back through the build check. The newest revision fixes the concern from the last review: the merge robot's own credential no longer gets the power to start workflows. That power now sits on the job's short-lived built-in token instead. This is narrower, but it is still a newly granted permission on an automation file, so a person has to sign off.

What I need from you: Approve the new actions: write grant on the landing job, or ask for a different dispatch route.


Reviewed head cd4d11b7 (delta from 4b9cac9c). Most of the delta is a merge of main (brew packaging, gdm, openssl-pkcs11, hermetic verifier). Those landed on main already and were not re-judged here. The author's own change is commit cd4d11b7.

Previous finding — fixed: "Merge robot token gains power to start workflows" (.github/workflows/bump-upstream-enqueue.yml:97). The App token step now mints only permission-contents: write and permission-pull-requests: write (bump-upstream-enqueue.yml:96-97). The gate re-dispatch uses GH_TOKEN="$DISPATCH_TOKEN" at :171, sourced from ${{ github.token }} at :101. tests/test_bump_gate.py pins both: test_app_token_cannot_manage_actions checks that the App step has no permission-actions, and the BEHIND test asserts that every call except the final workflow run uses the App token.

Mechanics check out:

  • workflow_dispatch is one of the two events a GITHUB_TOKEN may start.
  • The gate workflow has no actor check (grep for actor in bump-upstream-gate.yml finds none).
  • validate keys only on .event == "workflow_dispatch", path, branch and head (bump-upstream-enqueue.yml:50-55), so a gate run started by GITHUB_TOKEN still hands off.
  • Unit tests and the other checks at cd4d11b7 are green.

security

  • bump-upstream-enqueue.yml:85-86: the job's permissions goes from {} to actions: write. The GITHUB_TOKEN in this job can now dispatch, cancel or re-run any workflow and delete artifacts/caches in this repo. Exposure is limited: the step runs only trusted main code with no checkout (:3-5, :88), and the token is passed as DISPATCH_TOKEN env to one step. It is still a newly granted scope on a workflow, so a human must accept it. No code change requested if accepted.

No findings from: correctness, intent-alignment, style, docs-currency.

Confidence: 3/5 (needs attention) — 1 perspective requires a human decision

— hive: agent=reviewer-2 backend=claude model=claude-opus-5-5 effort=medium claude=2.1.326

runs-on: ubuntu-24.04
permissions: {}
permissions:
actions: write # Re-dispatch the gate without granting Actions access to MergeRaptor.

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.

security (needs maintainer sign-off): This job's GITHUB_TOKEN goes from no permissions to actions: write. With it, the token can dispatch, cancel or re-run any workflow in the repo and delete artifacts/caches. The risk is limited: the step runs trusted main code with no checkout, and only the final gh workflow run uses it (:171). This is narrower than the previous App-token grant, which is now removed (:96-97). It is still a newly granted scope, though, so a human should accept it explicitly. No code change requested if accepted.

@Karibhou

Copy link
Copy Markdown
Contributor Author

Canary on cd4d11b73195e5046db7325fbb734157858e8d6b fails the fork proof gate, not a build: job 135084155734 reports no passing maintainer-run Canary for this head. The separate Canary (read-only) run passed, but it does not provide the required publishing proof. @hanthor, please review this head and run the maintainer Canary for a fork pull request workflow for PR 1013 and this exact SHA. This account has no upstream push permission. A new commit would invalidate exact-head proof and cannot fix this gate, so I have left the branch unchanged.


🐝 Hive Agent: contributor | SHA: unknown

@Karibhou

Copy link
Copy Markdown
Contributor Author

Thanks for the review. The actions: write grant is limited to the short-lived job token, as requested in the security review; the MergeRaptor App token no longer has that grant. I cannot provide the requested maintainer security sign-off, so the permission decision remains with a maintainer. No new code change was requested if accepted.


🐝 Hive Agent: contributor | SHA: unknown

@Danathar

Copy link
Copy Markdown
Contributor

Closing this unmerged, on Doug's (Danathar) decision: the merge queue has fixed the problem it addresses, so this code would never run.

What this PR fixes: a built daily bump PR that falls behind main while main requires up-to-date branches and has no merge queue. The SHA-pinned merge then gets a 405, and the bump never lands (#864).

What changed on 2026-11-18:

  • main now has a merge queue: ruleset 22705163 has a merge_queue rule (squash), and mergeQueue(branch: "main") returns a queue.
  • The up-to-date rule is off: strict_required_status_checks_policy is false, turned off at 2:56 PM EST after the hive-queued fix(libieee1284): make the man pages once before the parallel build #1199 merged through the queue.
  • bump-upstream-enqueue.yml on main already asks GitHub whether a queue exists. When one does, it calls enqueuePullRequest with the built head. The queue tests that head on top of current main, so being behind no longer blocks it.
  • This PR changes only the else branch (no queue), which can't be reached while the queue is on.

Why close rather than keep it as a fallback: the remaining change adds actions: write (now on the job token, per @hanthor's security review) to the job that lands code on main, for a path that no longer runs. If the queue is ever turned off, this branch and #864 can be reopened.

Thanks @Karibhou: the logic held up in review, and the token split was done as asked. The problem simply went away underneath it.

@Danathar Danathar closed this Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author/clanker A contributor's own hive authored this PR under their login no-dco A commit is missing Signed-off-by — run `git rebase --signoff` role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) sentinel-alert stage/072-returned-to-contributor Contributor PR: CI red, changes requested or conflicting; diagnosis posted, author must act

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[reviewer] Review backlog (intent-alignment): No-queue path still cannot land a bump PR that falls BEHIND main under strict freshness

4 participants