Skip to content

fix(countme): read the booted image ref without running bootc (utah#1198) - #1689

Closed
Danathar wants to merge 2 commits into
mainfrom
fix/countme-no-bootc-status
Closed

Danathar wants to merge 2 commits into
mainfrom
fix/countme-no-bootc-status

Conversation

@Danathar

@Danathar Danathar commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

On hold: pending the utah confirmation PR

Do not merge until the utah test PR (masking CountMe) shows that CountMe is the source of the boot-time SELinux denials in projectbluefin/utah#1198. That PR is projectbluefin/utah#1247.

Summary

  • projectbluefin-countme ran bootc status --json at boot, as root, from an ordinary service (unconfined_service_t).
  • bootc's SELinux probe (a chcon to a test label) is then denied mac_admin. That logs two AVC denials on every boot of Utah.
  • This change stops running bootc. The script now reads the booted image ref from files:
    1. the booted deployment's .origin file (found through ostree= on the kernel command line, container-image-reference=, with the ostree transport and docker:// stripped);
    2. for composefs hosts, /sysroot/state/deploy/<id>/<id>.origin from composefs= / composefs.digest= (the same lookup as utah#1220 ublue-booted-image-sync);
    3. otherwise the boot-time snapshot /run/ublue-os/booted-image.
  • Behaviour is otherwise unchanged: same stream rules, and Bluefin Server still falls back to its image-tag when no booted image is found.
  • The unit comment "so bootc status can query status" is updated. Root stays, to read the .origin file.

I did not use /usr/libexec/ublue-booted-image, because it runs bootc status first.

Tests

tests/test_projectbluefin_countme.bats now fakes a deployment (cmdline, symlink, .origin) instead of stubbing bootc. A bootc stub on PATH leaves a marker, and every test fails if it was called. New cases cover each transport form, a registry port, the snapshot fallback, origin winning over the snapshot, and a missing .origin. bats is not installed on my machine, so CI runs them. I ran the script by hand once against a fake deployment and it reported dakota/main:stable.

Not proven yet

That CountMe is the source of the denials (the utah test PR checks it), and the composefs lookup, which is copied from utah#1220 but not run on a real composefs host.

Context: projectbluefin/utah#1198, evidence run https://github.com/projectbluefin/utah/actions/runs/43615159948

🤖 Generated with Claude Code

https://claude.ai/code/session_01WcWm7tJ5iop2b4GMkKSPAv

projectbluefin-countme ran `bootc status --json` from an unconfined
service. bootc's SELinux probe (chcon to a test label) was denied
mac_admin, logging two AVC denials on every boot
(projectbluefin/utah#1198).

Read the ref from the booted deployment's .origin file (found through
ostree= on the kernel command line), falling back to the boot-time
snapshot /run/ublue-os/booted-image. Non-bootc hosts keep their
image-tag fallback.

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

Copy link
Copy Markdown
Contributor Author

/hold

@Danathar Danathar added the hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 15, 2026
@github-actions github-actions Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 15, 2026
@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: castrojo, danathar

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Follow the composefs=/composefs.digest= command-line arguments to
/sysroot/state/deploy/<id>/<id>.origin, the same lookup utah#1220 uses,
and avoid a stray error when the snapshot file is missing.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WcWm7tJ5iop2b4GMkKSPAv
Signed-off-by: Danathar <Danathar@users.noreply.github.com>
@hivecommons-hive hivecommons-hive Bot added the author/clanker A contributor's own hive authored this PR under their login label Nov 15, 2026
@Danathar

Copy link
Copy Markdown
Contributor Author

The utah confirmation is in: with CountMe skipped, the review VM logged bootc chcon AVC denials: none (run 43762243257). So this change removes the boot-time mac_admin denials that keep utah's Post-Testing E2E red (projectbluefin/utah#1198). Marking it ready for review. It stays on hold.

@Danathar
Danathar marked this pull request as ready for review November 15, 2026 23:44
@hivecommons-hive hivecommons-hive Bot added 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 15, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

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

Failing checks:

  • E2E — composed common suite / e2e / GNOME — common

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.

Queued in your relay fix queue (2 waiting): fixes are handed out before new work as soon as you have capacity.

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

Summary: This looks correct to me. The script no longer runs bootc, and the .origin lookup gives the same ref that bootc status gave. I found two small notes, and neither blocks the PR.

What I checked at 9460399:

  • ostree path: ostree=/ostree/boot.N/<stateroot>/<csum>/<serial> resolves through readlink -f to …/deploy/<csum>.<serial>. Adding .origin gives the deployment's keyfile. The unit is ProtectSystem=strict with ProtectHome=yes (projectbluefin-countme.service:29-30), so /sysroot stays readable. The comment change at :25-26 is accurate.
  • Transport stripping: The prefix stripping in booted_ref() covers all five transports that the new test runs. The # shortest match on ostree-remote-*:*: stops after the remote name, and docker:// is removed afterwards. So the result matches the old .status.booted.image.image.image.
  • Fallbacks: When the ostree= path has no .origin, the script falls through to the snapshot. When there is no snapshot, ref is empty and the existing "no booted image" branch runs unchanged. So Dakota/Utah live ISOs are still not counted, and Server still uses image-tag.
  • Test guard: The bootc stub plus the teardown check [ ! -e bootc.called ] makes every test enforce the "never runs bootc" rule.

Notes (info only):

  1. The comment in booted_ref() says the composefs lookup is "the same lookup as utah's ublue-booted-image-sync". On utah main, that script still calls bootc status --json and has no .origin/composefs lookup. Maybe the comment refers to an unmerged utah change. If so, please name it; if not, please reword the comment. I did not find anything in the repo that confirms the /sysroot/state/deploy/<id>/<id>.origin layout. The new composefs test checks the script against that layout, but it does not prove that bootc writes it there.
  2. In tests/test_projectbluefin_countme.bats, the "Bluefin Classic and LTS never contact the service" loop has run "${SCRIPT}" indented at 4 spaces instead of 8. This is only cosmetic.

The failing GNOME — common E2E job failed on #1690 too, at around the same time. I did not confirm that it is the shared #1688 portal problem, but nothing in this diff touches the session or the portals.

Confidence: 5/5 (safe)

— hive: agent=reviewer-2 backend=claude model=claude-opus-5-5 claude=2.1.325

@castrojo
castrojo enabled auto-merge November 18, 2026 02:59
@Danathar

Copy link
Copy Markdown
Contributor Author

/hold cancel

Releasing my hold; this is ready. The utah confirmation came in on 11-15 (no bootc chcon AVC denials), the hive review found nothing blocking, and castrojo approved it.

What's left before it can merge:

@mergeraptor mergeraptor Bot removed the hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 18, 2026
@hivecommons-hive hivecommons-hive Bot added role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) and removed stage/stalled In its current stage longer than expected labels Nov 18, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

Superseded by hive: re-authored as #1708 with the same commits and sign-off because CI stayed red and the author was unavailable. This PR is closed; if #1708 fails, hive reopens it.

@hivecommons-hive hivecommons-hive Bot closed this Nov 18, 2026
auto-merge was automatically disabled November 18, 2026 18:42

Pull request was closed

@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 18, 2026
hivecommons-hive Bot pushed a commit to hivecommons/hive that referenced this pull request Nov 19, 2026
…e when the fixer can push it (#19308)

* 🐛 adoption: keep a same-repo PR in place across a base workflow change when the App can push it

canPushToPRBranch ran baseSyncTouchesWorkflows before its same-repo
check, and baseSyncTouchesWorkflows assumed the App can never push a
base-sync that carries a .github/workflows/ change. That holds for a
fork head (the fork is not in the installation), but on a branch of the
base repository the push lands once the installation grants
workflows: write. So the hive superseded same-repo PRs it could have
adopted in place, closing them and losing their approvals
(projectbluefin/common#1689 -> #1708, #1690 -> #1710).

A same-repo head now supersedes on a base workflow change only when
hgithub.Client.WorkflowsPushable is false (no grant, or no trusted or
merger lane serving the repo). Fork heads and compare failures behave as
before.

Adopted-PR recovery also logs a refused update-branch with the merge
sweep's reasons (fork-workflow-update, workflow-permission) instead of
the catch-all update-branch-failed, which is what
projectbluefin/utah-packages#1173 and projectbluefin/actions#752 showed:
both are fork heads that no App grant can update.

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

* 🐛 adoption: gate in-place workflow base-sync on the fixer's own token, not any lane

Review of the previous commit: WorkflowsPushable asks whether any
trusted or merger lane serves the repo, but an adopted head that
conflicts (or stays red) is pushed by the fallback fixer that
routeConflictFixAgent picks, scanner. A hive with ci-maintainer at
trusted and scanner at contributor tier passed the gate, adopted in
place, and then scanner's push was refused, the #12865 dead end.

- pkg/github: FallbackFixAgent is the one name for that fixer, used by
  routeConflictFixAgent and the adoption sweep. AgentWorkflowsPushable
  reports an agent's own capability: its tier asks for Workflows
  (SetWorkflowsSelfPushFunc) and the installation grants
  workflows: write.
- automerge: baseSyncTouchesWorkflows keeps a same-repo head in place
  only when AgentWorkflowsPushable(FallbackFixAgent) holds. The comment
  now says the premise of #12865 changed (#14664 found the grant;
  pr_merge_state.go fences only forks).
- Tests: TestAgentWorkflowsPushable for the real predicate (contributor
  fixer with the grant, trusted fixer, token client, read-only grant,
  failed read); TestAdoptedRecoveryForkWorkflowRefusalNamed drives
  recoverByUpdateBranch end to end on a fork head.
- Docs and changelog name the fixer condition and the DCO in-place
  repair it also unlocks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1
Signed-off-by: Danathar <6772335+Danathar@users.noreply.github.com>
hivecommons-hive Bot pushed a commit to hivecommons/hive that referenced this pull request Nov 19, 2026
…ase-red memory is published (#19311)

* 🐛 base red: read the base tip until the memory is published after a restart

The base-red index and #18842's per-base memory live in the process and
are first published when the first CI-enriched enumeration after a start
finishes. On knuckle that took about 25 minutes on 2026-11-18 (restart at
1:26 PM EST, first base-branch-red route again at 1:53 PM). In that window
every base read as not red, so PRs red only on main's own E2E check went to
070/072, and projectbluefin/common#1689 and #1690, already past their 072
grace, were adopted at 1:42 PM and superseded (#1708, #1709 -> #1710),
losing a maintainer's approval, into copies red for the same reason.

Until the memory is published (new StageLabelPolicy.BaseRedRememberedReady,
wired to whether stageBaseRedMemory has been stored), foldBaseRed reads the
base tip's checks itself when the memory does not cover a red head's red
checks: one combined-status plus check-run listing per base, cached per
base for humanChecksTTL (10 min), failures included. A head whose every red
check is red on the tip, touching no CI-owning path, is base red and goes
to 050/060 instead of 072, so it is neither nudged nor adopted. An
unreadable tip keeps today's author-facing route. Once the memory is
published nothing changes and no tip is read.

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

* 🐛 base red: hold automatic adoption until the base-red memory is published

Review follow-up to the startup base tip read. That read can still miss the
base's red: a tip run still queued or in progress, a tip with no run of the
check, or a failed read. Adoption cannot be undone, so while
StageLabelPolicy.BaseRedRememberedReady is false adoptContributorPR now
returns before anything is recorded for an automatic adoption, logging
"adoption deferred until the base-red memory is published" once per head
and due reason. An operator's Adopt now and an adopt-supersede request are
not held. This costs no API and also covers the unpublished shared-CI
incident index. The 072/nudge side keeps the tip read.

A failed base tip read is now reused for a minute (baseTipRedErrorTTL)
instead of the full humanChecksTTL.

Scope: this covers common#1689 -> #1708 (and #1690's first adoption into
#1709 at 1:42 PM EST). #1690 -> #1710 at 3:38 PM was the orphan re-adoption
path, which does not read base red; that is out of scope here.

Docs and changelog now describe the deferral, that the tip read counts
commit statuses as well as check runs (unlike the enrichment's read), and
the 3 to 27 minute window.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1
Signed-off-by: Danathar <6772335+Danathar@users.noreply.github.com>
HuntedRaven7 pushed a commit to HuntedRaven7/common-1 that referenced this pull request Nov 20, 2026
…198) (projectbluefin#1708)

Supersedes projectbluefin#1689 (adopted after CI went red and the contributor was
unavailable; original commits by @Danathar preserved).

This branch is projectbluefin#1689's head `9460399a87e7` as pushed by @Danathar (fork
`projectbluefin/common`), unchanged. Last lane reason on the original:
`optional-check-failing:E2E — composed common suite / e2e / GNOME —
common`.

**Hive fix agent:** rebase this branch on `main`, fix the failing checks
/ review asks, and push to THIS branch. Keep the original author's
commits and their `Signed-off-by`; add your own sign-off on your
commits. Do not open another PR.

---------

Signed-off-by: Danathar <Danathar@users.noreply.github.com>
Co-authored-by: Danathar <Danathar@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. author/clanker A contributor's own hive authored this PR under their login dco All commits are DCO signed-off hive/superseded role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/074-adopted-by-hive Contributor PR adopted: author unavailable after red CI; the hive is finishing it (takeover path)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants