Skip to content

feat(hosts): transparent host pools - #443

Merged
andrebrait merged 37 commits into
ompweb-dev:mainfrom
andrebrait:feat/transparent-host-pool
Nov 11, 2026
Merged

andrebrait merged 37 commits into
ompweb-dev:mainfrom
andrebrait:feat/transparent-host-pool

Conversation

@andrebrait

Copy link
Copy Markdown
Collaborator

Summary

Adds transparent host pools: a configured pool of worker hosts appears in ompweb as one target. New independent sessions are placed on an eligible worker by effective capacity and get an isolated worktree there; after placement, the owning worker stays authoritative for resume, files, terminal, uploads, artifacts, rename and delete.

  • Capacity and placement: workers sample and report effective capacity; pools rank members by it (lib/hosts/capacity.ts, pool-selection.ts, pools.ts, pool-starts.ts).
  • Pooled projects: a pool project registers a Git origin, not a central clone; the chosen worker prepares its checkout through guarded host operations, with clone reservations across processes (lib/pooled-projects.ts).
  • Durable creation: retries reuse one creation identity, so a start is never duplicated; adoption and pooled initialization are bounded.
  • Owner-bound surfaces: workspace filesystem operations route through the session's owning host, with source-ownership checks.
  • UI: pooled placement is transparent in the sidebar and new-session screen; composer drafts and uploads survive owner resolution.
  • Worker maintenance: ompweb host status|drain|resume over a private Unix socket (lib/hosts/host-control.ts).
  • Link protocol 8: pool capacity, creation identity and preparation are gated on v8. MIN_LINK_PROTOCOL_VERSION stays 4, so v7 daemons keep working for non-pool features.
  • Also bumps @xmldom/xmldom to 0.8.15 (DOCX parser vulnerabilities).

The README documents pools and worker maintenance.

Deployment state

This branch (at d6f2e170, an ancestor of this head) already runs in the maintainer's production: ompweb-api plus three ompweb-host daemons, pool proxmox-ai enabled with two protocol-8 workers. This PR's head adds one merge of current main (no rewrite).

Testing

  • bun test --parallel --timeout 30000 on d6f2e170: 3674 pass, 0 fail.
  • On this merge with the default 5 s timeout: 3681 pass, 11 fail. 10 of the 11 fail identically on main on the same machine (5 s timeouts of real-daemon suites). The 11th, lib/hosts/pool-starts.test.mjs, passes with --timeout 30000 (15/15).

Squashed from origin/fix/live-reply-streaming (027fedc) onto upstream/main.
… language in the file viewer

Squashed from origin/fix/file-viewer-diff-highlight (95253f2) onto upstream/main.
Squashed from origin/fix/live-reply-streaming (80c8a32) onto upstream/main.
Squashed from origin/fix/literal-dollars (3768658) onto upstream/main.
…ansparent-host-pool

# Conflicts:
#	graphify-out/graph.json
@coderabbitai

coderabbitai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Too many files!

This PR contains 116 files, which is 16 over the limit of 100.

To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1f5fa0ad-5adb-49e2-a0ac-b012fa519192
Commits

Reviewing files that changed from the base of the PR and between 3f77de3 and f932710.

Files ignored due to path filters: 1

  • package-lock.json is excluded by !**/package-lock.json
Files selected for processing: 116

  • CHANGELOG.md
  • README.md
  • app/api/agent/[id]/bash-output/route.ts
  • app/api/agent/new/route.ts
  • app/api/file-index/route.ts
  • app/api/files/[...path]/route.ts
  • app/api/git/diff/route.ts
  • app/api/git/status/route.ts
  • app/api/hosts/route.ts
  • app/api/projects/route.ts
  • bin/bun-runtime.test.mjs
  • bin/omp-web-host.test.mjs
  • components/AppShell.tsx
  • components/BtwPanel.tsx
  • components/ChatInput.host-files.test.mjs
  • components/ChatInput.tsx
  • components/ChatInput.uploads.test.mjs
  • components/ChatWindow.tsx
  • components/DirectoryPicker.tsx
  • components/FileExplorer.tsx
  • components/FileViewer.markdown-links.test.mjs
  • components/FileViewer.tsx
  • components/GitChangesPanel.tsx
  • components/HostsConfig.test.mjs
  • components/MarkdownBody.tsx
  • components/MessageView-hub-panel.tsx
  • components/MessageView.tsx
  • components/RightPanel.tsx
  • components/SessionSidebar-helpers.test.mjs
  • components/SessionSidebar-helpers.ts
  • components/SessionSidebar-rows.tsx
  • components/SessionSidebar.tsx
  • components/SubagentTranscriptDialog.tsx
  • components/TabBar.tsx
  • graphify-out/graph.json
  • hooks/useAgentSession.rpc.test.mjs
  • hooks/useAgentSession.ts
  • hooks/useHostRows.ts
  • lib/agent-tools.test.mjs
  • lib/agent-tools.ts
  • lib/api-contract.test.mjs
  • lib/api-utils.ts
  • lib/event-stream-hub.ts
  • lib/file-access.ts
  • lib/file-authorization.ts
  • lib/file-paths.test.mjs
  • lib/file-paths.ts
  • lib/hosts/capacity.test.mjs
  • lib/hosts/capacity.ts
  • lib/hosts/channel-lifecycle.ts
  • lib/hosts/daemon-channels.test.mjs
  • lib/hosts/daemon-channels.ts
  • lib/hosts/daemon-link.ts
  • lib/hosts/daemon-links.test.mjs
  • lib/hosts/daemon-runtime.test.mjs
  • lib/hosts/daemon-update-safety.test.mjs
  • lib/hosts/daemon.test.mjs
  • lib/hosts/daemon.ts
  • lib/hosts/files-owner.integration.test.mjs
  • lib/hosts/host-cli.ts
  • lib/hosts/host-control.test.mjs
  • lib/hosts/host-control.ts
  • lib/hosts/host-resume.test.mjs
  • lib/hosts/host.ts
  • lib/hosts/hosts-route.test.mjs
  • lib/hosts/hub.test.mjs
  • lib/hosts/hub.ts
  • lib/hosts/link-protocol.test.mjs
  • lib/hosts/link-protocol.ts
  • lib/hosts/local-host.ts
  • lib/hosts/no-direct-local.test.mjs
  • lib/hosts/pending-requests.test.mjs
  • lib/hosts/pending-requests.ts
  • lib/hosts/pool-selection.test.mjs
  • lib/hosts/pool-starts.test.mjs
  • lib/hosts/pool-starts.ts
  • lib/hosts/pools.ts
  • lib/hosts/registry.ts
  • lib/hosts/session-index.test.mjs
  • lib/hosts/session-index.ts
  • lib/hosts/session-ops.test.mjs
  • lib/hosts/session-ops.ts
  • lib/hosts/update-fixture.test-helper.mjs
  • lib/hosts/upload-retention.test.mjs
  • lib/hosts/upload-retention.ts
  • lib/hosts/uploads.test.mjs
  • lib/hosts/uploads.ts
  • lib/hosts/workspace-clone.test.mjs
  • lib/hosts/workspace-clone.ts
  • lib/hosts/workspace-git.test.mjs
  • lib/hosts/workspace-ops.ts
  • lib/hosts/workspace-reads.test.mjs
  • lib/hosts/workspace-reads.ts
  • lib/hosts/workspace-roots.ts
  • lib/hosts/workspace-unc.test.mjs
  • lib/hosts/workspace-upload.test.mjs
  • lib/i18n/locales/en.json
  • lib/i18n/locales/ja.json
  • lib/i18n/locales/zh-CN.json
  • lib/navigation-history.test.mjs
  • lib/navigation-history.ts
  • lib/pooled-projects.test.mjs
  • lib/pooled-projects.ts
  • lib/project-clone.ts
  • lib/project-ordering.ts
  • lib/project-registry.test.mjs
  • lib/project-registry.ts
  • lib/projects-clone-route.test.mjs
  • lib/rpc-manager.test.mjs
  • lib/rpc-manager.ts
  • lib/session-local-files.test.mjs
  • lib/types.ts
  • lib/uploads.ts
  • lib/workspace-http.ts
  • lib/workspace-memory.ts
  • lib/workspace-types.ts

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 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

@kilo-code-bot

kilo-code-bot Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Code Review Roast 🔥

Verdict: 4 Issues Found | Recommendation: Address before merge

Overview

Severity Count
🚨 critical 4
⚠️ warning 0
💡 suggestion 0
🤏 nitpick 0
Issue Details (click to expand)
File Line Roast
lib/hosts/daemon.test.mjs 430 Template literal missing backticks — ${...} is a syntax error
lib/hosts/daemon.test.mjs 443 Same missing-backticks error on dynamic import
lib/hosts/daemon.test.mjs 444 Same missing-backticks error on dynamic import
lib/hosts/daemon.test.mjs 445 Bare ${...} expression — same syntax error (lines 445-448)

🏆 Best part: The Windows fsync guard in pool-starts.ts is thoughtful and correct — cross-platform directory fsync is a genuine pain point handled well.

💀 Worst part: lib/hosts/daemon.test.mjs is riddled with ${...} without backticks — the file won't parse, so none of the new test code can run.

📊 Overall: Like a test suite written in a language that doesn't exist — the intent is clear, but the syntax needs fixing before any of it can execute.

Files Reviewed (7 files)
  • lib/hosts/daemon.test.mjs - 4 issues
  • lib/hosts/pool-starts.ts - 0 issues
  • lib/hosts/session-ops.ts - 0 issues
  • lib/pooled-projects.test.mjs - 0 issues
  • lib/projects-clone-route.test.mjs - 0 issues
  • components/ChatInput.uploads.test.mjs - 0 issues
  • CHANGELOG.md - 0 issues
Previous Review Summaries (2 snapshots, latest commit af6b133)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit af6b133)

Verdict: No Issues Found | Recommendation: Merge

I loaded the incremental diff expecting at least a stray semicolon or a misplaced brace, then got a 4-file, 23-line refactor that does one thing: hoist a private pathApi helper out of pool-starts.ts, export it from pools.ts, and wire the two call sites through it. The body of the function is byte-for-byte identical to what lived in pool-starts.ts before — same win32.isAbsolute(path) && !posix.isAbsolute(path) ? win32 : posix ternary, same return type. No behavior changed, no import left dangling (posix/win32 correctly dropped from pool-starts.ts; join/dirname usages there are all the legitimate Array.join/getAgentDir/mkdirSync kind).

The one genuinely new line — pathApi(member.projectsRoot).join(member.projectsRoot, project.id) in app/api/projects/route.ts:128 — is the whole point of the PR slice, and the added test in pool-selection.test.mjs:167 ("worker paths use the worker's path rules, whatever OS this server runs on") pins it down properly, including the rejection cases (D:\, D:work, D:\work\..\other, /srv/../etc, /). I re-derived each rejection by hand against the new absoluteRoot and they all hold.

Oh wait, this part is actually clean. I need to sit down. I had the flamethrower warmed up for a cross-platform path-handling regression and there isn't one.

📊 Overall: Like a furniture mover who carries every piece through the door instead of drywalling the living room — dull to watch, and the house is still standing.

Files Reviewed (4 files)
  • app/api/projects/route.ts — 1 changed line, helper hoist at line 128
  • lib/hosts/pool-selection.test.mjs — 15 added lines, new path-rule coverage at lines 167-180
  • lib/hosts/pool-starts.ts — 5 changed lines, helper removed, imports trimmed
  • lib/hosts/pools.ts — 6 changed lines, pathApi exported, absoluteRoot rewritten at lines 45-48

Previous review (commit 7b94481)

Verdict: No Issues Found | Recommendation: Merge

I showed up with a flamethrower, a magnifying glass, and trust issues, then stared at a 115-file “small refactor” that adds transparent host pools, durable creation, link protocol v8, and a maintenance CLI. This PR didn’t just move furniture — it renovated the whole house while the tenants were still inside. I was ready to roast, but from the diff/state I could inspect, the changed lines behaved themselves annoyingly well.

Review context: I analyzed the current PR state (headRefOid 7b94481fce6f8e0f03ccb38cb1baa6adb27b0b84), full diff, and existing PR comments/reviews. No existing Kilo inline comments were present. I did not post inline comments because this environment limited some follow-up file reads and I could not confidently verify every suspected issue against the current diff-line/right-side anchors required for safe inline publication. No verified, diff-commentable defects were identified from the evidence available in this pass.

📊 Overall: Like a deployment runbook written by someone who’s actually been paged at 3 AM — dense, intimidating, and surprisingly responsible.

Files Reviewed (115 files)
  • README.md
  • app/api/agent/[id]/bash-output/route.ts
  • app/api/agent/new/route.ts
  • app/api/file-index/route.ts
  • app/api/files/[...path]/route.ts
  • app/api/git/diff/route.ts
  • app/api/git/status/route.ts
  • app/api/hosts/route.ts
  • app/api/projects/route.ts
  • bin/bun-runtime.test.mjs
  • bin/omp-web-host.test.mjs
  • components/AppShell.tsx
  • components/BtwPanel.tsx
  • components/ChatInput.host-files.test.mjs
  • components/ChatInput.tsx
  • components/ChatInput.uploads.test.mjs
  • components/ChatWindow.tsx
  • components/DirectoryPicker.tsx
  • components/FileExplorer.tsx
  • components/FileViewer.markdown-links.test.mjs
  • components/FileViewer.tsx
  • components/GitChangesPanel.tsx
  • components/HostsConfig.test.mjs
  • components/MarkdownBody.tsx
  • components/MessageView-hub-panel.tsx
  • components/MessageView.tsx
  • components/RightPanel.tsx
  • components/SessionSidebar-helpers.test.mjs
  • components/SessionSidebar-helpers.ts
  • components/SessionSidebar-rows.tsx
  • components/SessionSidebar.tsx
  • components/SubagentTranscriptDialog.tsx
  • components/TabBar.tsx
  • graphify-out/graph.json
  • hooks/useAgentSession.rpc.test.mjs
  • hooks/useAgentSession.ts
  • hooks/useHostRows.ts
  • lib/agent-tools.test.mjs
  • lib/agent-tools.ts
  • lib/api-contract.test.mjs
  • lib/api-utils.ts
  • lib/event-stream-hub.ts
  • lib/file-access.ts
  • lib/file-authorization.ts
  • lib/file-paths.test.mjs
  • lib/file-paths.ts
  • lib/hosts/capacity.test.mjs
  • lib/hosts/capacity.ts
  • lib/hosts/channel-lifecycle.ts
  • lib/hosts/daemon-channels.test.mjs
  • lib/hosts/daemon-channels.ts
  • lib/hosts/daemon-link.ts
  • lib/hosts/daemon-links.test.mjs
  • lib/hosts/daemon-runtime.test.mjs
  • lib/hosts/daemon-update-safety.test.mjs
  • lib/hosts/daemon.test.mjs
  • lib/hosts/daemon.ts
  • lib/hosts/files-owner.integration.test.mjs
  • lib/hosts/host-cli.ts
  • lib/hosts/host-control.test.mjs
  • lib/hosts/host-control.ts
  • lib/hosts/host-resume.test.mjs
  • lib/hosts/host.ts
  • lib/hosts/hosts-route.test.mjs
  • lib/hosts/hub.test.mjs
  • lib/hosts/hub.ts
  • lib/hosts/link-protocol.test.mjs
  • lib/hosts/link-protocol.ts
  • lib/hosts/local-host.ts
  • lib/hosts/no-direct-local.test.mjs
  • lib/hosts/pending-requests.test.mjs
  • lib/hosts/pending-requests.ts
  • lib/hosts/pool-selection.test.mjs
  • lib/hosts/pool-starts.test.mjs
  • lib/hosts/pool-starts.ts
  • lib/hosts/pools.ts
  • lib/hosts/registry.ts
  • lib/hosts/session-index.test.mjs
  • lib/hosts/session-index.ts
  • lib/hosts/session-ops.test.mjs
  • lib/hosts/session-ops.ts
  • lib/hosts/update-fixture.test-helper.mjs
  • lib/hosts/upload-retention.test.mjs
  • lib/hosts/upload-retention.ts
  • lib/hosts/uploads.test.mjs
  • lib/hosts/uploads.ts
  • lib/hosts/workspace-clone.test.mjs
  • lib/hosts/workspace-clone.ts
  • lib/hosts/workspace-git.test.mjs
  • lib/hosts/workspace-ops.ts
  • lib/hosts/workspace-reads.test.mjs
  • lib/hosts/workspace-reads.ts
  • lib/hosts/workspace-roots.ts
  • lib/hosts/workspace-unc.test.mjs
  • lib/hosts/workspace-upload.test.mjs
  • lib/i18n/locales/en.json
  • lib/i18n/locales/ja.json
  • lib/i18n/locales/zh-CN.json
  • lib/navigation-history.test.mjs
  • lib/navigation-history.ts
  • lib/pooled-projects.test.mjs
  • lib/pooled-projects.ts
  • lib/project-clone.ts
  • lib/project-ordering.ts
  • lib/project-registry.test.mjs
  • lib/project-registry.ts
  • lib/projects-clone-route.test.mjs
  • lib/rpc-manager.test.mjs
  • lib/rpc-manager.ts
  • lib/session-local-files.test.mjs
  • lib/types.ts
  • lib/uploads.ts
  • lib/workspace-http.ts
  • lib/workspace-memory.ts
  • lib/workspace-types.ts
  • package-lock.json

Reviewed by free · Input: 109.9K · Output: 19.9K · Cached: 316.5K

A Windows web server rejected every POSIX worker path because pool
validation used the server's own path module.
Windows cannot open a directory for fsync, so the creation journal was
always reported unavailable. The synced file and atomic rename remain the
commit point there. Session export now routes .cmd/.bat OMP launchers
through the same wrapper as RPC sessions and version checks.
Real Git fixtures keep drive letters out of SSH URLs and run a local
upload-pack, clone cancellation waits for socket close events instead of
marker files, capacity emulation no longer spoofs the platform for child
spawns, and upload owner teardown awaits its requests and closes its stores.
Comment thread lib/hosts/daemon.test.mjs
os.availableParallelism = () => 8;
os.loadavg = () => [load1, 0, 0];
syncBuiltinESMExports();
const capacityUrl = ${JSON.stringify(new URL("./capacity.ts", import.meta.url).href)};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 The Roast: You wrote ${...} without backticks. JavaScript doesn't know what a template literal is without the template part. This line is a syntax error — the test file cannot be parsed, let alone run.

🩹 The Fix:

Suggested change
const capacityUrl = ${JSON.stringify(new URL("./capacity.ts", import.meta.url).href)};
const capacityUrl = new URL("./capacity.ts", import.meta.url).href;

📏 Severity: critical

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a syntax error: these lines are inside a template literal that builds the source of a child process script (the backtick opens earlier in that function), so ${...} interpolates values into the generated code. node --check parses the file at c1dcb65, and the Ubuntu job runs this suite.

Comment thread lib/hosts/daemon.test.mjs
// Accelerate only the five-second cadence, preserving watchdog/redial/child timers.
const interval = globalThis.setInterval;
globalThis.setInterval = (fn, ms, ...args) => interval(fn, ms === 5000 ? 25 : ms, ...args);
const { runHostDaemon } = await import(${JSON.stringify(new URL("./daemon.ts", import.meta.url).href)});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 The Roast: Same missing-backticks problem, this time on a dynamic import. The test file is one big syntax error waiting to happen.

🩹 The Fix:

Suggested change
const { runHostDaemon } = await import(${JSON.stringify(new URL("./daemon.ts", import.meta.url).href)});
const { runHostDaemon } = await import(new URL("./daemon.ts", import.meta.url).href);

📏 Severity: critical

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a syntax error: these lines are inside a template literal that builds the source of a child process script (the backtick opens earlier in that function), so ${...} interpolates values into the generated code. node --check parses the file at c1dcb65, and the Ubuntu job runs this suite.

Comment thread lib/hosts/daemon.test.mjs
const interval = globalThis.setInterval;
globalThis.setInterval = (fn, ms, ...args) => interval(fn, ms === 5000 ? 25 : ms, ...args);
const { runHostDaemon } = await import(${JSON.stringify(new URL("./daemon.ts", import.meta.url).href)});
const { decodeBlobFrame, LINK_PROTOCOL_VERSION, PartJoiner } = await import(${JSON.stringify(new URL("./link-protocol.ts", import.meta.url).href)});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 The Roast: Another ${...} without backticks, another dynamic import that will never execute. At this rate, the test file is more broken than working.

🩹 The Fix:

Suggested change
const { decodeBlobFrame, LINK_PROTOCOL_VERSION, PartJoiner } = await import(${JSON.stringify(new URL("./link-protocol.ts", import.meta.url).href)});
const { decodeBlobFrame, LINK_PROTOCOL_VERSION, PartJoiner } = await import(new URL("./link-protocol.ts", import.meta.url).href);

📏 Severity: critical

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a syntax error: these lines are inside a template literal that builds the source of a child process script (the backtick opens earlier in that function), so ${...} interpolates values into the generated code. node --check parses the file at c1dcb65, and the Ubuntu job runs this suite.

Comment thread lib/hosts/daemon.test.mjs
globalThis.setInterval = (fn, ms, ...args) => interval(fn, ms === 5000 ? 25 : ms, ...args);
const { runHostDaemon } = await import(${JSON.stringify(new URL("./daemon.ts", import.meta.url).href)});
const { decodeBlobFrame, LINK_PROTOCOL_VERSION, PartJoiner } = await import(${JSON.stringify(new URL("./link-protocol.ts", import.meta.url).href)});
${waitFor.toString()}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 The Roast: A bare ${...} expression standing alone like a lost sock. Without backticks, this is not JavaScript — it's a parse error. Lines 445-448 all share this fate.

🩹 The Fix: Wrap each in backticks to make them valid template literals, or remove them if they're leftover fragments. As written, they're syntax errors that prevent the file from loading.

📏 Severity: critical

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a syntax error: these lines are inside a template literal that builds the source of a child process script (the backtick opens earlier in that function), so ${...} interpolates values into the generated code. node --check parses the file at c1dcb65, and the Ubuntu job runs this suite.

@andrebrait
andrebrait merged commit 3048def into ompweb-dev:main Nov 11, 2026
3 of 4 checks passed
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