Skip to content

fix(updates): run the installed release under a launcher from before the rename - #1723

Merged
devswha merged 2 commits into
mainfrom
fix/update-check-v05
Oct 23, 2026
Merged

devswha merged 2 commits into
mainfrom
fix/update-check-v05

Conversation

@devswha

@devswha devswha commented Oct 23, 2026 •

Copy link
Copy Markdown
Owner

Problem

Updating in the app from 0.4.13 to the next release breaks the handover to the new release's
supervisor. An update never replaces
the running launcher (server/managed.ts), so after the install the 0.4.13 launcher starts the new
release's supervisor. That launcher names the checkout HERDR_WEB_SOURCE_ROOT and looks for the
active release only under ~/.config/herdr-web-ui/updates/<hash>/.

The new supervisor first moves ~/.config/herdr-web-ui to ~/.config/ovis (#1648), then accepts a
saved release only under the new path. The current.json the 0.4.13 supervisor wrote names
~/.config/herdr-web-ui/.../release-*, so the new supervisor ignores it and starts the bridge from
the source checkout, which is still 0.4.13. That bridge reads HERDR_WEB_BOOT_ID, not
OVIS_BOOT_ID, so it fails the supervisor's startup health check. The new supervisor exits before
it is ready, and the launcher falls back to the 0.4.13 supervisor, which shows "The updated
supervisor failed to start". By then the state dir has already moved out from under the launcher.
The same failure repeats on every later update. A new supervisor that did get to install would not
help either: the new supervisor
records the release under ~/.config/ovis/..., the 0.4.13 launcher rejects that path and starts
its own supervisor, and that one rejects it too.

Change

  • server/legacy-env.ts: legacyLauncherStateDir(env) tells whether a launcher from before the
    rename started this supervisor (HERDR_WEB_SOURCE_ROOT set, OVIS_LAUNCHER unset). If one did,
    it returns that launcher's state dir (HERDR_WEB_STATE_DIR, else
    $XDG_CONFIG_HOME/herdr-web-ui). The helper sits in this file because it is already in
    CARRY_OVER, the conventions test's list of files allowed to use the old names.
  • server/supervisor.ts: under such a launcher, the supervisor does not move the state dir. It
    uses the old dir for app state and update state, and hands that dir to its bridge as
    OVIS_STATE_DIR, so the bridge does not move it either. The move waits for a launcher of this
    version, which runs once the app starts from an updated source checkout or plugin.
  • server/supervisor.ts, server/legacy-env.ts (withLegacyNames): under such a launcher, the
    supervisor also hands its bridge the old names of what it sets (HERDR_WEB_MANAGED,
    HERDR_WEB_BOOT_ID, HERDR_WEB_STATE_DIR, HERDR_WEB_REVISION). When a saved release fails to
    start, the supervisor falls back to the source checkout, and under an old launcher that checkout
    is 0.4.13, whose bridge reads only the old names. Without them it could not answer the health
    check. After a second update, the old launcher's own fallback is the previous release's
    supervisor, which does the same thing, so the app stayed down. Even a bridge that did come up
    would not be managed, so it could not update again.
  • server/managed.ts: the launcher sets OVIS_LAUNCHER=1, so the supervisors it starts keep moving
    the state dir as before.

The candidate fix put the same logic in supervisor.ts, but that file is not in CARRY_OVER, so
the "names from before Ovis" conventions test fails on it. Moving the logic into legacy-env.ts
keeps the conventions test passing without editing it.

Test

server/legacy-env.test.ts gets three supervisor tests and a mapping test. Each supervisor test runs the real runSupervisor and the real
Updater against a git fixture shaped like a 0.4.13 install that has just installed a release. The
bridge's start is recorded and its health check is answered.

  • Started the way the 0.4.13 launcher starts it, the supervisor runs the installed release, and the
    state stays in herdr-web-ui. Before this fix, the bridge started from the source checkout:
    Expected: …/config/herdr-web-ui/updates/<hash>/release-next, Received: …/checkout.
  • Started by the 0.4.13 launcher with a saved release that fails, the supervisor falls back to the
    source checkout and hands that bridge HERDR_WEB_BOOT_ID, HERDR_WEB_MANAGED,
    HERDR_WEB_STATE_DIR and HERDR_WEB_REVISION. In the stand-in, the source checkout's bridge
    reads only the old names, as 0.4.13's does. On 492f1da this test fails: the bridge in
    …/checkout cannot answer the boot id it was given.
  • Started by a launcher of this version, the supervisor still moves the state dir to ovis and
    leaves a link at the old path.

bun run check fast passes.

Manual check with the real 0.4.13 launcher: a clone checked out at tag v0.4.13 ran
bun server/managed.ts against an installed release under a temp XDG_CONFIG_HOME and the
isolated ovis-test herdr session.

  • With the release at current main, the release's supervisor logs "The new bridge failed its
    startup health check." The launcher then falls back to the 0.4.13 supervisor, and the state dir
    has already been moved and replaced by a link.
  • Two updates with a release that fails (scripted, /tmp/ovis-qa-two-updates.ts). The real
    0.4.13 launcher installs two releases through /api/updates. The second release's bridge
    passes its install check but exits at its next start, under its own supervisor.
    • On 492f1da: release 2's supervisor falls back to the 0.4.13 source bridge, which fails the
      health check. The launcher then falls back to release 1's supervisor, which fails the same way,
      and the launcher exits 1. The app is down.
    • On this head: the source bridge answers, and the app is up on 0.4.13. /api/updates reports
      it as managed with no error, so the user can update again, and the launcher stays up.
  • With the release at this branch, /api/health served the release's revision from
    the release's own supervisor, with no fallback. ~/.config/herdr-web-ui stayed a real directory,
    and current.json was kept.

@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 15 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
📥 Commits

Reviewing files that changed from the base of the PR and between 464fda5 and 0131fbb.

📒 Files selected for processing: 5
  • changelog.d/update-from-before-rename.md
  • server/legacy-env.test.ts
  • server/legacy-env.ts
  • server/managed.ts
  • server/supervisor.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@devswha

devswha commented Oct 23, 2026

Copy link
Copy Markdown
Owner Author

Merge-pass review (head 492f1da), by a gate reviewer running a different model than the author's. This changes the update path that every installed user goes through. I'm not merging it until rollback is safe.

What the review found fine:

  • The normal handover works under the real v0.4.13 launcher, for the first update and for later ones.
  • The PC that already moved to ~/.config/ovis and the new-launcher case (no legacy env) both work.
  • Paths from env are validated, and legacyLauncherStateDir does not misdetect launchers.
  • Eight migration tests pass, and LSP diagnostics are clean.

Please fix before merge:

  1. Rollback after the second update can leave the app down (server/supervisor.ts ~63-65 and ~134-141).
    • What happens: if the new supervisor's health check on the saved release fails, it deletes current.json and starts the 0.4.13 source bridge with only OVIS_BOOT_ID set. That bridge reads HERDR_WEB_BOOT_ID (v0.4.13:server/index.ts), so its health check fails too.
    • Why it doesn't recover: the 0.4.13 launcher's fallback loop (v0.4.13:server/managed.ts) then retries its previous supervisor. After two updates, that supervisor is itself a new one. It hits the same missing record and the same bridge it can't talk to, and the launcher exits instead of restoring service.
    • Evidence so far: the reviewer reproduced the boot-id mismatch directly and traced the rest of the sequence, but did not run it end to end.
    • Fix: when recovery starts the old source bridge, set HERDR_WEB_BOOT_ID as well as OVIS_BOOT_ID, or otherwise keep the old bridge's contract. Then add a test, or a scripted QA run, for this path: the real v0.4.13 launcher, two updates, and a failing saved release.

Also: the PR description's validation names two test files that don't exist (server/supervisor.test.ts, server/managed.test.ts). Please correct it.

Once the fix is in and the checks are green, this goes back in the merge queue. It's a server/ behaviour change, so it also needs another CodeRabbit review.

@devswha

devswha commented Oct 23, 2026

Copy link
Copy Markdown
Owner Author

Thanks. Both points are addressed in 0131fbb.

1. Rollback after the second update can leave the app down: fixed.

  • Cause: confirmed end to end, as you traced it. The 0.4.13 bridge reads its settings only under the old names. That covers not just HERDR_WEB_BOOT_ID but also HERDR_WEB_MANAGED (without it update-api.ts treats the bridge as unmanaged, so even a bridge that came up could not update again), HERDR_WEB_STATE_DIR and HERDR_WEB_REVISION.
  • Fix: when a launcher from before the rename started the supervisor, launch() now hands the bridge every setting it sets under both names, through withLegacyNames in server/legacy-env.ts. That file is in CARRY_OVER, so the old names stay in a file that is allowed to use them. A launcher of this version gets only the OVIS_* names, as before. The same launch() serves the fallback in activate()'s catch, so that rollback is covered too.
  • Regression test: in server/legacy-env.test.ts, "falls back from a release that fails to the 0.4.13 checkout, telling its bridge what it reads". It runs the real runSupervisor and Updater under the 0.4.13 launcher's environment with a saved release that fails. In the stand-in, the source checkout's bridge reads only the old names, as 0.4.13's does. On 492f1da it fails: "the bridge in …/checkout cannot answer the boot id it was given". On 0131fbb it passes.
  • Scripted QA: the real v0.4.13 launcher, run from a clone at tag v0.4.13, against the isolated ovis-test herdr session. It does two real in-app installs through /api/updates. Release 2 passes its install check, then its bridge fails at its next start under its own supervisor.
    • On 492f1da, the health sequence was up:R1 → down → up:null → down → up:null → down. The log shows release 2's supervisor falling back to the source checkout and failing the health check. The launcher then falls back to release 1's supervisor, which fails the same way, and the launcher exits 1.
    • On 0131fbb, the app comes back up on the 0.4.13 source revision. /api/updates reports managed: true with no error, and the launcher keeps running.
  • Checks: bun run check fast passes. A gate reviewer on another model re-ran the regression test against the reverted supervisor.ts, and also checked the QA artifacts. It approved.

2. PR description: the body named only server/legacy-env.test.ts, not server/supervisor.test.ts or server/managed.test.ts. I've refreshed it anyway: it now covers the rollback fix, the new test and the two-update QA run.

This commit changes behaviour in server/, so it needs a fresh CodeRabbit review.

@devswha

devswha commented Oct 23, 2026

Copy link
Copy Markdown
Owner Author

Merge pass: reviewed in place of a CodeRabbit review, which was rate-limited. This is the update path every installed user goes through.

  • First gate review (different model than the author's): blocker B1. After the second update, a failing saved release started the 0.4.13 source bridge with only OVIS_BOOT_ID. That bridge reads HERDR_WEB_BOOT_ID, so the launcher exited instead of recovering.
  • Fixed in 0131fbb: the old bridge now gets its settings under the old names.
  • The re-review approved it. It traced the handover end to end against the real v0.4.13 launcher and bridge code (two updates, then recovery), and confirmed the new-launcher path uses only the new names. 20 tests pass, both typechecks pass, and the regression fails on the pre-fix supervisor. The PR description's test-file names are corrected.
    All required checks are green and no review thread is open.

@devswha
devswha merged commit 9aca793 into main Oct 23, 2026
18 checks passed
@devswha
devswha deleted the fix/update-check-v05 branch October 23, 2026 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant