Skip to content

[Bug] Sessions run outside ompweb fold the current turn, and an expanded group collapses on every new message #136

Closed

Description

@DarkBiscuits

Describe the bug
Viewing an omp session that ompweb did not start (for example one run in the background by another agent, or in a terminal) is very hard to follow:

  1. The whole current turn is folded into a single Process details · N messages · M tool calls row, so it looks as if nothing is happening.
  2. If you expand that row to follow along, it collapses again as soon as the session writes its next assistant message.

Both come from components/ChatWindow.tsx (checked at ae59ec6):

  • Live tail only for ompweb's own runs. isLiveTail (line 460) is (sessionBusy || isStreaming) && row.endIndex === messages.length && row.userIndex === lastAnchorIdx. sessionBusy comes from agentRunning, which is set by events from ompweb's own RPC process, and GET /api/agent/[id] answers { running: false } whenever getRpcSession(id) has no live process (app/api/agent/[id]/route.ts:82-84). A session driven by another omp process is therefore never treated as live, and its current turn is always folded.
  • Group key changes with every new message. The group row is keyed `process-group-${userIdx}-${finalAssistantIdx}` (line 531). finalAssistantIdx is the latest assistant message of the turn, so each new assistant message changes the key. React then remounts ProcessDetailsGroup and its useState(false) (line 184) resets expanded. Feeding planTranscriptRows a growing turn (prompt, then assistant text + tool call, then tool result, repeated) gives keys 0-1, 0-3, 0-5, 0-7 in turn.

To reproduce

  1. Start an omp session outside ompweb, e.g. omp in a terminal, or a background agent that drives omp, and give it a task that makes several tool calls.
  2. Open ompweb and select that session in the sidebar.
  3. The current turn shows as one Process details row. Expand it.
  4. Wait for the next assistant message; the row collapses.

Expected behavior
The current turn of a session that is still being written stays readable, as it does for a turn ompweb is running itself. An expanded group stays expanded while the turn continues.

Suggested fix

  • Key the group by its anchor only: key={`process-group-${userIdx}`}. userIdx is already unique per row, so the expanded state survives new messages.
  • Treat the newest turn as the live tail whether or not ompweb owns the process. Either drop the (sessionBusy || isStreaming) condition, or also accept "the session file changed recently". Alternatively add an "Expand process details by default" setting next to "Keep tool calls collapsed".

We are running the first two changes as a local patch against 0.5.0's built output. With them, a background session's current turn renders flat and updates live, and an expanded older group stays expanded while new messages arrive. We checked this in Chrome against a session being written by a separate omp process. Happy to open a PR if you'd like one.

Environment

  • OS: CachyOS (Arch-based), kernel 7.2.7
  • Node.js version: v26.10.0
  • omp version: 18.3.0
  • Browser: Chrome
  • omp-web version: 0.5.0 (source references are to main at ae59ec6)

Additional context
This is the main way to watch non-interactive omp sessions that another tool starts, so the folding hides exactly the sessions you'd open ompweb to watch.

Activity

  1. kahme247 commented on Oct 2, 2026

    @kahme247
    Collaborator

    Fixed in acf20c0f.

    The collapse — already fixed upstream, deliberately not changed again. Your key process-group-${userIdx}-${finalAssistantIdx} is gone; current main keys activity segments as activity-${userIdx}-${segmentIdx}. I wanted to be sure before leaving it alone, so I ran the real planTranscriptRows over a turn that grows message by message and compared candidate keys: the current one loses nothing and produces no duplicates as text and activity segments insert and merge. The alternative I had planned, keying on the first piece's message index, was actively wrong — it produced duplicate keys (activity-0-4 twice, activity-0-6 three times). So the remount-resets-useState(false) path is gone because the key stopped moving, not because we papered over it. If you still see a group collapse on current main, that is a different trigger and I would want the transcript that shows it.

    The folded current turn — fixed. sessionBusy = agentRunning || bashRunning is only ever true for a process omp-web itself spawned, so a session you drive from another omp binary could never get a live tail, and its newest turn was permanently folded into "Process details".

    looksLikeRunningTurn() reads the transcript tail instead: a toolResult tail is running, an assistant turn is running while its last non-blank block is a toolCall, and a turn that has stopped, aborted or errored is not. The hook exposes that as externalRunActive and polls the session file every 2s while it holds — the transcript is how you learn a foreign process moved — backing off once the transcript has been still for 60s, and waking up again if it grows. isLiveTail now ORs it in.

    One deliberate limit: sessionBusy itself is unchanged. It gates fork, navigate, autoscroll and abort-handler registration, so widening it would have handed the Stop button to a run omp-web does not own. Only the live-tail decision reads the new signal. That also means no "expand process details by default" setting yet — this keeps the newest turn open without forcing every group open, which is the part I would want your read on before adding it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions