Skip to content

os: realupgrade phase — an aged N-2 appliance upgraded through the dashboard, required in the release battery (#3911 PR B) #4193

Done

Description

@pithead-architect

What's the problem

The remaining scope of pithead#3911 is its PR B: a new opt-in realupgrade KVM phase (that issue's acceptance criteria 1-5 and 7, per the architect's standing ruling there). PR A (#3922) has merged — the cheap dashboard/fault-leg assertions, failure artefacts and the releasing.md binding. Today no KVM scenario upgrades a guest the way an owner's appliance is upgraded: crossupdate is opt-in, installs with a bare rauc install and stops minutes after commit; the update legs fake an older VERSION; no tier-4 row reads a rolled_back verdict or its blocking list. That gap let the 2026-11-02 field rollback of v2.0.2 pass every release job. Its root causes #3909 and #3910 are now fixed (PRs #3919 and #3914, merged), so the owner-level scenario phase is the reproduction proof for them.

What it impacts

Every appliance owner who takes an OS update — the default update path — and the release battery's assurance on it.

How I found it

This is a split chunk of #3911 handed to a local session whose group was too large; it carries the issue's own PR B under the architect ruling there (answers to that issue's seven questions are recorded there and baked into the criteria below).

How important is it

High (per #3911): the release battery gives false assurance on the default update path, and this phase is the proof #3909/#3910 stay fixed.

Acceptance criteria

  1. New phase tests/os/phases/realupgrade.sh, opt-in and excluded from --phase all, registered in tests/os/run.sh (phases block, the --phase usage list, source line and dispatch) so bench-ci's tier4 phase allowlist accepts it. It starts from the published N-2 GitHub release image (checksum verified, fetched the way crossupdate fetches its old image), provisions through the wizard, and updates to N-1 through the dashboard (check, download, verify, install, typed REBOOT), requiring outcome=updated and a committed slot.
  2. The guest is aged fresh every run from fixtures: a chain-data sentinel/pruned fixture, a warm Tor directory from a real boot, public-address-only test wallets, a config customized through the dashboard API (pinned dashboard host name, non-default stratum port, changed dashboard password), a certificate minted by the old version with a late ULA address (extending tests/os/image-upgrade-certificate-leg.sh), and at least one stratum client.
  3. The candidate is built from the exact SHA with the real bundle layout; images come by the digests the tree pins (never the LAN debug registry); cosign verification runs through the release's code path, signed with a test key in CI. If unpublished candidate digests need a staging-registry mirror, that part is infra and reported as such; the rest lands without it.
  4. Installed through the dashboard with a real in-flight flag, following every prompt an owner would: no reboot is offered while the new slot verifies; outcome=updated and no rolled_back; no reboot other than the ordered one; time-to-commit recorded against a named budget (the boot-gate timeout plus 50%).
  5. After commit, a named 10-minute soak window with one extra reboot: doctor passes without PITHEAD_BOOT_GATE=1, no failed units, slot good; config still saveable and unchanged; wallets, login and chain sentinels intact; TLS fingerprint and SANs unchanged; mDNS name resolves; the stratum client stays connected with accepted shares.
  6. Negative control B: a hard reset of the uncommitted slot rolls back with an explicit recorded cause, and the old version's configuration stays saveable (Dashboard asks for a second reboot while the new slot is verifying, which rolls back a healthy update #3909/A rolled-back update leaves config.json stamped by the newer version, so the old version blocks saving #3910 fixes are merged; read the tests PRs Refuse a second reboot while the new OS slot is still verifying (#3909) #3919/Defer the config_version stamp until the booted slot commits (#3910) #3914 already add and do not duplicate them — this asserts the owner-level scenario). Show each Dashboard asks for a second reboot while the new slot is verifying, which rolls back a healthy update #3909/A rolled-back update leaves config.json stamped by the newer version, so the old version blocks saving #3910-dependent assertion red at the shipped v2.0.2 commit (or with the fix reverted) and green on your head, quoting both runs.
  7. On any failure the job saves the failed boot's pithead-boot journal, the verdict JSON, grubenv and doctor output.
  8. Guest-less selftests for the new helpers under tests/os/selftest-*.sh, registered where CI runs them.
  9. The bench job is capped at 240 minutes: if the phase runs longer, split it into two jobs and say where. docs/dev/releasing.md lists the phase as a required job bound to the exact tag SHA, states the runtime, and requires crossupdate, provision and this phase to rerun after any post-battery change.

Possible solutions

  • Assemble from crossupdate.sh (start guest), update-dashboard.sh (dashboard door and download seam), update-healthgate-leg.sh (fault bundle) and image-upgrade-certificate-leg.sh (late address); drive and read the guest through the dashboard API, serial console and libvirt, since the release image has no SSH.
  • Traps to check first: tests/os/run.sh --help prints a fixed header range and pins the usage line — adding a phase touches both and has selftest coverage; docs/dev/releasing.md's status-recipe block is pinned by tests/integration/selftest/selftest-release-status-recipe.sh, whose stale pin aborts the whole selftest loop. N-2 images land in the job's own workspace or crossupdate's cache; creating a new persistent bench directory is a host change to report as infra, never to make.

Parent: #4160

Worker brief: Test tier: tier4-kvm, the realupgrade phase alone, one phase at a time, plus tiers 1-3 green for the selftests and run.sh registration.

Objective: land #3911's PR B — the new opt-in realupgrade phase with acceptance criteria 1-5 and 7 exactly as this child issue lists them (aged N-2 guest, dashboard install of the exact-SHA N-1 candidate with a real in-flight flag, prompt-following asserts, 10-minute soak with one extra reboot, hard-reset negative control with the #3909/#3910 asserts now that PRs #3919/#3914 have merged, failure artefacts, selftests, releasing.md requirement). The architect's limits are already baked into the criteria: fixtures-built aged state each run, published release assets with checksums for N-2, test cosign key in CI, named constants for the soak and commit budget, opt-in outside --phase all, and a report-as-infra escape for the staging-registry part of the candidate rule.

Register the phase in tests/os/run.sh (usage list included, or bench-ci refuses the phase at submit) and check the run.sh --help header pin and the releasing.md status-recipe pin before pushing. Show every new assertion and negative control red with its guard broken, then green, and quote the tier4-kvm jobs on the final head with unedited bench-ci evidence blocks; the phase may need two jobs under the 240-minute cap — say where. No comments in code. The PR body carries Closes #3911 on a line of its own plus its own child issue's keyword, and lists the Decisions taken inherited from the architect ruling.

Activity

  1. added this to the v2.0.5 milestone on Nov 17, 2026
  2. added
    bug
    dashboard
    appliance
    P1-user-facing
    needs-triage
    size:M
    on Nov 17, 2026
  3. pithead-developer commented on Nov 18, 2026

    @pithead-developer
    Contributor

    Grouped with #4191, but PR #4256 does not close it: Its proof is the new opt-in realupgrade tier4-kvm phase itself (up to 240-minute jobs, N-2 release-image fetch, aged fixtures) — a different bench tier and job than the tier4-e2e evidence this group's diff needs, and the acceptance criteria already anticipate splitting it across jobs. It needs its own session and its own jobs; a dedicated session for it has been started meanwhile.. Released for its own pick.

  4. pithead-developer commented on Nov 19, 2026

    @pithead-developer
    Contributor

    Implementation reconnaissance (local session, no code landed)

    The local session holding this issue completed the full seam survey before editing and is handing implementation on; nothing was pushed. Everything below was verified against the tree at eb3381937 (current develop-v2.0.5 tip). The group split applies: this issue keeps this branch for its own PR only.

    Registration checklist (mechanical, all verified)

    1. tests/os/run.sh: |realupgrade in the [--phase ...] usage printf (line 192 — bench-ci reads the phase vocabulary from this line at the submitted commit; bench_ci/catalogue.py:718 _KVM_PHASE_RE parses the checked-out file, so no bench-ci change is needed — the static KVM_PHASES tuple feeds only tier display and bench-config group checks), header Phases: entry stating it is not run by --phase all (mirror the crossupdate entry), re-count the sed -n '2,49p' range (nothing pins the number; wrong N silently truncates --help), source line with # shellcheck source= directive, and dispatch arm realupgrade) _run_phase realupgrade phase_realupgrade ;;. Do not add to the all) arm.
    2. tests/os/phases/realupgrade.sh: guard with # shellcheck shell=bash + : "${OS_RUN_SUITE:?source via the suite runner}" + OS_RESERVED_NODE_CONSUMER=0 (precedent phases/tor-heal.sh:1-5; selftest-provision-legs.sh pins the non-consumer selection).
    3. tests/os/selftest-run-modules.sh: in-place edits only to lines 4 (modules order — position must match the source lines), 5/12 (function completeness string — every top-level function of the new file, in source order), 69 (source the new file). File-budget ceiling: the file is exactly at its recorded 462 lines and ceilings only go down — zero net new lines.
    4. tests/os/selftest-marker-images.sh scans every non-selftest tests/os/*.sh for _build_image/_build_bundle markers; reuse candidate or add the marker to tests/os/dashboard-markers.json or CI fails.
    5. Selftests: make test-integration-selftest globs tests/os/selftest*.sh (Makefile:60) — a new file is picked up with no registration.
    6. Docs: tests/os/README.md §Phases and the stale list at line 468; docs/dev/repo-map.md opt-in-phase paragraphs near line 384; docs/dev/testing-strategy.md an opt-in-phase row (precedents at ~388, ~567).

    The releasing.md landmine

    tests/integration/selftest/selftest-release-status-recipe.sh executes both pinned ```bash blocks of docs/dev/releasing.md §Which gates are automated and asserts exact payload shape: `length == 8`, `.[0:7]` slice, `.[7]` as the e2e job, the 11-line URL trace diff, and the failed-leg `== 7` count. Adding a realupgrade submission as a ninth payload requires updating all of those plus the prose counts (releasing.md lines 429/502/562/566, the `KVM jobs:` printf line 498) and `docs/dev/appliance-release.md:568` ("the seven ... jobs"). Acceptance criterion 9 (required job bound to the exact tag SHA, post-battery rerun of crossupdate/provision/realupgrade) extends the sentence at releasing.md line 509. A new phase as its own job in the recipe is unavoidable; folding it into an existing `phases` array breaks whole-array equality pins.

    Reusable seams (the phase is an assembly, per the issue's own list)

    • Boot + wizard with no guest SSH: _vm_boot_disk (phases/boot.sh:240) then _wizard_provision_capture 0 (phases/update.sh:239) — token off $SERIAL, /auth//submit//api/handoff over HTTPS, yields DASH_USER/DASH_PASS. HARNESS_WALLET (lib/core.sh:30) is already the public-address-only address. Post-provision readiness without SSH must poll /api/state (phases/update-dashboard.sh:41-82 shows the readiness + .os_update.step shape) — provisioning_settled is SSH-based and cannot pre-upgrade run.
    • Dashboard update spine: _serve_update_dir + the os-update-test-base seam + releases-latest.json + aged_version + _os_step check/download/verify/install/reboot + verify-window os-reboot refusal probe + outcome=updated verdict wait (phases/update-dashboard.sh:84-399), in-flight flag read at line 285, persisted reboot-pending, boot-id discipline via _boot_id/_wait_new_boot.
    • Published-image fetch + checksum + cosign: phases/image-upgrade.sh:63-101 (fetch asset + .sig, cosign verify-blob with repo cosign.pub; fixtures/v1.20.0/generate.sh adds the sha256sum -c pin pattern). Appliance assets are pithead-os-v<V>.img.xz + <asset>.sha256 (scripts/release/package-appliance.sh:25,42). Derive N-2 as the greatest published tag below the tree's VERSION unless an env pin overrides.
    • Real bundle layout signed with a CI test key: tests/os/image-upgrade-bundle.sh sources scripts/release/bundle.sh (make_bundle) with COSIGN_ENABLED=1 and a generated key — but pulls stack images from $PITHEAD_REGISTRY (the LAN debug registry), which criterion 3 forbids. The realupgrade builder variant must take the five image refs from the tree's compose pins instead; the unpublished-digest/staging-mirror half is the issue's explicit report-as-infra escape.
    • Negative control B reads rolled_back + blocking list off the persisted verdict (os-update-state.json) after a virsh destroy mid-verify — update-dashboard leg 4 already proves the verify-window and refused-reboot probe; do not duplicate #3919/#3914 rows.

    Decisions the implementer must take early (cheap to probe, expensive to guess)

    1. RAUC trust on a published old slot. Bundles verify against the keyring baked at image build (os/rauc/mkbundle.sh:75, os/rauc/mkimage.sh:50); bench-ci itself refuses old_image caches "built with a different signing certificate". A dev-chain _build_bundle will not install onto a guest running the release image unless the test trust cert is planted into the scratch old-image copy offline before boot (the libvirt/qemu-nbd route the issue names) or options.old_image_commit (nightly-cache images, which answer SSH and trust the dev chain) is accepted as "fetched the way crossupdate fetches its old image". Pick one and record it in the PR body under Decisions.
    2. Where non-SSH aged state gets planted. os-update-test-base, chain sentinel and any backdating all need in-guest root before the upgrade; the wizard/dashboard APIs cannot write arbitrary paths. The offline scratch-image edit is the same class of honest seam as the nightly's baked test SSH key; document it.
    3. Stratum client across the update: the harness already sources tests/integration/lib/mergemine-probe.sh; a bench-host stratum client against the guest's port with accepted-share monotonicity (crossupdate's /api/state share read at phases/crossupdate.sh:258 is the pattern for the read side).

    Bench

    --phase realupgrade, timeout-minutes 240 (same window as tor-heal; the phase may need two jobs — say where, per criterion). Admission follows the usage line at the submitted SHA, so the first probe submission needs only this branch's head plus whatever old-image input the chosen decision requires.

  5. pithead-developer commented on Nov 20, 2026

    @pithead-developer
    Contributor

    Questions before work continues (answer here, then remove the question label):

    1. Leave Tor recovery: clear the stale directory cache and catch a stale consensus or onion-only outage #4261 and Dashboard: treat RigForge control status busy as a terminal retry-later outcome and show its reason (#3985 slice 1/2) #4255 out of this PR and keep only closes #4193 (plus KVM: add a real-appliance upgrade scenario to the release battery and rerun it on the exact published SHA #3911 as the brief says)? Default: yes. Dashboard: treat RigForge control status busy as a terminal retry-later outcome and show its reason (#3985 slice 1/2) #4255 is already implemented by open PR fix(control): handle rigforge busy status, mark rig ownership in e2e (#3985) #4023 (develop-v2.1.0 base; busy status handled in both pollers, with tier4-e2e evidence), so fixing it here would duplicate that work. Tor recovery: clear the stale directory cache and catch a stale consensus or onion-only outage #4261 is a Tor entrypoint, tor-recover and heal-ladder change that needs tier4-e2e Tor proof and builds on unmerged Tor auto-heal: advance past a rejected NEWNYM to state reset and restart (#4075) #4095. Putting it beside a 240-minute KVM phase would couple two unrelated proofs.

    2. RAUC trust for the published N-2 image: which seam counts as 'fetched the way crossupdate fetches its old image'? Release images only trust the signing keyring baked at their build. A candidate bundle built from this tree with a CI test key therefore will not install onto a published release image. Default: fetch the published pithead-os-v<N-2>.img.xz, verify its .sha256 and cosign signature as image-upgrade.sh does, then plant the test trust cert and the aged state into a scratch copy offline with losetup -Pf (the pattern tests/os/phases/rig.sh already uses; no new tool). The scratch copy is boot-identical to the release image apart from that cert, and I record the seam in the PR under Decisions. Alternative: take bench-ci options.old_image_commit (a nightly-cache image, which already trusts the dev chain and has a baked test SSH key). That is cheaper but is not the published release image criterion 1 names. Which do you want?

    3. Is it acceptable that the PR adds a ninth payload to docs/dev/releasing.md's pinned status recipe? Default: yes. That means updating selftest-release-status-recipe.sh (length 8 to 9, the slice and index pins, the URL-trace diff, the failed-leg count), the prose counts at releasing.md lines 429, 502, 562 and 566, and appliance-release.md:568 in the same change, with realupgrade as its own job bound to the tag SHA.

    4. Is this session's $16 budget enough, given that no guest can be run locally and every iteration is a bench job of up to 240 minutes? Default: yes for the draft PR with the phase, selftests, docs and the first targeted bench job, returning waiting on it. If you want the phase split into two jobs from the start (provision plus aged upgrade, then soak plus negative control B), say so now; otherwise I split only if the first job exceeds the 240-minute cap.

  6. added
    question
    on Nov 20, 2026
  7. pithead-architect commented on Nov 20, 2026

    @pithead-architect
    Author

    Ruling: Take your defaults, with the limits below. The architect's ruling on #3911 (2026-11-06) already closed the question rounds for this work: from here on, list each choice under "Decisions taken" in the PR body and come back only for a product decision. (1) Yes. Keep #4255 and #4261 out of this PR. The PR carries Closes #3911 and Closes #4193, each on a line of its own, and no keyword for either of the other two. Release them back to the queue with a one-line reason: #4255 is #3985 slice 1, which PR #4023 covers, and #4261 is Tor tier4-e2e work that builds on PR #4095. (2) Take the published-image seam. Fetch the published N-2 pithead-os-v<N-2>.img.xz and verify its .sha256 and cosign signature the way image-upgrade.sh does. Then patch a scratch copy in the job workspace offline with losetup -Pf, the pattern tests/os/phases/rig.sh already uses. Four limits apply. (a) Add the test trust next to the release trust, never in place of it, and do it in every anchor the N-2 update path checks: the RAUC keyring, plus the cosign public key the N-2 dashboard verifies with if that is a separate file. (b) Patch only when the candidate is test-signed. The rerun releasing.md requires on the signed release artefacts for the tag SHA must boot the published image unmodified. (c) The phase records the published image's sha256 and each path it planted. If the patched copy fails to boot, or the rootfs is integrity-protected so an offline edit cannot hold, stop and report what you saw. Do not switch to the nightly old_image_commit image: AC 1 names the published release. (d) Use only the job workspace or crossupdate's existing cache. Any new persistent directory on a bench is infra. (3) Yes. Add the payload to the status recipe and update every pin in the same change: selftest-release-status-recipe.sh (the length, slice and index pins, the URL-trace diff, the failed-leg count), the prose counts in docs/dev/releasing.md, and appliance-release.md:568. Bind it to the tag SHA. If the phase ends up as two jobs, that is two payloads, and the pins follow. (4) The session budget is the runner's business, not a question. Open the draft PR with the phase, selftests and docs, submit one targeted tier4-kvm realupgrade job on the head, and return waiting with it in bench_jobs. Don't split in advance. Do make the negative-control-B leg selectable on its own from the start, and log a timestamp for each leg, so that a split, if the first job shows the phase needs one, is a submit option and not a rework. Proof is unchanged: every new assertion and negative control is shown red with its guard broken (the #3909/#3910 ones at the shipped v2.0.2 commit or with the fix reverted) and green on your head, quoted with bench-ci evidence <id>@<sha>.

  8. removed
    question
    on Nov 20, 2026
  9. pithead-developer commented on Nov 21, 2026

    @pithead-developer
    Contributor

    Questions before work continues (answer here, then remove the question label):

    1. AC6 (F4274-1): may the green run of the rollback-cause rows be deferred, tracked in os: realupgrade phase fidelity gaps left by #4193 (aged Tor and ULA certificate, accepted shares, digest-pinned signed candidate, typed REBOOT) #4338, until a published N-2 carries the Dashboard asks for a second reboot while the new slot is verifying, which rolls back a healthy update #3909/A rolled-back update leaves config.json stamped by the newer version, so the old version blocks saving #3910 fixes? Default: no; I first try the reviewer's untried route, a head-built old slot with a lower VERSION baked into the image, for one or two bench runs, and come back if pithead-boot still records updated. The newest published tag, v2.0.3, predates the fixes, and a head-built old slot that shares the candidate's VERSION records updated after a hard reset (jobs 786 and 471).

    2. AC1 to AC5 (F4274-2): do you accept narrowing os: realupgrade phase — an aged N-2 appliance upgraded through the dashboard, required in the release battery (#3911 PR B) #4193 to what the phase proves, with the rest moved to os: realupgrade phase fidelity gaps left by #4193 (aged Tor and ULA certificate, accepted shares, digest-pinned signed candidate, typed REBOOT) #4338, and the PR keeping Part of #4193 instead of closing it? Default: yes. The items moved are the typed REBOOT (a UI-only gate with no API surface), the warm Tor and pruned-chain fixtures and the late-ULA certificate, the digest-pinned cosign-signed candidate (the staging-registry half of AC3 is infra), and accepted shares (the bench has no synced chain behind the proxy; the phase proves an accepted stratum connection).

    3. Limit (b) (F4274-4): do you accept that the phase always patches the scratch N-2 copy? It appends the test signer to the RAUC keyring beside the release cert, and sets /etc/pithead-variant=debug because the dev-chain candidate is a debug build and the dashboard refuses a variant change. Default: yes. The phase can only build a dev-signed candidate, so a 'patch only when test-signed' condition would never be false, and the unmodified signed-release boot is already proved by the release gate's provision and crossupdate jobs on signed artefacts.

  10. 2 remaining items

  11. removed
    question
    on Nov 21, 2026
  12. pithead-developer commented on Nov 27, 2026

    @pithead-developer
    Contributor

    Waiting on a transient artifact_read condition, not on another issue. bench-ci evidence 397@6e975c14f394f36c9d5bc30ca0edc90d5de80427 fails with 'Connection refused' on all five client retries, and again on my own retry after a minute. The runner re-checks it (first at 2026-11-27T07:45Z, at most 5 times).

  13. pithead-developer commented on Nov 27, 2026

    @pithead-developer
    Contributor

    Blocked on #4537. The PR is blocked on #4537. The only failed required check on head f6b8dc4 is Build image (dashboard), and this PR's code did not cause it. Trivy flags libzstd1 CVE-2026-124851 (HIGH, fixed in 1.5.7+dfsg-1+deb13u1) in the debian 13.7 base image (run 46040382195). The PR changes no Dockerfile or image input; its diff is limited to tests/os, tests/integration/selftest and docs. The fix is open as draft PR #4563 against develop-v2.0.5. Done: the realupgrade phase, selftests and docs, with passing tier4-kvm jobs 784, 605 and 787 and red job 603 quoted. After #4563 merges and closes #4537, I merge develop-v2.0.5 into this branch, wait for tiers 1-3 to go green, and run one realupgrade tier4-kvm job on the new head. Whoever merges #4563 unblocks it. I posted this on PR #4274.

    The runner resumes this issue when that one closes.

  14. added
    blocked
    on Nov 27, 2026
  15. removed
    blocked
    on Nov 28, 2026
  16. pithead-developer commented on Nov 28, 2026

    @pithead-developer
    Contributor

    Blocked on #4569. I am still blocked, now on the forward merge #4569. #4537 is closed, but its fix (#4604) landed on develop. develop-v2.0.5 receives it only through #4569 ("Forward-merge 2.0.4 into develop-v2.0.5"), which is still open. This branch already contains everything on origin/develop-v2.0.5 (tip 36c8af8), so there is nothing newer to merge. Build image (dashboard) stays red on head f6b8dc4 with the same libzstd1 CVE-2026-124851. I will not merge develop into a tests/docs PR, since that would pull in unrelated post-2.0.4 changes. Done: the phase, selftests and docs, with tier4-kvm jobs 784, 605 and 787 passed and red job 603 quoted. After #4569 merges: merge develop-v2.0.5 in, confirm tiers 1-3 are green, and run one realupgrade job on the new head. Whoever merges #4569 clears it. I posted this on PR #4274.

    The runner resumes this issue when that one closes.

  17. added
    blocked
    and removed
    blocked
    on Nov 28, 2026
  18. pithead-developer commented on Nov 28, 2026

    @pithead-developer
    Contributor

    Waiting on a transient bench_outage condition, not on another issue. bench-ci coordinator refuses every connection (Errno 61) for health, log 4679 and submit over ~40 minutes; the tier4-kvm realupgrade-negctl submit on 2757b1a was lost after 5 attempts, retry with idempotency key 2d9937ba-2f15-4aaa-8cf9-0c19fe75a1b1. The runner re-checks it (first at 2026-11-28T19:21Z, at most 5 times).

  19. pithead-developer commented on Nov 29, 2026

    @pithead-developer
    Contributor

    Merged in #4274.

  20. added a commit that references this issue on Nov 29, 2026
    c93d2aa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1-user-facingappliancebugdashboardneeds-triagesize:M

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions