fix: isolate session tabs and synchronize contextual panels - #2578
Nikhil (shadowfax92) wants to merge 6 commits into
Conversation
|
Greptile (@greptileai) review |
|
Claude (@claude) review |
|
Claude finished Nikhil (@shadowfax92)'s task in 4m 32s —— View job Claude finished reviewingTodo list
SummaryThis is a well-structured refactor: run-pinned 1. "New Chat" no longer cleans up the abandoned server-side conversation
The new comment in the diff explains the intent — "Stop and Delete are explicit shared execution/history operations, never lifecycle cleanup for a renderer" — which makes sense given a conversation can now be shared across panels/tabs and a renderer resetting shouldn't yank state out from under a sibling. But the result is that every "New Chat" click (including ones where the user never sent a message) now leaks:
If this is intentional (e.g., relying on some other lifecycle boundary not in this diff, or accepting the memory growth), it'd help to note it in the PR description; otherwise this looks like it needs a replacement cleanup path — e.g., only auto-delete when the abandoned conversation has no other live panel owner (which the server's 2.
This differs from the previous behavior, which reported the error once per relevant event (tab activation/watch change) via Worth adding either an attempt cap / exponential backoff, or a terminal path that clears the stale view (e.g., falls back to a fresh conversation) after N consecutive failures, so a permanently-invalid run doesn't retry/report forever. Minor
I was not able to run |
❌ Tests failed: 2/1224 failedRan 8 of 16 suites (8 not affected by this change).
Failed tests
|
Greptile SummaryThis PR separates contextual-panel selection from server-owned execution, pins attachment and stop operations to exact runs, and assigns only submitting or agent-created tabs to conversations.
Confidence Score: 4/5The PR is not safe to merge until signed-in side panels can restore cloud-only conversations selected from history. Panel selections now disable the cloud-history query and fall back to a local-only restoration path, causing cloud-only conversations to open without their messages. Files Needing Attention: packages/browseros-agent/apps/app/modules/chat/chat-session.hooks.ts Important Files Changed
Sequence DiagramsequenceDiagram
participant Panel as Contextual panel
participant Broker as Background broker
participant Server as Chat server
participant Run as Conversation run
participant Browser as Browser/MCP
Panel->>Server: POST /chat with panelTabId
Server->>Run: Start exact run and assign submitting tab
Run-->>Broker: SSE panel assignment with runId
Broker->>Panel: Store selected conversation/run
Panel->>Server: Read exact-run state and replay stream
Run->>Browser: Execute browser tools
Browser-->>Run: Created tab observed
Run-->>Broker: Assign created tab immediately
Broker->>Panel: Open acknowledged contextual panel
Prompt To Fix All With AI### Issue 1
packages/browseros-agent/apps/app/modules/chat/chat-session.hooks.ts:659-660
**Cloud history opens empty**
When a signed-in user selects a cloud-only conversation from side-panel history, the panel passes it as `initialConversationId`. This condition disables the GraphQL history query and instead tries to restore the conversation from the local server. Cloud-only conversations are not stored locally, so no messages are restored and the selected conversation opens as an empty chat.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "fix(chat): reconcile rejected submission..." | Re-trigger Greptile |
| enabled: | ||
| !!conversationIdParam && isLoggedIn && !options?.initialConversationId, |
There was a problem hiding this comment.
When a signed-in user selects a cloud-only conversation from side-panel history, the panel passes it as initialConversationId. This condition disables the GraphQL history query and instead tries to restore the conversation from the local server. Cloud-only conversations are not stored locally, so no messages are restored and the selected conversation opens as an empty chat.
Knowledge Base Used: BrowserOS extension client
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/browseros-agent/apps/app/modules/chat/chat-session.hooks.ts
Line: 659-660
Comment:
**Cloud history opens empty**
When a signed-in user selects a cloud-only conversation from side-panel history, the panel passes it as `initialConversationId`. This condition disables the GraphQL history query and instead tries to restore the conversation from the local server. Cloud-only conversations are not stored locally, so no messages are restored and the selected conversation opens as an empty chat.
**Knowledge Base Used:** [BrowserOS extension client](https://app.greptile.com/browseros-org-2/-/custom-context/knowledge-base/browseros-ai/browseros/-/docs/browseros-extension-client.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Summary
Opening or reading a tab could replace another panel's conversation, and heartbeat reconciliation could reopen panels the user had closed. Agent-created tabs now join their conversation immediately, share its live chat, and preserve unrelated panels and drafts.
Design
The server owns conversation execution and tab membership. One background broker projects assignments into browser session storage and performs native panel operations. Each panel owns its local selection and subscribes to an exact run; changing views only detaches that subscriber. The native toggle wrapper checks remembered tab state and uses explicit open/close operations. This follows the ownership separation in the archived MCP service while retaining the centralized run architecture from #2485.
Validation
bun run test:all, workspace lint, and workspace typecheck pass.