Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
c08227c
feat: sample effective worker capacity
andrebrait Nov 10, 2026
afc07e8
PR #432: fix(chat): mark the streaming reply as streaming
andrebrait Nov 10, 2026
67e9601
PR #438: feat(files): highlight .diff files and pick the highlighting…
andrebrait Nov 10, 2026
3d4cbbc
test: cover sampler acquisition and baseline recovery
andrebrait Nov 10, 2026
2bc625c
feat: report worker capacity and retain creation identities
andrebrait Nov 10, 2026
32cab71
feat: prepare isolated repository worktrees on workers
andrebrait Nov 10, 2026
2ff8f15
fix: preserve clone reservations and isolate Git fetches
andrebrait Nov 10, 2026
011404f
fix: reserve clone preparation across processes
andrebrait Nov 10, 2026
6ea8858
feat: retain fresh host capacity and stable creation channels
andrebrait Nov 10, 2026
d4d5c07
feat: rank explicit host pools by effective capacity
andrebrait Nov 10, 2026
1b59e24
fix: retain creation proxies reused during refusal cleanup
andrebrait Nov 10, 2026
c8cbae7
feat: administer explicit host pools through hosts API
andrebrait Nov 10, 2026
a31a938
feat: prepare pooled projects through guarded host operations
andrebrait Nov 10, 2026
4cf1238
feat: expose pooled repositories as logical projects
andrebrait Nov 10, 2026
693e7f6
fix: allow bounded long-running worker preparation
andrebrait Nov 10, 2026
4af6d7f
fix: reject mixed logical targets in standalone project batches
andrebrait Nov 10, 2026
be491d1
feat: admit durable pooled sessions without duplicate starts
andrebrait Nov 10, 2026
f027101
fix: finish retained adoption and bound pooled initialization
andrebrait Nov 10, 2026
7500612
feat: place independent agent sessions through host pools
andrebrait Nov 10, 2026
0aa83ce
feat: make pooled placement transparent in the UI
andrebrait Nov 10, 2026
f8103f6
feat: add atomic local worker maintenance controls
andrebrait Nov 10, 2026
efbff33
fix: retain pooled agent recovery identity in native errors
andrebrait Nov 10, 2026
6c8d01e
PR #432: fix(chat): mark the streaming reply as streaming
andrebrait Nov 10, 2026
3b59842
PR #439: fix(markdown): keep dollar amounts out of inline math
andrebrait Nov 10, 2026
f13571b
fix: retain pooled composer and owner-bound file surfaces
andrebrait Nov 10, 2026
8f0f424
feat: route workspace filesystem operations through their session owner
andrebrait Nov 10, 2026
bfedd55
fix: enforce source ownership across pooled workspace controls
andrebrait Nov 10, 2026
c536c2c
fix: patch reachable DOCX XML parser vulnerabilities
andrebrait Nov 10, 2026
218532d
Merge deployed production 67e96015 into transparent host pool
andrebrait Nov 10, 2026
cea58a1
Merge remote-tracking branch 'origin/deploy/integration' into feat/tr…
andrebrait Nov 10, 2026
d6f2e17
feat: gate pool capacity, creation identity and preparation on link p…
andrebrait Nov 10, 2026
f335ed2
chore: refresh knowledge graph after production merge
andrebrait Nov 10, 2026
7b94481
Merge upstream/main into feat/transparent-host-pool
andrebrait Nov 11, 2026
af6b133
fix(hosts): validate pool worker paths with the worker's path rules
andrebrait Nov 11, 2026
ca1fa70
fix(hosts): support Windows pool journals and OMP export launchers
andrebrait Nov 11, 2026
c1dcb65
test: make pool Git and upload fixtures portable to Windows
andrebrait Nov 11, 2026
f932710
Merge upstream/main into feat/transparent-host-pool
andrebrait Nov 11, 2026
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ All notable changes to **omp-web** (`@kahme247/ompweb`) are documented in this f
- **The retry banner keeps its cancel button on-screen on mobile.** Retry details wrap within the composer, including long provider errors, instead of pushing the Abort retry button past the side of the screen. Long details scroll within a bounded area, and the controls reflow in narrow chat columns.
- **Windows host updates allow more time for safety checks.** The process inventory gets up to 20 seconds to start and finish on a busy machine, instead of five. Shared installations and failed or unreadable inventories still block the update before the daemon is stopped.
- **Copied uploads start retention at the send time on Windows too.** When a hard link cannot be used or its timestamp cannot be changed, the host writes a fresh exclusive copy instead of inheriting an old staging timestamp. Failed copies remain retryable without replacing unrelated files.
- **Windows servers can manage pools of Unix workers.** Pool configuration and clone paths use the worker's path rules, not the web server's OS. Creation journals retain their synced-file, atomic-rename commit on Windows without requiring unsupported directory fsync.
- **Session HTML export supports Windows OMP launchers.** Export uses the same `.cmd` and `.bat` handling as RPC sessions and version checks.
- **Newly sent uploads survive an overlapping retention sweep.** The host refreshes the staged file's timestamp before making its hard link visible, for attachments and Files-panel uploads alike, so cleanup cannot mistake a just-sent file for an expired one. A Files-panel overwrite of an expired file can no longer be deleted by a sweep that inspected the file it replaced.
- **Windows upload cleanup respects each daemon's retention policy.** Shared temporary roots now keep each daemon's attachments in its own subfolder, so a seven-day policy cannot delete another daemon's “Never” uploads, even with copied session UUIDs. Existing flat fallback files remain readable and are left untouched because their owner is unknown.
- **Credential copies and config `.env` files stay private without blocking independent uploads.** The file viewer and upload preflight/overwrite deny editor swaps and backups such as `.agent.db.swp`, `agent.db~`, `.models.yml.swp` and `models.yml-backup` only directly in omp's actual agent directories (including profiles). `.env` and `.env.*` are also denied at genuine default/profile config roots and agent directories, including their symlinked real targets. Same-named session uploads, workspace files and package assets remain readable and replaceable.
Expand Down
49 changes: 46 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,47 @@ the daemon's link when it starts, so start the web server first.
- **Development:** `npm run dev` does not take the daemon (see
[Development](#development)).

### Transparent host pools

A configured host pool appears as one target with one entry per registered repository.
Choose the pool rather than a worker; new independent sessions are placed on an eligible
worker and receive an isolated local worktree. Adding a pool project registers its Git
origin, not a central clone. The selected worker prepares its checkout when the session
starts and reports authentication, preparation, or repository conflicts explicitly.
Standalone hosts, including the Mac, retain typed paths and local clone progress/cancellation.
Existing non-pooled workspaces on member hosts remain accessible in the sidebar; those
hosts are not offered as ordinary pool-creation targets. Resolving the owner for a new
chat's attachment does not replace its live composer or discard its draft and uploads.
Placement and preparation failures are also shown when command discovery or system-prompt
inspection starts a session lazily; retrying remains an explicit user action.

Creation retries reuse the same intent and creation identity. Once a real session is known,
its owner remains authoritative for resume, files, terminal, uploads, artifacts, rename, and
delete, even if pool membership changes. An unavailable owner does not trigger replacement
on another worker or on the Mac. Dirty files and unpublished work remain on that owner;
there is no live migration or unpublished-work failover. After an uncertain response,
inspect the retained session before explicitly retrying a command that may have run.


### Local worker maintenance (Unix)

`ompweb host status` prints daemon PID, native version/protocol, welcomed-link readiness,
executable/entrypoint identity and maintenance state without credentials.
`ompweb host drain` synchronously checks children (idle included), preparations,
uploads/controls, pending operations and reliable results, and closes new-work admission
only when idle. A busy refusal never kills work or changes admission.
`ompweb host resume` reopens the live daemon. Controls use a private Unix socket inside
the existing daemon, not TCP or a separate service. A disconnected deployer cannot release
a live drain. Ordinary standalone Windows hosts remain unchanged; local controls are Unix-only.
Disable central member admission before worker rollout; native drain is the final race-free guard.

Worker service cutovers can additionally start drained through `OMP_WEB_HOST_DRAINED=1`
in their protected temporary unit environment. Live resume does not remove that startup
setting. After a deployer crash or lost final resume reply, verify the selected release,
PID and welcomed-link health, and remove the known worker maintenance flag before explicit
resume. Never infer from a missing acknowledgement that admission stayed closed, and never
stop or roll back a candidate after its deployment commit point.

### Single binary

Each [release](https://github.com/kahme247/ompweb/releases/latest) also ships
Expand Down Expand Up @@ -533,9 +574,11 @@ Notes:
@-mentions and live file watching use the owning machine's daemon, including
This machine. Explorer uploads accept up to 2 GiB per file with no 100 MiB batch
cap; preview limits remain 256 KiB for text and 10 MiB for images/DOCX.
File tabs retain their source host when you switch chats. An unavailable or
older daemon reports offline or asks for an update; main never substitutes its
own filesystem.
File tabs retain their source session, host and workspace when you switch chats;
paths from another conversation cannot be mentioned into the selected chat.
An unavailable or older daemon reports offline or asks for an update; main
never substitutes its own filesystem. Unprepared pool chats have no guessed
filesystem to browse.
- **Git and worktrees on every host:** status, diffs, GitHub issue links, and
worktree creation, selection and removal run on the owning daemon. Dirty
worktrees still require explicit force confirmation. Switching a worktree
Expand Down
2 changes: 1 addition & 1 deletion app/api/agent/[id]/bash-output/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export async function GET(
const opened = await host.workspaceOps.openBashOutput(id, path);
if (!opened.ok) return opErrorResponse(opened);
disableIdleTimeout();
return new Response(workspaceReadStream(host, opened.value), { headers: {
return new Response(workspaceReadStream(host, opened.value, 0, opened.value.info.size - 1, request.signal), { headers: {
"Content-Type": "text/plain; charset=utf-8",
"Content-Disposition": "attachment; filename=\"bash-output.log\"",
"Cache-Control": "no-store",
Expand Down
93 changes: 55 additions & 38 deletions app/api/agent/new/route.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
import { apiErrorResponse, opErrorResponse, resolveHostOrError } from "@/lib/api-utils";
import { WebRpcError, startNewRpcSession } from "@/lib/rpc-manager";
import { WebRpcError, startNewRpcSession, type AgentSessionWrapper } from "@/lib/rpc-manager";
import { RpcCommandError } from "@/lib/omp/rpc-process";
import { parseJsonWithinLimit, RequestBodyTooLargeError } from "@/lib/bounded-form-data";
import { MAX_AGENT_COMMAND_REQUEST_BYTES } from "@/lib/image-attachments";
import { validateAgentImages } from "@/lib/image-attachments";
import { PoolStartError, startPooledSession } from "@/lib/hosts/pool-starts";
import { HostOpError } from "@/lib/hosts/link-protocol";
import { isRecord } from "@/lib/type-guards";

function newSessionErrorResponse(error: unknown) {
if (error instanceof PoolStartError) {
return Response.json({ error: error.message, code: error.code, sessionId: error.sessionId, hostId: error.hostId, cwd: error.cwd, delivery: error.delivery }, { status: error.status });
}
if (error instanceof RequestBodyTooLargeError) {
return Response.json({ error: "New session request is too large", code: "request_too_large" }, { status: 413 });
}
Expand All @@ -20,62 +27,72 @@ function newSessionErrorResponse(error: unknown) {
}
return apiErrorResponse(error);
}
// POST /api/agent/new body: { cwd: string; type: string; hostId?: string; message?: string; ... }
// Spawns a brand-new omp session on `hostId` (this machine when absent). Most
// calls immediately send the first command;
// type:"ensure_session" only creates the runtime so clients can query commands.
// Returns { sessionId, data } where sessionId is omp's real session id.
// Model/thinking presets are applied post-ready via RPC set_model /
// set_thinking_level (not CLI flags) so failures surface as command errors and
// the live model catalog (incl. background discovery) is consulted.
// Pooled creation carries creationId/poolId/projectId, never physical host/cwd.
// Standalone creation keeps its existing checked host-local cwd and cleanup.
export async function POST(req: Request) {
try {
const body = await parseJsonWithinLimit<{ cwd?: string; hostId?: unknown; [key: string]: unknown }>(req, MAX_AGENT_COMMAND_REQUEST_BYTES);
const { cwd: requestedCwd, hostId, ...command } = body;
// New-chat uploads have no session file to attach into; never forward bearer authority to native RPC.
if (!isRecord(body)) return Response.json({ error: "A session request object is required", code: "invalid_request" }, { status: 400 });
const { cwd: requestedCwd, hostId, poolId, projectId, creationId, ref, ...command } = body;
delete command.intentHash;
if (Object.hasOwn(command, "uploadProofs") || Object.hasOwn(command, "uploads")) {
return Response.json({ error: "Files attach only to an existing session", code: "invalid_uploads" }, { status: 400 });
}
const target = resolveHostOrError(hostId);
if ("response" in target) return target.response;
const { host } = target;

if (!requestedCwd || typeof requestedCwd !== "string") {
return Response.json({ error: "cwd is required", code: "cwd_required" }, { status: 400 });
const pooled = poolId !== undefined || projectId !== undefined || creationId !== undefined || ref !== undefined;
if (pooled && (hostId !== undefined || requestedCwd !== undefined || typeof poolId !== "string" || typeof projectId !== "string" || typeof creationId !== "string" || (ref !== undefined && typeof ref !== "string"))) {
return Response.json({ error: "Pool creation requires creationId, poolId and projectId, without hostId or cwd", code: "invalid_pool_target" }, { status: 400 });
}

const { provider, modelId, toolNames, thinkingLevel, advisor, ...promptCommand } = command as { provider?: string; modelId?: string; toolNames?: string[]; thinkingLevel?: string; advisor?: boolean; [key: string]: unknown };
const { provider, modelId, toolNames, thinkingLevel, advisor, name, ...promptCommand } = command as { provider?: string; modelId?: string; toolNames?: string[]; thinkingLevel?: string; advisor?: boolean; name?: string; [key: string]: unknown };
// A session id has no meaning for a fresh spawn and must never reach the
// child RPC: a stale or forged id would address the wrong session.
delete promptCommand.sessionId;
if (typeof promptCommand.type !== "string" || !promptCommand.type.trim()) {
return Response.json({ error: "command type is required", code: "command_type_required" }, { status: 400 });
}
if ([provider, modelId, thinkingLevel, name].some((value) => value !== undefined && (typeof value !== "string" || !value.trim()))
|| (toolNames !== undefined && (!Array.isArray(toolNames) || toolNames.some((value) => typeof value !== "string" || !value.trim())))
|| (advisor !== undefined && typeof advisor !== "boolean")
|| (promptCommand.message !== undefined && typeof promptCommand.message !== "string")) {
return Response.json({ error: "Invalid session initialization fields", code: "invalid_creation_intent" }, { status: 400 });
}
const imageError = validateAgentImages(promptCommand.images);
if (imageError) return Response.json({ error: imageError, code: "invalid_images" }, { status: 400 });

const initialize = async (session: AgentSessionWrapper, preserveUnknownDelivery: boolean) => {
if (provider && modelId) await session.send({ type: "set_model", provider, modelId }, { preserveUnknownDelivery });
if (thinkingLevel) await session.send({ type: "set_thinking_level", level: thinkingLevel }, { preserveUnknownDelivery });
if (name) await session.send({ type: "set_session_name", name }, { preserveUnknownDelivery });
if (promptCommand.type === "ensure_session") return null;
return session.send(promptCommand, { preserveUnknownDelivery });
};
const preparing = promptCommand.type !== "ensure_session" || !!(provider && modelId) || !!thinkingLevel || !!name;

// The cwd is checked on its host; the host answers with the path it will use.
const preparing = promptCommand.type !== "ensure_session" || !!(provider && modelId) || !!thinkingLevel;
const started = await startNewRpcSession(host, requestedCwd, toolNames, advisor === true, preparing);
if (pooled) {
// The hash is derived here from every effectful field, including unknown command options.
const intent = { ...promptCommand, provider, modelId, toolNames, thinkingLevel, advisor, name };
const result = await startPooledSession({ creationId: creationId as string, poolId: poolId as string, projectId: projectId as string, ...(ref === undefined ? {} : { ref: ref as string }), intent }, async (host, prepared, id, onStarted) => {
const started = await startNewRpcSession(host, prepared.cwd, toolNames, advisor === true, preparing, id);
if (!started.ok) throw new HostOpError(started.status, started.code, started.error);
const { session, realSessionId } = started.value;
await onStarted(realSessionId);
const run = () => initialize(session, true);
return { sessionId: realSessionId, data: await (preparing ? session.withPendingCommand(run, true) : run()) };
});
return Response.json({ success: true, ...result });
}

if (!requestedCwd || typeof requestedCwd !== "string") {
return Response.json({ error: "cwd is required", code: "cwd_required" }, { status: 400 });
}
const target = resolveHostOrError(hostId);
if ("response" in target) return target.response;
const started = await startNewRpcSession(target.host, requestedCwd, toolNames, advisor === true, preparing);
if (!started.ok) return opErrorResponse(started);
const { session, realSessionId } = started.value;

try {
const run = async () => {
if (provider && modelId) await session.send({ type: "set_model", provider, modelId });
if (thinkingLevel) await session.send({ type: "set_thinking_level", level: thinkingLevel });
if (promptCommand.type === "ensure_session") {
return Response.json({ success: true, sessionId: realSessionId, data: null });
}
const result = await session.send(promptCommand);
return Response.json({ success: true, sessionId: realSessionId, data: result });
};
const run = async () => Response.json({ success: true, sessionId: realSessionId, data: await initialize(session, false) });
return await (preparing ? session.withPendingCommand(run, true) : run());
} catch (error) {
// The child was spawned but the prompt never ran: without this cleanup a
// failed set_model/set_thinking_level/prompt leaves an orphaned omp
// process and a registry entry nobody will ever use.
// The link dropped: the first command may be running there, so the
// wrapper stays for the reconnect (and disposing it would wait for the link).
// Its id lets the client open it instead of starting a second session.
if (error instanceof WebRpcError && error.code === "host_offline") {
return Response.json({ error: error.message, code: error.code, hostOffline: true, delivery: error.delivery, sessionId: realSessionId }, { status: 503 });
}
Expand Down
6 changes: 3 additions & 3 deletions app/api/file-index/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import { parseResultLimit } from "@/lib/file-fuzzy";
export async function GET(req: Request) {
try {
const params = new URL(req.url).searchParams;
const resolved = await resolveWorkspaceHost(params.get("hostId") ?? undefined, null);
const resolved = await resolveWorkspaceHost(params.get("hostId") ?? undefined, params.get("sessionId"));
if ("response" in resolved) return resolved.response;
const result = await resolved.host.workspaceOps.fileIndex(
params.get("cwd")?.trim() ?? "", params.get("q") ?? "", parseResultLimit(params.get("limit")),
params.get("kind") === "file" ? "file" : "all", params.get("refresh") === "1",
resolved.cwd ?? params.get("cwd")?.trim() ?? "", params.get("q") ?? "", parseResultLimit(params.get("limit")),
params.get("kind") === "file" ? "file" : "all", params.get("refresh") === "1", resolved.owner,
);
return result.ok ? Response.json(result.value) : opErrorResponse(result);
} catch (error) {
Expand Down
Loading
Loading