diff --git a/CHANGELOG.md b/CHANGELOG.md index 62801f331..801acac39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ All notable changes to **omp-web** (`@kahme247/ompweb`) are documented in this f ### Fixes & Improvements +- **A queued message no longer flashes in the chat before it becomes a queue chip.** A follow-up or steer sent during a run stays out of the chat for up to one second while omp takes it; if omp has not queued it by then, it appears in the chat with its delivery status. A message the host is offline for, or that failed, shows at once, and **Send** (an idle prompt) still shows instantly. - **Sorting, pinning and reordering work in the cluster's sidebar group.** The group listed the cluster's shared projects first whatever the sort, and Move up/down, drag and pins only worked among projects of the same machine, so a pinned or alphabetically earlier project of a member could not move above a shared one. The group is now one list: the chosen sort, pins and manual order apply across shared projects and every member's own projects. - **Cluster members install plugins from the source this machine installed them from.** A plugin installed here from Git (`github:…`, `git+…`) or a tarball URL is installed the same way on each member instead of as an unrelated npm package of the same name and version, and a member that already has that npm package replaces it. A plugin linked or installed from a local folder here is not installed on members; Settings → Hosts shows the member as failed and names the plugin to install there by hand. A source that installs a different version than this machine runs (an unpinned Git branch, for example) also shows the member as failed, with both versions. Credentials in a source never appear in the host daemon log. - **Resuming an idle session no longer fails while omp is still starting.** omp can take more than five seconds to answer its first commands after a cold start (model refresh, plugin updates, hooks). The startup handshake now allows 30 seconds, so a message sent to an idle session is no longer marked **Not sent** with `RPC command get_state timed out after 5000ms`. Status polls of a running session keep their five-second limit. diff --git a/components/ChatWindow.tsx b/components/ChatWindow.tsx index 660a64817..8d9924122 100644 --- a/components/ChatWindow.tsx +++ b/components/ChatWindow.tsx @@ -464,7 +464,7 @@ export function ChatWindow({ session, newSessionCwd, newSessionHostId, newSessio sessionIdRef, messagesEndRef, scrollContainerRef, holdScrollPosition, handleSend, handleAbort, handleFork, handleEdit, handleModelChange, retrySession, handleSteer, handleFollowUp, handleAbortCompaction, handleCompact, - heldMessages, deleteHeldMessage, + heldMessages, deleteHeldMessage, followHeldMessages, removeQueuedMessage, promoteQueuedToSteer, handleBuiltinSlashCommand, togglePreCompactionHistory, handleThinkingLevelChange, handleFastModeChange, handleSlowModeChange, handleCycleModel, handleCycleThinkingLevel, handleAbortRetry, loadSlashCommands, @@ -1340,7 +1340,7 @@ export function ChatWindow({ session, newSessionCwd, newSessionHostId, newSessio {/* After the live turn, in submission order: what omp does not have yet. */} {heldMessages.map((held) => ( - + ))}
diff --git a/components/MessageView.test.mjs b/components/MessageView.test.mjs index 62e4aa011..9bc9dc898 100644 --- a/components/MessageView.test.mjs +++ b/components/MessageView.test.mjs @@ -47,6 +47,35 @@ test("Delete confirmation never claims omp has not seen a message that may have } }); +test("a queued message on its way stays hidden for a second; known-unqueued ones and prompts show at once", (t) => { + const base = { id: "held", message: "Queued text.", createdAt: Date.now(), local: true }; + const shown = (held) => { + const view = render(React.createElement(HeldMessageView, { held })); + const count = view.container.querySelectorAll("[data-held-message]").length; + view.unmount(); + return count; + }; + for (const mode of ["followUp", "steer"]) { + for (const state of ["sending", "held", "delivering"]) assert.equal(shown({ ...base, mode, state }), 0, `${mode} ${state}`); + for (const state of ["failed", "waiting_host"]) assert.equal(shown({ ...base, mode, state }), 1, `${mode} ${state}`); + } + assert.equal(shown({ ...base, mode: "prompt", state: "sending" }), 1); + t.mock.timers.enable({ apis: ["setTimeout"] }); + let reveals = 0; + const props = { held: { ...base, mode: "followUp", state: "sending" }, onReveal: () => { reveals += 1; } }; + const view = render(React.createElement(HeldMessageView, props)); + const count = () => view.container.querySelectorAll("[data-held-message]").length; + act(() => t.mock.timers.tick(999)); + assert.equal(count(), 0); + act(() => view.rerender(React.createElement(HeldMessageView, { ...props, held: { ...props.held, state: "delivering" } }))); + act(() => t.mock.timers.tick(1)); + assert.equal(count(), 1, "the timer survives state changes along the way"); + assert.equal(reveals, 1, "the chat is told so it can follow the late bubble"); + act(() => view.rerender(React.createElement(HeldMessageView, { ...props, held: { ...props.held, state: "held" } }))); + assert.equal(count(), 1, "a shown bubble stays shown"); + view.unmount(); +}); + test("sent messages without timestamps or branch metadata still offer copy", () => { const html = renderToStaticMarkup(React.createElement(MessageView, { message: { role: "user", content: "Keep this message copyable." }, diff --git a/components/MessageView.tsx b/components/MessageView.tsx index 2c42289af..f7b2f8e10 100644 --- a/components/MessageView.tsx +++ b/components/MessageView.tsx @@ -530,15 +530,32 @@ const heldActionStyle = { fontSize: 11, whiteSpace: "nowrap", } as const; +/** How long a queued (follow-up or steer) held message stays hidden: omp's queue chip usually replaces it sooner. */ +const QUEUED_HELD_REVEAL_MS = 1000; + /** A message omp-web holds until omp has it (docs/specs/2026-11-04-message-outbox-design.md O1): dimmed, after the * live turn, naming the leg it waits on. Delete only while nothing of it can have reached omp. */ -export function HeldMessageView({ held, hostLabel, onDelete }: { +export function HeldMessageView({ held, hostLabel, onDelete, onReveal }: { held: HeldMessage; hostLabel?: string; onDelete?: (id: string) => void; + /** Called when a bubble that started hidden appears, so the chat can follow it. */ + onReveal?: () => void; }) { const { t, locale } = useI18n(); const [confirmingDelete, setConfirmingDelete] = useState(false); + // A queued message that is on its way would flash here before becoming omp's queue chip; one known not to be queued + // (failed, host offline) shows at once, and an idle prompt always does. Once shown, it stays shown. + const deferred = held.mode !== "prompt" && held.state !== "failed" && held.state !== "waiting_host"; + const [revealed, setRevealed] = useState(!deferred); + useEffect(() => { + if (revealed) return; + const reveal = () => { setRevealed(true); onReveal?.(); }; + if (!deferred) return reveal(); + const timer = setTimeout(reveal, QUEUED_HELD_REVEAL_MS); + return () => clearTimeout(timer); + }, [revealed, deferred, onReveal]); + if (!revealed && deferred) return null; const failed = held.state === "failed"; const status = failed ? held.mayHaveBeenSent ? t("heldMessage.mayHaveBeenSent") : held.error ? t("heldMessage.notSentReason", { reason: held.error }) : t("heldMessage.notSent") diff --git a/hooks/useAgentSession.ts b/hooks/useAgentSession.ts index 1f306ee3d..c2eae8dc9 100644 --- a/hooks/useAgentSession.ts +++ b/hooks/useAgentSession.ts @@ -4456,6 +4456,8 @@ export function useAgentSession(opts: UseAgentSessionOptions) { const handleSteer = useCallback((message: string, images?: AttachedImage[], uploads?: string[], uploadProofs?: Record) => handleQueued("steer", message, images, uploads, uploadProofs), [handleQueued]); const handleFollowUp = useCallback((message: string, images?: AttachedImage[], uploads?: string[], uploadProofs?: Record) => handleQueued("followUp", message, images, uploads, uploadProofs), [handleQueued]); + // A held bubble that appears late (HeldMessageView's reveal delay) re-runs the follow-scroll effect. + const followHeldMessages = useCallback(() => setHeldFollow((n) => n + 1), []); const heldMessagesRef = useRef(heldMessages); heldMessagesRef.current = heldMessages; const localOutboxRef = useRef(localOutbox); @@ -4961,7 +4963,7 @@ export function useAgentSession(opts: UseAgentSessionOptions) { handleSend, handleAbort, handleFork, handleEdit, handleModelChange, handleFastModeChange, handleSlowModeChange, handleAutoRetryChange, handleInterruptModeChange, handleAutoCompactionChange, handleSteeringModeChange, handleFollowUpModeChange, handleCycleModel, handleCycleThinkingLevel, handleAbortRetry, handleInterruptAndReply, setSkillStartupDiagnostics, retrySession: () => { const sid = sessionIdRef.current; if (sid) void loadSession(sid, true, true); }, handleCompact, handleHandoff, handleSteer, handleFollowUp, handleAbortCompaction, - heldMessages, deleteHeldMessage, + heldMessages, deleteHeldMessage, followHeldMessages, handleBuiltinSlashCommand, togglePreCompactionHistory, handleToolPresetChange, handleThinkingLevelChange, loadSlashCommands, removeQueuedMessage, promoteQueuedToSteer, setActiveLeafId, setData, setMessages, dispatch, setAgentRunning, setForkingEntryId,