Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ All notable changes to **omp-web** (`@kahme247/ompweb`) are documented in this f

## [Unreleased]

### Fixed

- **A linked host on 0.7.1 or older updates normally again.** Once this server's own release was published, Settings → Hosts refused the normal update of an older linked host's daemon with "This host requires explicitly approved recovery": the forced-recovery method the server now offers such a host was applied to every update, not only to **Force update**. A normal update goes through that host's own updater again. This machine's older daemon is still updated with **Force update**, as before.

## [v0.7.2] - 2026-11-18

### Upgrading from 0.7.1 or older
Expand Down
9 changes: 9 additions & 0 deletions lib/hosts/host-updates-route.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,19 @@ import test, { after } from "node:test";
const dir = mkdtempSync(join(tmpdir(), "ompweb-host-updates-route-"));
const previous = process.env.PI_CODING_AGENT_DIR;
process.env.PI_CODING_AGENT_DIR = dir;
// This server's own release is published, so an old daemon also offers forced recovery (hub.ts, recoveryHelperRelease).
// Served here: on GitHub it exists once the version under test is released, and a normal update must still be normal.
const realFetch = globalThis.fetch;
globalThis.fetch = async (url, init) => {
const tag = /^https:\/\/api\.github\.com\/repos\/[^/]+\/[^/]+\/releases\/tags\/(.+)$/.exec(String(url))?.[1];
if (!tag) return realFetch(url, init);
return Response.json({ tag_name: decodeURIComponent(tag), draft: false, assets: [{ name: "ompweb-linux-x64.tar.gz", digest: `sha256:${"a".repeat(64)}` }] });
};
const hub = await import("./hub.ts");
const { linkHost, linkLocalHost } = await import("./link-driver.test-helper.mjs");
const { HostOpError, MIN_LINK_PROTOCOL_VERSION, LINK_PROTOCOL_VERSION } = await import("./link-protocol.ts");
after(() => {
globalThis.fetch = realFetch;
hub.flushLinkSamples();
if (previous === undefined) delete process.env.PI_CODING_AGENT_DIR;
else process.env.PI_CODING_AGENT_DIR = previous;
Expand Down
4 changes: 3 additions & 1 deletion lib/hosts/hub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1823,7 +1823,9 @@ export async function updateHostSoftware(id: string, target: HostUpdateTarget, v
}
const candidate = checked[target];
const link = linkFor(id);
const recovery = candidate.forceMethod === "recovery" || options.phase !== undefined && candidate.supportsTwoPhaseUpdate !== true;
// This machine's old daemon is updated only by recovery, which Force confirms. A linked host's old daemon still updates
// itself for a normal update: the recovery helper its Force uses is offered beside that, not instead of it.
const recovery = candidate.forceMethod === "recovery" && (options.force === true || id === LOCAL_HOST_ID) || options.phase !== undefined && candidate.supportsTwoPhaseUpdate !== true;
const pinnedRecovery = options.releasePin !== undefined && recovery;
if (!matching && (!candidate.updateAvailable || !(options.force ? candidate.canForceUpdate || candidate.canUpdate : candidate.canUpdate) || candidate.availableVersion !== version && !pinnedRecovery)) {
// An omp update names its blocker (ompweb_update_active, omp_install_active...) for a caller that must not read English.
Expand Down
9 changes: 9 additions & 0 deletions lib/hosts/upgrade-shim.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,20 @@ import test, { after } from "node:test";
const dir = mkdtempSync(join(tmpdir(), "ompweb-upgrade-shim-"));
const previous = process.env.PI_CODING_AGENT_DIR;
process.env.PI_CODING_AGENT_DIR = dir;
// This server's own release is published, so an old daemon also offers forced recovery (hub.ts, recoveryHelperRelease).
// Served here: on GitHub it exists once the version under test is released, and a normal update must still be normal.
const realFetch = globalThis.fetch;
globalThis.fetch = async (url, init) => {
const tag = /^https:\/\/api\.github\.com\/repos\/[^/]+\/[^/]+\/releases\/tags\/(.+)$/.exec(String(url))?.[1];
if (!tag) return realFetch(url, init);
return Response.json({ tag_name: decodeURIComponent(tag), draft: false, assets: [{ name: "ompweb-linux-x64.tar.gz", digest: `sha256:${"a".repeat(64)}` }] });
};
const hub = await import("./hub.ts");
const { linkHost, upgradeSocket, until } = await import("./link-driver.test-helper.mjs");
const { LINK_PROTOCOL_VERSION } = await import("./link-protocol.ts");
const { getRpcSession } = await import("../rpc-manager.ts");
after(() => {
globalThis.fetch = realFetch;
hub.flushLinkSamples();
if (previous === undefined) delete process.env.PI_CODING_AGENT_DIR;
else process.env.PI_CODING_AGENT_DIR = previous;
Expand Down
Loading