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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ All notable changes to **omp-web** (`@kahme247/ompweb`) are documented in this f
A cluster session now runs with this machine's settings (`config.yml`, without the machine-specific keys), `models.yml`, MCP servers, skills, task agents, rules and context files, commands, prompts, hooks, extensions, custom tools, `secrets.yml`, `.env`, the agent environment variables of Settings → System, and the installed plugins, whichever member it runs on. A change made here, in Settings or on disk, reaches the members within about a minute and before every session start on a member. Every cluster session start carries this machine's version: a start that must run on one member is refused with the reason when its files cannot be applied, and new sessions are placed only on members with the current configuration and plugins; a session recovered after a daemon restart, or started by another ompweb server, runs on whatever is on the member's disk, and running sessions are not restarted. A mirrored directory becomes equal to this machine's. The member's backup holds only what the host had when it joined: a file it adds or edits afterwards is deleted at the next apply, not backed up. Settings that describe the machine itself stay the member's own as they were when the host joined (see the README). A host holds one ompweb server's configuration: a host already in another server's cluster cannot join (409 `host_in_other_cluster`), and a member that also runs sessions for another server runs them on this one's configuration. The configuration contains secrets, which are written to every member's disk, readable by the daemon's user only; the hooks, extensions, tools and plugins in it run on every member, and this machine can already start omp with full tool access there. Each file is limited to 5 MiB and the configuration to 50 MiB; a configuration over a limit, or one that cannot be read, is not mirrored at all, a cluster session start on a member is refused (409 `cluster_config_invalid`), placement skips every member, and Settings names the file. Each download has a 30 s limit including the body (a 5 MiB file needs roughly 1.4 Mbit/s). An apply is refused on a member where `~/.agents` is a symbolic link, and the mirrored directories and the backup must be on one filesystem. The reverse proxy must pass `/api/hosts/cluster-config/manifest` and `/api/hosts/cluster-config/file/<hash>` without its own authentication, at exactly these paths (unlike the broker's prefix).
Plugins are installed (this needs `bun` and network access on the member), removed and enabled or disabled on each member by `omp plugin`: npm plugins are pinned to this machine's version, marketplace plugins have no version pin in omp, and a failing install leaves the member not current and is retried. Leaving puts the member's own configuration and plugins back; if that fails Settings says so, and it is retried while the host is linked. Revoking a member does the same: its daemon puts its own configuration back at once if it is connected, otherwise the next time it reaches this machine. **Settings → Hosts** shows each member's state (same as the master, updating, failed with the reason, held by another server, needs an update) and the MCP server commands that are not installed there, and names the file when this machine's configuration cannot be mirrored (the member lines then do not say updating). For a session on another member, the MCP, Skills, Plugins and Agents screens act on this machine's user-level configuration, and say they apply to every member, as does Settings → System next to the agent environment variables in a cluster session; MCP shows that session's live status read-only, and the session's MCP switches, reload and Skills diagnostics are not available there. `GET /api/plugins`, `POST /api/plugins`, `GET /api/skills`, `POST /api/skills/check` and `POST /api/skills/update` now accept a request without `cwd` for the user level, and `GET /api/mcp?attach=1` reads a running session's live MCP status without starting one. A provider in `models.yml` that points at this machine's own address, MCP servers started by a command, and API keys written as an environment-variable name or `!command` need what they refer to on each member.
- **Cluster membership in Settings.** There is one cluster, the first pool in `pools.json`, and this machine is its master. Each linked host has an **In the cluster** switch in **Settings → Hosts**; turning it on asks for the folder on that host where the cluster keeps the checkouts it creates and says what changes, turning it off asks for confirmation. A host can join while it is online, on link protocol 10, answering `gitOrigins` and running omp 15.13.1 or newer (a member always uses this machine's provider logins); otherwise the switch is disabled and says why. While this machine is not a member yet, any join adds it too: the switch then also needs this machine's daemon ready, and the dialog says that this machine's Git projects become cluster projects whose new sessions start on any member with capacity (currently Linux hosts only, so a macOS or Windows master runs none itself). Joining matches the host's Git projects to cluster projects by repository, so the same repository on several members is one project and its sessions are listed together (`git@github.com:a/b.git` and `https://github.com/a/b` match); adding a cluster project by another URL form of a repository it already has returns that project. A created cluster project keeps the name and alias the host showed (its folder name when it had none), and a visible checkout makes a matching hidden cluster project visible again. Projects without a single Git `origin`, subfolders and linked worktrees stay on their node. A host too slow to report its Git remotes within the time limit keeps the remaining projects on its node; leaving and joining again retries them. Leaving unbinds the matched projects, so they are listed under the host again, and keeps the checkouts the cluster created and the projects it gained from the host; hide any you do not want. Revoking a member removes it from the cluster the same way; while `pools.json` cannot be read, the revoke is refused. A pool disabled through the API takes no new sessions, so this machine's Git projects moved into it cannot start any. The rest of this machine's omp configuration is mirrored to members too (see the entry above). New: `PUT`/`DELETE /api/hosts/[id]/cluster`, and the host operation `gitOrigins`.
- **The sidebar groups the cluster.** The cluster is one group: its projects first, then the projects of its members that could not join, each marked with its node's name; a new session there starts on that node. Members no longer have a group of their own, and standalone hosts keep theirs.
- **The sidebar groups the cluster.** The cluster is one group holding its projects and the projects of its members that could not join, each marked with its node's name, in the sidebar's sort and pin order; a new session there starts on that node. Members no longer have a group of their own, and standalone hosts keep theirs.
- **Cluster members use this machine's provider logins.** A member always runs its sessions with this machine's provider logins, whatever its own **Use this server's provider logins** setting says; Settings shows that toggle on and disabled. It is computed from membership, so leaving brings the host's own setting back. If `pools.json` cannot be read, session starts on a host are refused rather than started with other logins. Cluster placement skips a member whose daemon cannot take these logins (below link protocol 9, or a link that does not share) before preparing a checkout there.
**Before upgrading:** after this update, every linked host already in the first pool uses this machine's provider logins (it can read their access tokens and stored API keys) without a confirmation having been shown. This includes a first pool disabled through the API, and a host added to the first pool later through `PUT /api/hosts` or by editing `pools.json`. Each linked member needs an updated ompweb host daemon (link protocol 9 at that release; cluster members now need link protocol 10, see the first entry) and omp 15.13.1 or newer; until its daemon is updated, cluster placement skips that member, and a start fails when no other member is eligible. Before updating, remove a host that should not receive the logins from the first pool using `PUT /api/hosts` or editing `~/.omp/agent/omp-web/pools.json`; the old version has no membership switch.
- **Hosts can use the server's provider logins.** **Settings → Hosts** has a per-host toggle, **Use this server's provider logins**, off by default; turning it on asks for confirmation. Sessions started on that host then use the logins stored on the ompweb server instead of the host's own, through `omp auth-broker serve` on the server and a loopback forwarder in the host daemon. The host token never enters an omp process's environment, and OAuth refresh tokens never leave the server machine; the host can read current access tokens and stored API keys. Starting a session on a sharing host needs a daemon on link protocol v9 and omp 15.13.1 or newer, and is refused otherwise rather than falling back to the host's own logins. Custom providers in `models.yml`, environment-variable API keys and omp settings are not shared. A reverse proxy must let `/api/hosts/broker/` through without its own authentication, response buffering or redirects.
Expand Down Expand Up @@ -48,6 +48,7 @@ All notable changes to **omp-web** (`@kahme247/ompweb`) are documented in this f

### Fixes & Improvements

- **Sorting, pinning and reordering work in the cluster's sidebar group.** The group listed the cluster's shared projects first whatever the sort, and Move up/down, drag and pins only worked among projects of the same machine, so a pinned or alphabetically earlier project of a member could not move above a shared one. The group is now one list: the chosen sort, pins and manual order apply across shared projects and every member's own projects.
- **Git commands stay on the folder's own repository.** A host daemon started from a Git hook or with `GIT_DIR` set in its environment no longer runs Git status, file search, worktree, clone or pool preparation against that other repository. The Git panel of a bare repository now reports "not a Git repository" instead of failing. On Windows pool workers, a long creation ID no longer makes preparation fail on Git's path-length limit, and the reported CPU busy time no longer counts interrupt time twice.
- **Multiple-choice questions show which options are already checked.** When omp asks one checkbox question at a time, each option now shows ☑ or ☐, and screen readers announce "checked" or "not checked". Before, every option looked unchecked, so tapping an option the agent had pre-checked unchecked it instead. In the composer, tapping a checkbox option now toggles it at once instead of waiting for **Next**, so choosing **Done selecting** next can no longer drop it. This needs an omp that sends checkbox state on `select` requests (can1357/oh-my-pi#18929); older omp versions show the options as before.
- **Reuse unchanged chat Markdown during streaming.** Markdown bodies skip rendering when their props are unchanged, while relevant tool-result changes still refresh their message. Back/forward session navigation requests the selected session instead of downloading the full session list.
Expand Down
45 changes: 38 additions & 7 deletions components/SessionSidebar.presentation.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ test("a pinned project row names its node; other rows carry no node label", () =
}
});

test("the sidebar lists a cluster's pool projects before its members' pinned projects, and marks an offline node", async () => {
test("the sidebar orders a cluster's pool projects and its members' projects as one list, and marks an offline node", async () => {
const original = { fetch: globalThis.fetch, Worker: globalThis.Worker, SharedWorker: globalThis.SharedWorker, matchMedia: window.matchMedia };
globalThis.Worker = FakeWorker;
globalThis.SharedWorker = undefined;
Expand All @@ -107,14 +107,21 @@ test("the sidebar lists a cluster's pool projects before its members' pinned pro
{ id: "h1", label: "Build box", status: "offline", hostVersion: null, serverVersion: 9 },
];
const pools = [{ id: "cluster", label: "Cluster", enabled: true, members: [{ hostId: "local" }, { hostId: "h1" }], projects: [] }];
globalThis.fetch = async (input) => {
const writes = [];
globalThis.fetch = async (input, init = {}) => {
const url = new URL(String(input), "http://localhost");
if (url.pathname === "/api/hosts") return Response.json({ hosts: hostRows, pools });
if (url.pathname === "/api/projects" && init.method === "PATCH") {
const body = JSON.parse(init.body);
writes.push(body);
// The first store refuses: the others are still written.
return body.poolId ? Response.json({ error: "Pool registry unavailable" }, { status: 503 }) : Response.json({ projects: [] });
}
if (url.pathname === "/api/projects") {
return Response.json({ projects: [
{ path: "/a", hostId: "h1" },
{ path: "/l", hostId: "local" },
{ path: "pool:cluster:x", poolId: "cluster", projectId: "x", name: "shared", origin: "git@example.com:o/shared.git" },
{ path: "/a", hostId: "h1", sortOrder: 2 },
{ path: "/l", hostId: "local", sortOrder: 0 },
{ path: "pool:cluster:x", poolId: "cluster", projectId: "x", name: "shared", origin: "git@example.com:o/shared.git", sortOrder: 1 },
] });
}
if (url.pathname === "/api/sessions") return Response.json({ sessions: [] });
Expand All @@ -127,13 +134,37 @@ test("the sidebar lists a cluster's pool projects before its members' pinned pro
}));
await waitFor(() => assert.equal(container.querySelectorAll(".sidebar-project-identity").length, 3));
const names = [...container.querySelectorAll(".sidebar-project-identity")].map((button) => button.textContent);
assert.ok(names[0].startsWith("shared"), `the cluster's own project comes first: ${names.join(" | ")}`);
assert.ok(names[1].startsWith("a") && names[2].startsWith("l"), names.join(" | "));
// Manual order across the pool's registry and each member's: no store goes first.
assert.deepEqual(names.map((name) => name[0]), ["l", "s", "a"], names.join(" | "));
const pinned = screen.getByRole("button", { name: /On Build box/ });
assert.ok(pinned.textContent.includes(translate("hostsConfig.statusOffline")), "an offline node shows its status");
const reason = container.querySelector(`[id="${pinned.getAttribute("aria-describedby")}"]`);
assert.ok(reason?.textContent.includes("Build box"), "the button is described by the unavailable reason");
assert.ok(screen.queryByRole("button", { name: /On This machine/ }), "this machine's pinned project names its node");

// Moving this machine's project below the pool's one writes the moved positions, one batch per store; the
// offline member's project keeps its position, so its store gets no request.
const errors = [];
const originalError = toast.error;
toast.error = (message) => { errors.push(message); };
try {
fireEvent.click(container.querySelectorAll(`[aria-label="${translate("commandPalette.actions")}"]`)[0]);
fireEvent.click(await screen.findByRole("menuitem", { name: translate("projects.moveDown") }));
await waitFor(() => assert.equal(errors.length, 1));
assert.deepEqual(errors, [translate("projects.reorderFailed")]);
assert.deepEqual(writes, [
{ poolId: "cluster", updates: [{ projectId: "x", sortOrder: 0 }] },
{ updates: [{ cwd: "/l", sortOrder: 1 }] },
]);
// Moving the offline member's own project would change its store: refused before anything is written.
fireEvent.click(container.querySelectorAll(`[aria-label="${translate("commandPalette.actions")}"]`)[2]);
fireEvent.click(await screen.findByRole("menuitem", { name: translate("projects.moveUp") }));
await waitFor(() => assert.equal(errors.length, 2));
assert.match(errors[1], /Build box/);
assert.equal(writes.length, 2, "nothing written for a move that needs an offline member");
} finally {
toast.error = originalError;
}
} finally {
cleanup();
globalThis.fetch = original.fetch;
Expand Down
Loading
Loading