Skip to content

fix(gui-extensions): hold agent previews for sessions that are not on screen - #53249

Merged
Hona merged 1 commit into
anomalyco:v2from
Hona:preview-offscreen
Oct 5, 2026
Merged

Hona merged 1 commit into
anomalyco:v2from
Hona:preview-offscreen

Conversation

@Hona

@Hona Hona commented Oct 5, 2026

Copy link
Copy Markdown
Member

browser.preview silently did nothing when the agent's session was not the one on screen. The agent still got a success reply, so it believed the user saw the file.

flowchart LR
  A[preview event] --> B{session on screen?}
  B -- yes --> C[links.open → file / browser tab]
  B -- "no (before)" --> D[dropped]
  B -- "no (after)" --> E[entry.previews]
  E -- user returns to the session --> C
Loading
  • focus and the strip mirror already write to the owning session whatever is routed; preview was the only pane event gated on the route, with no hold.
  • Paths resolve only against the session screen's file model, so a preview waits for ctx.screen.current() rather than opening blind.
  • Waiting paths are deduplicated and open in order once the session's screen mounts.
const preview = (entry: Live, path: string) => {
  const view = sessions.current()

  if (view?.key === entry.ref.key && ctx.screen.current()) {
    links.open({ href: path, session: view, background: true })

    return
  }

  if (!entry.previews.includes(path)) entry.previews.push(path)
}

Copilot AI balanced review requested due to automatic review settings October 5, 2026 00:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Hona
Hona enabled auto-merge (squash) October 5, 2026 00:41
@Hona
Hona merged commit ed74709 into anomalyco:v2 Oct 5, 2026
11 checks passed
Ichinose-Kazuki pushed a commit to Ichinose-Kazuki/opencode that referenced this pull request Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants