Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d07444b
feat(chat): retain pending messages across browser and host outages
andrebrait Nov 4, 2026
3c58cb3
fix(outbox): persist permanent Background Sync refusals
andrebrait Nov 4, 2026
4c3281c
test(outbox): close SQLite stores before removing fixtures
andrebrait Nov 4, 2026
25ce2e9
fix(outbox): preserve newer drafts across delayed acceptance
andrebrait Nov 4, 2026
594b2e0
fix(outbox): confirm durable browser acceptance before release
andrebrait Nov 4, 2026
f984749
fix(outbox): preserve native admission ownership and bound delivery
andrebrait Nov 4, 2026
e1fec3a
test(outbox): close notification handles and retain child failure det…
andrebrait Nov 4, 2026
3c4617b
fix(outbox): retry transient browser storage initialization
andrebrait Nov 4, 2026
aeec416
fix(uploads): retain completed attachment authority across re-login
andrebrait Nov 5, 2026
112c941
fix(uploads): preserve legacy attachments during proof promotion
andrebrait Nov 5, 2026
60f2ad6
fix(outbox): bind legacy upload authority before asynchronous prepara…
andrebrait Nov 5, 2026
c86f023
fix(transport): exclude web-owned outbox replies from native timings
andrebrait Nov 5, 2026
a26b5f0
fix(outbox): preserve browser and draft ownership during handoff
andrebrait Nov 5, 2026
47662c7
fix(outbox): clear completed attempt history boundaries
andrebrait Nov 5, 2026
588f0e5
fix(outbox): persist identity moves and fence retired entries
andrebrait Nov 5, 2026
be3035a
fix(outbox): keep undiscovered remote sessions retryable
andrebrait Nov 5, 2026
97a0407
fix(outbox): fail stale Background Sync heads before advancing
andrebrait Nov 5, 2026
d953d67
fix(outbox): keep live startup claims and held-message delivery order
andrebrait Nov 5, 2026
754f958
fix(outbox): retry entries stopped before their native write
andrebrait Nov 5, 2026
4386520
fix(outbox): track the native write boundary and apply registrations …
andrebrait Nov 5, 2026
75e31a2
fix(outbox): classify pre-write refusals as unsent and hold archived …
andrebrait Nov 5, 2026
0e51ad4
fix(chat): adopt a run reported while a message waits in the outbox
andrebrait Nov 5, 2026
ea59193
test(uploads): close the outbox store before removing the workspace h…
andrebrait Nov 5, 2026
1f835d9
test(files): close the outbox store before removing the file-access f…
andrebrait Nov 5, 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
187 changes: 175 additions & 12 deletions AGENTS.md

Large diffs are not rendered by default.

14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ All notable changes to **omp-web** (`@kahme247/ompweb`) are documented in this f
- **Show tool calls outside Process details.** A new setting keeps each tool call's row in the transcript instead of folding it; whether the row opens still follows "Keep tool calls collapsed".
- **Never fold tool activity.** A new setting renders every turn flat, with no Process details rows at all. Long turns are paged, and jumping to a search match reveals its message even outside the current page.
- **Connection diagnostics.** Turn on **Settings → Interface & Behavior → Show connection diagnostics** to get a **Connection** tab in the right panel, on desktop and mobile. It shows the transport actually in use (WebSocket or server-sent events, including fallback), connection status, reconnects, and latency statistics over the last 30 minutes: mean, p50, p95, p99.9 and max. Successful commands and sampled live events are grouped by transport. One-way times are clock-corrected estimates; web app ↔ omp includes processing, with `get_state` shown separately as a delivery proxy. p99.9 needs at least 1,000 samples.
- **A message queued or steered during a run shows "Sending…" until it arrives.** It stays above the composer with a spinner until omp has taken it into its queue (then the queue chip replaces it) or refused it (then it goes back into the composer as before), instead of vanishing until an offline host refuses it seconds later. Pending indicators and refused-send recovery follow confirmed session-ID moves, including after navigating away and remounting the original composer; ordinary navigation remains isolated.
- **Updates belong to each host.** Settings → Hosts now shows the ompweb daemon and OMP runtime versions, available updates, and update actions for every machine, including This machine. Checks and installations run on that host. An incompatible or unverifiable daemon update stays visible but blocked, with a reason to update the web server first; OMP updates are independent of the link protocol. A daemon update is refused while session processes or subagents run on that host (close them, then start it again), and the host refuses new sessions while it installs. The host update retains a backup and reports progress after reconnect. **System & Updates** is now **System**, containing only the web server's controls; it no longer updates or restarts a host's OMP sessions globally.

- **Messages wait safely until omp has them.** In an existing chat, the composer clears once IndexedDB has stored the message, and a dimmed bubble names the delivery leg: **Sending**, **Waiting for <host>**, **Delivering**, or **Not sent** with the reason. Browser-held messages survive reloads and closed tabs; server-held messages survive web-server restarts and host outages, and appear on every device viewing the chat. Chromium's Background Sync can deliver after the last tab closes; other browsers retry when an ompweb page reopens. Duplicate submissions share one message id. If a lost host reply leaves delivery uncertain, the message is marked **Not sent** and never retried automatically. Held messages offer **Delete** until dispatched. Follow-ups and steers become omp's own queue chips when accepted. New chats keep their existing first-message path; a browser unable to store the message keeps the composer draft instead.

### Fixes & Improvements

- **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.
Expand All @@ -45,6 +46,17 @@ All notable changes to **omp-web** (`@kahme247/ompweb`) are documented in this f
- **Table charts show every numeric column at once.** Columns that share a unit are drawn as grouped bars with a legend, instead of one column at a time behind a selector, and columns with different units each get their own chart in the same panel. Rows are labelled with the first descriptive column, so an index column such as `#` is no longer used as the label or charted. Values that start with `about`, `approx.`, `approximately`, `around` or `roughly` are read as estimates instead of making the column unchartable. The axis labels now line up with the bars, and the SVG export contains all of the charts.
Charts remain readable on browsers without CSS subgrid. Tables with more than five same-unit measures are split into additional charts so no legend repeats a colour.
- **Finished background tool calls no longer show up as running.** A `bash` or `task` call that omp moved to the background kept reporting progress after it returned, and ompweb counted each report as a running tool. Opening the chat mid-run then listed those long-finished calls as empty running rows below the transcript until the next event, and an open chat could briefly show a finished call as running again. Calls that returned before an ompweb server restart can still show this once.
- **Background Sync retains permanent rejection states.** A rejected held message, including one from a changed installation scope, is saved as **Not sent** rather than left as **Sending**. It is not rebound to new credentials, and a late refusal cannot recreate an entry another sender already accepted.
- **Pending messages protect newer drafts and delivery intent.** A delayed storage acknowledgement does not clear newer input, even if an edit restores identical text. Same-time submissions keep durable enqueue order; duplicate browser IDs and unrelated successful HTTP responses cannot overwrite or acknowledge a held message. Delete confirmations distinguish removing tracking from cancelling work omp may already have received.
- **Outbox recovery remains live through storage and worker changes.** Storage initialization retries after transient failures, observers attach when an explicit command starts a ready session, and Background Sync verifies worker capability and durable transaction completion. Server-held capacity is bounded across sessions; overflow stays saved in the browser until capacity is available.
- **Slow browser links keep only the latest pending outbox snapshot.** Repeated held-message changes no longer fill the shared connection with redundant large snapshots. Native event ordering and the existing overflow recovery remain intact.
- **A transient browser-storage read failure no longer disables sending until every tab closes.** Later outbox operations reload the retained messages without restarting the worker, preserving their order and duplicate protection.
- **Completed attachments survive ordinary re-login.** The browser retains an upload-specific completion proof with its pending message, so renewed login cookies do not lose file ownership continuity. Accepted entries keep private per-upload authority across server restarts. Preparation stays bound to its original completion generation, so cancellation and ID reuse cannot substitute another file's bytes. Existing upload-owner, host/session and expiry checks remain intact.
- **Pending-message tracking preserves browser tools and dictated drafts.** An internal delivery observer no longer prevents another open app tab from handling a browser tool, and an earlier prompt's asynchronous failure cannot mark a successfully queued follow-up as “Not sent.” Automatically sent or queued dictation clears its submitted text after durable acceptance without clearing newer input, including an identical-text retype.
- **A completed or refused local command cannot hide a later missing response.** When an outbox attempt finishes without starting a turn, its saved-history boundary no longer leaks into the next turn's recovery checks.
- **Pending messages follow native ownership moves immediately.** The confirmed identity change durably retargets held and failed entries before another outbox action, retaining original-ID replay receipts across server restarts. Ordinary branches and session switches stay separate.
- **Deleting a held message cannot be undone by late preparation errors.** A refused or retryable startup result cannot revive the retired entry or send its emptied tombstone.
- **Offline remote chats remain discoverable after a web-server restart.** An empty host cache or failed session-list refresh no longer turns a valid remote chat into a permanent “Session not found” error just because the local daemon is online. Pending messages stay held and reach their owning host once it returns; confirmed missing sessions still fail normally.
- **Removing an upload while offline still deletes it from the host.** A file you remove (or a finished upload you discard) is now deleted from the host's staging area once the browser, the server and the host can reach each other again, even if the browser connection dropped or the host was offline when you removed it. As a backstop, a running host now deletes staged files older than a day every hour, not only when it starts or receives a new upload, which also covers a removal that ompweb lost because it restarted while the host was offline.
- **Sent-upload retention reaches hosts already linked at server startup and retries live-link failures.** An attachment whose timestamp cannot be updated is copied so it does not expire before its selected retention period; unreadable cleanup folders are reported in host logs.
- **`!` commands you run have their own look.** A shell command you ran with `!` now shows as a terminal-style card with a `$ command` prompt line, instead of the same row as the agent's tool calls. A failed run shows its exit code (`exit 1`) or `cancelled`, and a `!!` run is tagged `local`. Click the card to show its output. Long pending commands wrap even on narrow screens, switching to a different run resets its expansion, and screen readers can identify successful runs.
Expand Down
4 changes: 4 additions & 0 deletions app/api/agent/new/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ 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 (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;
Expand Down
13 changes: 13 additions & 0 deletions app/api/sessions/[id]/state/route.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
import { getExitedRpcSession, getRpcSession, WebRpcError } from "@/lib/rpc-manager";
import { apiErrorResponse, opErrorResponse, resolveSessionHostOr404 } from "@/lib/api-utils";
import { outboxEntries, outboxScope, outboxSettledIds } from "@/lib/message-outbox";

/** Every answer, an offline host's 503 included, carries the session's held messages (`outbox`): a tab opening a
* session with no omp running learns from it that there is an outbox to subscribe to. */
export async function GET(
_req: Request,
{ params }: { params: Promise<{ id: string }> },
) {
const { id } = await params;
const response = await sessionState(id);
return Response.json({
...(await response.json() as object),
outbox: outboxEntries(id),
outboxScope: outboxScope(),
outboxSettledIds: outboxSettledIds(id),
}, { status: response.status });
}

async function sessionState(id: string): Promise<Response> {
try {
// A live process proves the session exists: omp does not create the session
// file until the history holds an assistant message, so the path check
Expand Down
3 changes: 3 additions & 0 deletions app/api/sessions/archive/route.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { apiErrorResponse } from "@/lib/api-utils";
import { listArchivedSessions, restoreArchivedSession } from "@/lib/omp/archive";
import { invalidateLocalSessionLists } from "@/lib/hosts/session-index";
import { pumpOutbox } from "@/lib/message-outbox";
import { invalidateSessionListCache } from "@/lib/session-reader";
import type { ArchivedSessionInfo } from "@/lib/types";

Expand Down Expand Up @@ -34,6 +35,8 @@ export async function POST(req: Request) {
const sessionId = restoreArchivedSession(body.key);
invalidateSessionListCache();
invalidateLocalSessionLists();
// Messages held while it was archived go now (spec O6).
pumpOutbox(sessionId);
return Response.json({ ok: true, sessionId });
} catch (error) {
const message = error instanceof Error ? error.message : String(error);
Expand Down
12 changes: 8 additions & 4 deletions components/ChatInput-uploads.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export interface AttachedUpload {
name: string;
size: number;
hostId: string;
proof?: string;
/** The picked file, to retry or switch back to Inline with; null for one restored from a draft (finished). */
file: File | null;
/** Bytes the host has. */
Expand All @@ -33,12 +34,15 @@ export function draftUploadsToAttachedUploads(uploads: ChatDraftUpload[] | undef

/** Only finished uploads go into a draft: one in flight is lost with the page (spec U2). */
export function attachedUploadsToDraftUploads(uploads: AttachedUpload[]): ChatDraftUpload[] {
return uploads.filter((upload) => upload.status === "done").map(({ id, name, size, hostId }) => ({ id, name, size, hostId }));
return uploads.filter((upload) => upload.status === "done").map(({ id, name, size, hostId, proof }) => ({ id, name, size, hostId, ...(proof !== undefined ? { proof } : {}) }));
}

/** The upload ids for a send callback: an argument only when there are some (images otherwise stay the last). */
export function uploadArgs(uploads: AttachedUpload[]): [] | [string[]] {
return uploads.length ? [uploads.map((upload) => upload.id)] : [];
/** Upload ids and, when present, their completion proofs; no extra arguments for legacy uploads. */
export function uploadArgs(uploads: AttachedUpload[]): [ids?: string[], proofs?: Record<string, string>] {
if (!uploads.length) return [];
const ids = uploads.map((upload) => upload.id);
const proofs = uploads.flatMap(({ id, proof }) => proof !== undefined ? [[id, proof]] : []);
return proofs.length ? [ids, Object.fromEntries(proofs)] : [ids];
}

/** What a refused send puts back into its draft, besides text and images. */
Expand Down
1 change: 0 additions & 1 deletion components/ChatInput.btw.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ function renderComposer(props) {
onSend: record("onSend"),
onSteer: record("onSteer"),
onFollowUp: record("onFollowUp"),
onPromptWithStreamingBehavior: record("onPromptWithStreamingBehavior"),
onBuiltinCommand: async (text) => { calls.push(["onBuiltinCommand", text]); return { handled: true }; },
...props,
}));
Expand Down
Loading
Loading