Skip to content

A tab that never regains focus misses a run started in another browser #5609

Description

@mmabrouk

Found during the 0.106.2 release review of #5589. Deliberately not fixed there, because the fix reverses an explicit design decision.

What happens

Open an agent session in two browsers. Start a run in the first. If the second browser stays visibly on screen but never regains focus, it never notices. The "running elsewhere" strip above the composer does not appear, and the record-log poll that keeps its transcript current never starts.

Clicking into that tab fixes it instantly, and nothing is lost either way. Reopening the session converges correctly regardless.

Why

aliveStreamsQueryAtom sets refetchInterval to false as soon as the alive-streams result is empty (web/oss/src/components/AgentChatSlice/state/liveness.ts:42). After that it only refetches on window focus. So isRunning never flips for an idle tab that is never clicked.

This is intentional. The comment above it says the query polls only while something is alive and cites the request-count budget for cold load. So this is not an oversight to patch, it is a trade-off to revisit.

Who hits it

Only someone with two windows side by side, or a second device, watching without interacting. In the normal cross-tab flow the user is in the other tab when the run starts, so returning to this one triggers the focus refetch and everything starts.

Options

  1. Leave it. The strip appears on the next click into the tab. This is what 0.106.2 ships.
  2. Add a slow discovery poll, say every 60 seconds, while the alive set is empty. Costs one request per minute per open idle tab across all users, which is the exact cost the current design refuses to pay.
  3. Add a server push or invalidation channel. Removes the polling question, but it is new architecture.

Arda should pick between 2 and 3, or confirm 1 is fine long term.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions