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
21 changes: 16 additions & 5 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -1251,16 +1251,27 @@ during the wait.
per-id queue so an abort cannot be undone by an earlier attach's receipt.
A start that finds the upload aborted sends
`uploadAbort` to the host and answers 404 `upload_missing`. A host-link drop
fails each in-flight upload with 503 `host_offline`; the chip's Retry (same
id) resumes. No auto-retry.
fails each in-flight upload with 503 `host_offline`. `uploadFile`
(`lib/event-stream.ts`) resumes 502/503/504 and HTTP network failures by
itself (same id, back-off restarting after new bytes, chip shows
"Reconnecting…") until an outage reaches 5 min, timed from its first
failure; other failures, and a bfcache pagehide (410), show Retry.
Back-off and in-flight retries share the remaining outage budget; their
watchdog resets only when acknowledged bytes advance. Expiry aborts the
HTTP request or sends tab-scoped `up_pause` to stop the worker without
deleting staged bytes, then settles with `upload_stalled` so Retry is usable.
Checks after waking and before applying an ack prevent expired work reviving.
HTTP body-read network errors propagate to the retry classifier (only JSON
syntax errors use the fallback body). Network `TypeError`s use the existing
localized network-error explanation in upload chip tooltips.
- Limits on main: at most 32 unfinished uploads per owner (429
`too_many_uploads`); an unfinished entry idle 10 min (no start, frame or ack)
is dropped from the registry (a later `up_start` re-registers it). The worker
fails an upload no start answer or ack advances for `UPLOAD_STALL_MS` (120 s)
with 504 `upload_stalled` and forgets it without aborting it on the host, so
Retry resumes. Page navigation settles pending WebSocket-upload promises before
the worker's `bye`: a composer retained by bfcache shows Retry after restoration,
not a permanently uploading chip. This does not automatically resume navigation.
the tab's automatic resume continues it. Page navigation settles pending
WebSocket-upload promises before the worker's `bye`: a composer retained by
bfcache shows Retry after restoration, not a permanently uploading chip.
The daemon's `sweep` deletes staged files older than 24 h and aborts open uploads
idle (no start/write) over 24 h (`STAGED_MAX_AGE_MS`).
`uploadAttach` has a 10-minute op timeout (a 2 GiB EXDEV copy), not
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ All notable changes to **omp-web** (`@kahme247/ompweb`) are documented in this f
- **ompweb as a single binary, with no Node or npm.** Each release now also carries `ompweb-linux-x64`, `ompweb-linux-arm64`, `ompweb-darwin-x64`, `ompweb-darwin-arm64` (`.tar.gz`) and `ompweb-windows-x64` (`.zip`): one `ompweb` program with the web files beside it. It takes the same options and environment variables as the npm `ompweb`, and runs the daemon too (`ompweb host`). It has no tray, service installers or in-app update: the README's "Single binary" section shows the service units, and Settings → System links the release page when an update is out. Build one with `npm run build:binary`.
- **Binary prereleases from `main`.** Each commit on `main` that passes CI is published as a GitHub prerelease titled with its build time in ISO 8601 UTC (for example `2026-11-01T10:30:00Z`; tag `20261101T103000Z-<short sha>`) with the five single-binary archives. Prereleases are never marked latest, publish no npm package and trigger no update notice.
- **Settings → Hosts shows link protocol versions.** Each host shows the link protocol version its daemon speaks, and the page shows the version this web app expects.
- **Attach any file to a message, up to 2 GiB each.** The composer no longer refuses archives, PDFs or other binary files, and images are no longer capped at 5 MB per message. A file that cannot go inline is uploaded to the session's `local://` directory (`local/uploads/`) on the machine the session runs on, and the message tells the agent its `local://` URL and absolute path. Each image has an **Inline / As file** switch: Inline sends it with the message as before (omp resizes it for the model), As file keeps the exact bytes. An image too large to go inline switches to As file by itself. Uploads stream in chunks over the browser connection (or over HTTP in SSE mode) and on to the host, and show progress on each chip; Send waits until they finish. Over the browser's WebSocket connection, an upload resumes by itself after that connection drops or the web server restarts; in SSE mode, when the server loses the host's link, or when an upload makes no progress for 2 minutes, the chip shows an error and its **Retry** continues from what the host already has. Update ompweb on the server first, then on its hosts: a host on an older build shows "Update ompweb on the session's host to attach files" when a file is attached. After an in-place upgrade, "This machine" takes uploads only once the ompweb host service (`ompweb-host`) is restarted, and the chip says so; restarting it ends the runs on this machine.
- **Attach any file to a message, up to 2 GiB each.** The composer no longer refuses archives, PDFs or other binary files, and images are no longer capped at 5 MB per message. A file that cannot go inline is uploaded to the session's `local://` directory (`local/uploads/`) on the machine the session runs on, and the message tells the agent its `local://` URL and absolute path. Each image has an **Inline / As file** switch: Inline sends it with the message as before (omp resizes it for the model), As file keeps the exact bytes. An image too large to go inline switches to As file by itself. Uploads stream in chunks over the browser connection (or over HTTP in SSE mode) and on to the host, and show progress on each chip; Send waits until they finish. An upload resumes by itself from what the host already has when the browser connection drops, the web server restarts, the server loses the host's link, or the upload makes no progress for 2 minutes: the chip shows **Reconnecting…** meanwhile, in both the WebSocket and SSE modes. **Retry** appears only after 5 minutes of such an outage, or for a failure that waiting cannot fix. Update ompweb on the server first, then on its hosts: a host on an older build shows "Update ompweb on the session's host to attach files" when a file is attached. After an in-place upgrade, "This machine" takes uploads only once the ompweb host service (`ompweb-host`) is restarted, and the chip says so; restarting it ends the runs on this machine.
- **Keep a host running with the single binary.** The README's "Keep a host running as a service" section has a systemd user unit (Linux), a logon scheduled task (Windows) and, for macOS, a restart script to run in tmux: launchd jobs cannot use the login keychain and SSH agent that omp sessions need. In tmux, macOS Local Network privacy blocks the daemon from LAN addresses, so link it to a URL that does not resolve to one (the server's public URL, or a VPN or tailnet name).
- **Session search shows where each session matched.** While searching the sidebar, the arrow beside a session lists its matches one per line, best match first and newest first among equals, ten at a time with **Load more…**. Matches in the messages of the open conversation are highlighted, typos and partial words included (thinking, tool output and math are not searched; link addresses and image descriptions do not count), and clicking a match opens its session, scrolls to it and marks it as the current one, like the browser's find. Closing or clearing the search removes the highlights. Browsers without the CSS Custom Highlight API (before Chrome 105, Safari 17.2 or Firefox 140) still jump to the match but do not paint it.
- **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".
Expand All @@ -22,6 +22,7 @@ All notable changes to **omp-web** (`@kahme247/ompweb`) are documented in this f

### Fixes & Improvements

- **Reconnecting uploads no longer leave Send blocked by a hanging retry.** The five-minute deadline stops an in-flight retry as well as its back-off, keeping staged bytes for Retry. A connection lost midway through an HTTP response resumes automatically, and tooltips identify network failures instead of showing only “Upload failed”.
- **Uploads no longer leave submitted messages or restored pages stuck.** A slow attachment copy keeps its session alive even after you switch chats. Commands that change Advisor wait until that preparation is dispatched before they may replace the session's child. Returning through browser Back/Forward shows Retry for an interrupted upload instead of leaving Send permanently blocked.
- **Attachment retries no longer accept missing files or stale upload errors.** An attachment removed or replaced by a directory is reported as missing before it is marked complete. Failed receipt writes leave the staged file available to retry without creating a duplicate, and cancellation cannot be undone by an attachment still finishing. Replies from earlier upload attempts no longer fail a newer Retry. Retrying also waits for failed-write cleanup, so an old attempt cannot delete the new attempt's staged files.
- **A conflicting upload start no longer interrupts the original file.** Reusing an upload ID with another filename or MIME type is rejected before changing the active transfer, so the original upload continues normally.
Expand Down
24 changes: 19 additions & 5 deletions components/ChatInput-uploads.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";

import React from "react";
import { AlertCircle, File as FileIcon, Loader2, RotateCw, X } from "lucide-react";
import { AlertCircle, File as FileIcon, Loader2, RotateCw, WifiOff, X } from "lucide-react";
import type { ChatDraftUpload } from "@/lib/draft-store";
import { UploadFailedError } from "@/lib/event-stream";
import { formatUploadSize } from "@/lib/upload-limits";
Expand All @@ -21,6 +21,7 @@ export interface AttachedUpload {
/** Bytes the host has. */
received: number;
status: "uploading" | "done" | "error";
/** Why it failed; while `uploading`, the transient failure it waits to resume from. */
error: string | null;
/** An image sent As file: its thumbnail (an object URL). */
previewUrl: string | null;
Expand All @@ -46,7 +47,7 @@ export function uploadRecovery(uploads: AttachedUpload[]): { uploads?: ChatDraft
}

export function uploadErrorMessage(error: unknown): string {
return error instanceof UploadFailedError ? formatApiError({ error: error.message, code: error.code }) : translate("chatInput.uploadFailed");
return error instanceof UploadFailedError ? formatApiError({ error: error.message, code: error.code }) : error instanceof TypeError ? translate("fileExplorer.uploadNetworkError") : translate("chatInput.uploadFailed");
}

const percentOf = (upload: AttachedUpload) => (upload.size > 0 ? Math.floor((upload.received * 100) / upload.size) : 100);
Expand Down Expand Up @@ -98,9 +99,10 @@ function ProgressBar({ upload }: { upload: AttachedUpload }) {
export function UploadChip({ upload, onRemove, onRetry }: { upload: AttachedUpload; onRemove: () => void; onRetry: () => void }) {
const { t } = useI18n();
const failed = upload.status === "error";
const reconnecting = upload.status === "uploading" && upload.error !== null;
return (
<div
title={failed ? `${upload.name}: ${upload.error ?? ""}` : upload.name}
title={failed || reconnecting ? `${upload.name}: ${upload.error ?? ""}` : upload.name}
style={{
position: "relative", overflow: "hidden",
display: "flex", alignItems: "center", gap: 7,
Expand All @@ -124,7 +126,7 @@ export function UploadChip({ upload, onRemove, onRetry }: { upload: AttachedUplo
{upload.name}
</span>
<span style={{ flexShrink: 0, fontSize: 10, color: failed ? "var(--status-error)" : "var(--text-dim)" }}>
{failed ? t("chatInput.uploadFailed") : upload.status === "uploading" ? `${percentOf(upload)}%` : formatUploadSize(upload.size)}
{failed ? t("chatInput.uploadFailed") : reconnecting ? t("chatInput.uploadReconnecting") : upload.status === "uploading" ? `${percentOf(upload)}%` : formatUploadSize(upload.size)}
</span>
{failed && upload.file && (
<ChipButton label={t("chatInput.uploadRetry")} onClick={onRetry}>
Expand Down Expand Up @@ -154,8 +156,10 @@ export function ImageChip({ previewUrl, upload, canSwitch, onSwitch, onRemove, o
}) {
const { t } = useI18n();
const failed = upload?.status === "error";
const reconnecting = upload?.status === "uploading" && upload.error !== null;
// Failed, or waiting to resume by itself: the tooltip says why.
return (
<div style={{ position: "relative", flexShrink: 0 }} title={failed ? upload?.error ?? undefined : undefined}>
<div style={{ position: "relative", flexShrink: 0 }} title={upload?.error ?? undefined}>
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
<div style={{ position: "relative", width: 56, height: 56, overflow: "hidden", borderRadius: 6, border: `1px solid ${failed ? "var(--status-error)" : "var(--border)"}` }}>
{previewUrl && <img src={previewUrl} alt="" style={{ width: 56, height: 56, objectFit: "cover", display: "block" }} />}
<button
Expand Down Expand Up @@ -188,6 +192,16 @@ export function ImageChip({ previewUrl, upload, canSwitch, onSwitch, onRemove, o
<RotateCw size={11} strokeWidth={2} aria-hidden="true" />
</ChipButton>
)}
{reconnecting && (
<span
role="img"
aria-label={t("chatInput.uploadReconnecting")}
title={t("chatInput.uploadReconnecting")}
style={{ position: "absolute", top: -5, left: -5, width: 24, height: 24, display: "flex", alignItems: "center", justifyContent: "center", borderRadius: 6, background: "var(--bg-panel)", border: "1px solid var(--border)", color: "var(--text-muted)" }}
>
<WifiOff size={11} strokeWidth={2} aria-hidden="true" />
</span>
)}
<ChipButton
label={t("chatInput.removeImage")}
onClick={onRemove}
Expand Down
5 changes: 3 additions & 2 deletions components/ChatInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,8 @@ export const ChatInput = memo(forwardRef<ChatInputHandle, Props>(function ChatIn
setAttachedUploads((prev) => prev.map((upload) => (upload.id === id ? { ...upload, ...patch } : upload)));
}, []);

/** Uploads the chip's file to its host; a retry resumes at the host's offset (same id). */
/** Uploads the chip's file to its host; a retry resumes at the host's offset (same id). While a transient failure
* waits to resume by itself, the chip keeps `uploading` and shows the failure in `error`. */
const runUpload = useCallback((upload: AttachedUpload) => {
if (!upload.file) return;
const { id, size } = upload;
Expand All @@ -617,7 +618,7 @@ export const ChatInput = memo(forwardRef<ChatInputHandle, Props>(function ChatIn
if (percent === shownPercent) return;
shownPercent = percent;
patchUpload(id, { received });
}, id);
}, id, (error) => patchUpload(id, { error: error === null ? null : uploadErrorMessage(error) }));
Comment thread
andrebrait marked this conversation as resolved.
Resolved
uploadHandlesRef.current.set(id, handle);
const settle = (patch: Partial<AttachedUpload>) => {
// Removed or switched meanwhile: its abort ended it.
Expand Down
Loading
Loading