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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ All notable changes to **omp-web** (`@kahme247/ompweb`) are documented in this f
### Fixes & Improvements

- **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.
- **`!` 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.
- **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.
Expand Down
69 changes: 69 additions & 0 deletions app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -3966,6 +3966,74 @@ html[data-touch-targets="accessible"] .right-panel-toolbar {
@media (prefers-reduced-motion: reduce) {
.activity-row-spinner { animation: none; }
}
/* A `!` command the user ran: a terminal-style card, unlike the agent's tool rows. */
.shell-run {
margin: 6px 0;
border: 1px solid var(--border);
border-radius: var(--radius-control);
background: var(--tool-bg);
overflow: hidden;
}
.shell-run-header {
display: flex;
align-items: center;
gap: 8px;
width: 100%;
padding: 6px 10px;
border: none;
background: none;
color: var(--text);
font-family: var(--font-mono);
font-size: 12.5px;
text-align: left;
cursor: pointer;
}
.shell-run-header:hover { background: var(--bg-subtle); }
/* The card clips overflow, so the focus ring sits inside the header. */
.shell-run-header:focus-visible { outline-offset: -2px; }
.shell-run-header[aria-disabled="true"] { cursor: default; }
.shell-run-prompt { color: var(--accent); font-weight: 600; flex-shrink: 0; }
.shell-run-command {
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-family: inherit;
}
.shell-run-open .shell-run-command,
.shell-run-header[aria-disabled="true"] .shell-run-command { white-space: pre-wrap; overflow-wrap: anywhere; }
.shell-run-tag {
flex-shrink: 0;
padding: 0 6px;
border: 1px solid var(--border);
border-radius: 999px;
color: var(--text-muted);
font-size: 11px;
}
.shell-run-status {
display: inline-flex;
align-items: center;
gap: 4px;
flex-shrink: 0;
color: var(--status-success);
font-size: 11.5px;
}
.shell-run-failed .shell-run-status { color: var(--status-error); }
.shell-run-chevron { flex-shrink: 0; color: var(--text-dim); transition: transform var(--dur-fast) var(--ease-out-warm); }
.shell-run-output {
margin: 0;
max-height: 420px;
overflow: auto;
padding: 8px 10px 10px 26px;
border-top: 1px solid var(--border);
font-family: var(--font-mono);
font-size: 12px;
line-height: 1.5;
color: var(--text-muted);
white-space: pre-wrap;
word-break: break-word;
}
.tool-call-details {
width: min(calc(100% - 21px), 760px);
max-width: 760px;
Expand Down Expand Up @@ -4558,6 +4626,7 @@ html[data-touch-targets="accessible"] :is(
.sidebar-new-session,
.process-details-toggle,
.activity-row-trigger,
.shell-run-header,
.session-item-icon-button,
.tool-call-input-toggle
) {
Expand Down
4 changes: 1 addition & 3 deletions components/MessageView-tool-format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ import type { ToolCallContent, ToolResultMessage } from "@/lib/types";
export type ToolCategory = "read" | "search" | "edit" | "terminal" | "todo" | "task" | "code" | "web" | "hub" | "other";

export function getToolCategory(toolName: string): ToolCategory {
// User-run shell rows synthesize "bash (local)" (MessageView.tsx) — one
// shell execution either way, so drop any trailing "(...)" qualifier first.
const name = toolName.toLowerCase().replace(/\s*\(.*\)\s*$/, "");
const name = toolName.toLowerCase();
if (name === "hub") return "hub";
if (name === "read" || name.endsWith(".read") || name.endsWith("_read") || name === "file_read") return "read";
if (name === "grep" || name === "glob" || name.includes("search") || name.endsWith(".grep") || name.endsWith(".glob")) return "search";
Expand Down
70 changes: 70 additions & 0 deletions components/MessageView.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1040,3 +1040,73 @@ test("an open confirmation closes when the row starts showing another message",
assert.deepEqual(calls, []);
view.unmount();
});

test("a `!` run renders as a shell card with its command, status and output", () => {
const shell = (message) => {
const view = render(React.createElement(MessageView, { message: { role: "bashExecution", ...message } }));
return { view, header: view.container.querySelector(".shell-run-header") };
};

const ok = shell({ command: "git status", output: "clean\n", exitCode: 0 });
assert.equal(ok.header.querySelector(".shell-run-command").textContent, "git status");
assert.equal(ok.view.container.querySelector(".shell-run-output"), null, "collapsed until opened");
fireEvent.click(ok.header);
assert.equal(ok.view.container.querySelector(".shell-run-output").textContent, "clean\n");
assert.equal(ok.view.container.querySelector(".shell-run-failed"), null);
assert.equal(ok.header.querySelector(".shell-run-tag"), null, "only `!!` runs are tagged local");
fireEvent.click(ok.header);
assert.equal(ok.view.container.querySelector(".shell-run-output"), null, "the header closes it again");
cleanup();

const failed = shell({ command: "false", output: "", exitCode: 1 });
assert.match(failed.header.querySelector(".shell-run-status").textContent, /exit 1/);
assert.ok(failed.view.container.querySelector(".shell-run-failed"));
fireEvent.click(failed.header);
assert.equal(failed.view.container.querySelector(".shell-run-output").textContent, "(no output)");
cleanup();

const cancelled = shell({ command: "sleep 9", output: "", cancelled: true });
assert.match(cancelled.header.querySelector(".shell-run-status").textContent, /cancelled/);
cleanup();

const local = shell({ command: "env", output: "A=1", exitCode: 0, excludeFromContext: true });
assert.equal(local.header.querySelector(".shell-run-tag").textContent, "local");
cleanup();

const pending = shell({ command: "make", output: "" });
assert.ok(pending.header.querySelector(".activity-row-spinner"), "a running command shows a spinner");
assert.equal(pending.header.getAttribute("aria-disabled"), "true", "the header cannot be toggled while it runs");
fireEvent.click(pending.header);
assert.equal(pending.header.getAttribute("aria-expanded"), "false");
assert.equal(pending.view.container.querySelector(".shell-run-output"), null, "no empty output while it runs");
});

test("shell card expansion resets for a different run but survives output updates", () => {
const message = { role: "bashExecution", command: "printf hello", output: "hello", exitCode: 0, timestamp: 10 };
const view = render(React.createElement(MessageView, { message }));
const header = () => view.container.querySelector(".shell-run-header");
fireEvent.click(header());
assert.equal(header().getAttribute("aria-expanded"), "true");
view.rerender(React.createElement(MessageView, { message: { ...message, output: "hello\n" } }));
assert.equal(header().getAttribute("aria-expanded"), "true", "refreshing the same run keeps the reader's expansion");
view.rerender(React.createElement(MessageView, { message: { ...message, timestamp: 20 } }));
assert.equal(header().getAttribute("aria-expanded"), "false", "a different run of the same command starts collapsed");
});

test("a branch switch that reuses the card for another untimed run of the same command starts it collapsed", () => {
const message = { role: "bashExecution", command: "ls", output: "a", exitCode: 0 };
const view = render(React.createElement(MessageView, { message, entryId: "e1" }));
const header = () => view.container.querySelector(".shell-run-header");
fireEvent.click(header());
view.rerender(React.createElement(MessageView, { message: { ...message }, entryId: "e1" }));
assert.equal(header().getAttribute("aria-expanded"), "true", "a reload of the same entry keeps it open");
view.rerender(React.createElement(MessageView, { message: { ...message, output: "b" }, entryId: "e2" }));
assert.equal(header().getAttribute("aria-expanded"), "false");
});

test("a successful shell card exposes its outcome in its accessible name", () => {
const view = render(React.createElement(MessageView, {
message: { role: "bashExecution", command: "true", output: "", exitCode: 0 },
}));
assert.ok(view.getByRole("button", { name: /true.*succeeded/i }));
});
63 changes: 37 additions & 26 deletions components/MessageView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ export const MessageView = memo(function MessageView({ message, isStreaming, too
return <CustomMessageView message={custom} cwd={cwd} onOpenFile={onOpenFile} />;
}
if (message.role === "bashExecution") {
return <BashExecutionView message={message as BashExecutionMessage} sessionId={sessionId} />;
return <BashExecutionView message={message as BashExecutionMessage} sessionId={sessionId} entryId={entryId} />;
}
return null;
}, (prev, next) => {
Expand Down Expand Up @@ -1854,7 +1854,7 @@ function previewText(text: string): string {
return normalized.length > 140 ? `${normalized.slice(0, 140)}...` : normalized;
}

function BashExecutionView({ message, sessionId }: { message: BashExecutionMessage; sessionId?: string }) {
function BashExecutionView({ message, sessionId, entryId }: { message: BashExecutionMessage; sessionId?: string; entryId?: string }) {
const { t } = useI18n();
const [fullOutput, setFullOutput] = useState<{ phase: "loading" } | { phase: "error"; message: string } | { phase: "ready"; output: string } | null>(null);
// Bumped on every message change; an in-flight fetch from the previous
Expand All @@ -1868,28 +1868,12 @@ function BashExecutionView({ message, sessionId }: { message: BashExecutionMessa
setFullOutput(null);
}, [message.command, message.fullOutputPath, message.output, message.timestamp]);
const isPending = !message.output && message.exitCode === undefined && !message.cancelled;
const isError = message.cancelled || (message.exitCode !== undefined && message.exitCode !== 0);

// Reuse the existing ToolCallBlock so user-run bash looks identical to an
// agent-run bash tool call: same header, collapse behavior, result pane.
// Synthesize an equivalent ToolCallContent + ToolResultMessage pair.
const toolName = message.excludeFromContext ? "bash (local)" : "bash";
const block: ToolCallContent = {
type: "toolCall",
toolCallId: `bash-${message.timestamp ?? ""}`,
toolName,
input: { command: message.command },
};
const result: ToolResultMessage | undefined = isPending
? undefined
: {
role: "toolResult",
toolCallId: block.toolCallId,
toolName,
content: message.output ? [{ type: "text", text: message.output }] : [],
isError,
timestamp: message.timestamp,
};
const failed = message.cancelled || (message.exitCode !== undefined && message.exitCode !== 0);
// Starts collapsed, as user-run bash always has; the header toggles it.
const [expanded, setExpanded] = useState(false);
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
useEffect(() => {
setExpanded(false);
}, [message.command, message.timestamp, entryId]);

// Large executions record their full output to a temp file (fullOutputPath);
// fetch it through the guarded bash-output route instead of re-reading the
Expand All @@ -1915,8 +1899,35 @@ function BashExecutionView({ message, sessionId }: { message: BashExecutionMessa
: null;

return (
<div data-selection-scope="message" tabIndex={-1} style={{ margin: "6px 0" }}>
<ToolCallBlock block={block} result={result} />
<div data-selection-scope="message" tabIndex={-1} className={`shell-run${failed ? " shell-run-failed" : ""}${expanded ? " shell-run-open" : ""}`}>
<Collapsible open={expanded} onOpenChange={setExpanded}>
<CollapsibleTrigger className="shell-run-header" disabled={isPending}>

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 PR description promises "while the command runs the header is disabled." The header has disabled={isPending}, sure — but the real gate is the !isPending guard on the output panel at MessageView.tsx:1921. So a running command is not un-toggleable; it just toggles a Collapsible that renders nothing. The new test at MessageView.test.mjs:1076-1079 even "verifies" this and calls it a pass. That's testing the symptom, not the behavior — if the !isPending guard ever disappears, the header stays clickable and a spinner starts spitting empty output into the pane mid-run. The disabled prop is doing decorative work while the actual protection lives in a sibling ternary.

Fix: Move the toggle lock to the source of truth. Either gate onOpenChange so clicks while pending are no-ops, or drop the !isPending render guard and rely on the disabled trigger — but pick one. Then tighten the test to assert the click handler is a no-op (aria-disabled / pointer-events), not merely that the panel is absent.

Severity: suggestion

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.

Fixed in d82b53f: the trigger is the only lock now (dropped the !isPending render guard). The test asserts the trigger is aria-disabled and that a click leaves aria-expanded=false; removing disabled={isPending} makes it fail. (Base UI's Collapsible trigger sets aria-disabled, not the native attribute, so the CSS cursor rule now targets that.)

<span className="shell-run-prompt" aria-hidden>$</span>
<code className="shell-run-command">{message.command}</code>
{message.excludeFromContext && (
<span className="shell-run-tag" title={t("messageView.shellLocalTitle")}>{t("messageView.shellLocal")}</span>
)}
<span className="shell-run-status">
{isPending ? (
<LoaderCircle size={13} strokeWidth={1.8} className="activity-row-spinner" aria-hidden />
) : failed ? (
<>
<CircleAlert size={13} strokeWidth={1.8} aria-hidden />
{message.cancelled ? t("messageView.shellCancelled") : t("messageView.shellExit", { code: String(message.exitCode) })}
</>
) : (
<>
<Check size={13} strokeWidth={2} aria-hidden />
<span className="sr-only">{t("messageView.shellSucceeded")}</span>
</>
)}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
</span>
<ChevronDown size={13} strokeWidth={1.8} aria-hidden className="shell-run-chevron" style={{ transform: expanded ? "rotate(180deg)" : undefined }} />
</CollapsibleTrigger>
{expanded && (
<pre className="shell-run-output">{message.output || t("messageView.noOutput")}</pre>
)}
</Collapsible>
{downloadUrl && (
<div style={{ display: "flex", alignItems: "center", gap: 12, marginTop: 6 }}>
{fullOutput?.phase !== "ready" && (
Expand Down
2 changes: 1 addition & 1 deletion graphify-out/graph.json

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions lib/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,11 @@
"messageView.viewFullOutput": "view full output",
"messageView.fullOutputDownload": "Download",
"messageView.fullOutputLoading": "Loading full output…",
"messageView.shellExit": "exit {code}",
"messageView.shellCancelled": "cancelled",
"messageView.shellSucceeded": "succeeded",
"messageView.shellLocal": "local",
"messageView.shellLocalTitle": "Output stays local: it is not sent to the model",
"modelsConfig.addFromCatalog": "from catalog",
"modelsConfig.addModel": "+ model",
"modelsConfig.addProvider": "Add provider",
Expand Down
5 changes: 5 additions & 0 deletions lib/i18n/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,11 @@
"messageView.viewFullOutput": "完全な出力を表示",
"messageView.fullOutputDownload": "ダウンロード",
"messageView.fullOutputLoading": "完全な出力を読み込み中…",
"messageView.shellExit": "終了コード {code}",
"messageView.shellCancelled": "キャンセル済み",
"messageView.shellSucceeded": "成功",
"messageView.shellLocal": "ローカル",
"messageView.shellLocalTitle": "出力はローカルのみで、モデルには送信されません",
"modelsConfig.addFromCatalog": "カタログから",
"modelsConfig.addModel": "+ モデル",
"modelsConfig.addProvider": "プロバイダーを追加",
Expand Down
5 changes: 5 additions & 0 deletions lib/i18n/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,11 @@
"messageView.viewFullOutput": "查看完整输出",
"messageView.fullOutputDownload": "下载",
"messageView.fullOutputLoading": "正在加载完整输出…",
"messageView.shellExit": "退出码 {code}",
"messageView.shellCancelled": "已取消",
"messageView.shellSucceeded": "已成功",
"messageView.shellLocal": "本地",
"messageView.shellLocalTitle": "输出仅保留在本地,不会发送给模型",
"modelsConfig.addFromCatalog": "从目录添加",
"modelsConfig.addModel": "+ 模型",
"modelsConfig.addProvider": "添加提供商",
Expand Down
Loading