Skip to content

πŸ› fix(copilot): pass correct scope when creating new session in PageEditor#11714

Merged
Innei merged 1 commit intonextfrom
fix/copilot-switch-topic-scope
Jan 22, 2026
Merged

πŸ› fix(copilot): pass correct scope when creating new session in PageEditor#11714
Innei merged 1 commit intonextfrom
fix/copilot-switch-topic-scope

Conversation

@Innei
Copy link
Copy Markdown
Member

@Innei Innei commented Jan 22, 2026

πŸ’» Change Type

  • πŸ› fix

πŸ”— Related Issue

fix LOBE-3378

πŸ”€ Description of Change

Fixed an issue where clicking the "New Topic" button in PageEditor Copilot panel would not create a new session.

Root Cause: The switchTopic() function was being called without a scope parameter. It defaulted to 'main' scope, while PageAgentProvider uses 'page' scope for message management. This scope mismatch caused the session data to be cleared in the wrong scope, preventing new session creation.

Fix: Pass scope: 'page' when calling switchTopic() in the Copilot toolbar.

πŸ§ͺ How to Test

  1. Open any page in PageEditor
  2. Open the Copilot panel
  3. Send some messages to start a conversation
  4. Click the "+" button to create a new topic/session
  5. Verify a new session is created and the previous messages are cleared
  • Tested locally
  • Added/updated tests
  • No tests needed

πŸ“ Additional Information

Single line change in src/features/PageEditor/Copilot/Toolbar.tsx:

- onClick={() => switchTopic()}
+ onClick={() => switchTopic(null, { scope: 'page' })}

Summary by Sourcery

Align Copilot new-topic behavior and desktop modal styling with the Page Editor experience.

Bug Fixes:

  • Ensure creating a new Copilot topic in the Page Editor uses the correct 'page' scope so a new session is actually created and previous messages are cleared.

Enhancements:

  • Adjust desktop modal blur styling so blurred modal masks use a more opaque background with no backdrop blur.

…ditor

The switchTopic function was called without scope parameter, defaulting to 'main' scope while PageAgentProvider uses 'page' scope, causing new session creation to fail.

fix LOBE-3378
@vercel
Copy link
Copy Markdown

vercel bot commented Jan 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
lobehub Building Building Preview, Comment Jan 22, 2026 3:50pm

Request Review

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai bot commented Jan 22, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Fixes Copilot 'New Topic' behavior in PageEditor by passing the correct 'page' scope to topic switching, and adjusts desktop modal blur styling in the global Ant Design overrides.

Sequence diagram for Copilot New Topic session creation with page scope

sequenceDiagram
  actor User
  participant PageEditorUI
  participant CopilotToolbar
  participant PageAgentProvider
  participant TopicManager

  User->>PageEditorUI: Click NewTopic button
  PageEditorUI->>CopilotToolbar: onClick handler
  CopilotToolbar->>PageAgentProvider: switchTopic(null, scope_page)
  Note over CopilotToolbar,PageAgentProvider: scope_page represents scope 'page'
  PageAgentProvider->>TopicManager: clearMessages(scope_page)
  TopicManager-->>PageAgentProvider: messagesCleared(scope_page)
  PageAgentProvider->>TopicManager: createNewSession(scope_page)
  TopicManager-->>PageAgentProvider: newSessionCreated(scope_page)
  PageAgentProvider-->>CopilotToolbar: sessionUpdated(scope_page)
  CopilotToolbar-->>PageEditorUI: updateCopilotPanel(scope_page)
  PageEditorUI-->>User: Show empty Copilot thread for new topic
Loading

File-Level Changes

Change Details Files
Ensure Copilot 'New Topic' button creates a new session in PageEditor by using the correct scope when switching topics.
  • Update Copilot toolbar plus-button handler to call the topic-switching function with null topic id and an options object specifying page scope
  • Rely on PageAgentProvider's page-scoped message management so that clearing and creating sessions happens in the correct scope
src/features/PageEditor/Copilot/Toolbar.tsx
Adjust modal mask blur styling for desktop in Ant Design overrides.
  • Wrap a desktop-only CSS block in isDesktop guard within the AntD override stylesheet
  • Override blurred modal mask background to be more opaque on desktop and remove backdrop blur filter for that specific blurred-mask class
src/styles/antdOverride.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jan 22, 2026
@gru-agent
Copy link
Copy Markdown
Contributor

gru-agent bot commented Jan 22, 2026

TestGru Assignment

Summary

Link CommitId Status Reason
Detail 92cd39d 🚫 Skipped No files need to be tested {"src/features/PageEditor/Copilot/Toolbar.tsx":"File path does not match include patterns.","src/styles/antdOverride.ts":"File path does not match include patterns."}

History Assignment

Tip

You can @gru-agent and leave your feedback. TestGru will make adjustments based on your input

@dosubot dosubot bot added the πŸ› Bug label Jan 22, 2026
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • If scope: 'page' is used elsewhere, consider centralizing the scope value in a shared constant or enum to avoid future mismatches with other Copilot/PageEditor integrations.
  • The new desktop-only modal mask override changes opacity and removes blur; it might be worth confirming whether mobile/tablet should intentionally retain the old blur behavior or if this styling should be unified across breakpoints.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- If `scope: 'page'` is used elsewhere, consider centralizing the scope value in a shared constant or enum to avoid future mismatches with other Copilot/PageEditor integrations.
- The new desktop-only modal mask override changes opacity and removes blur; it might be worth confirming whether mobile/tablet should intentionally retain the old blur behavior or if this styling should be unified across breakpoints.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click πŸ‘ or πŸ‘Ž on each comment and I'll use the feedback to improve your reviews.

@codecov
Copy link
Copy Markdown

codecov bot commented Jan 22, 2026

Codecov Report

βœ… All modified and coverable lines are covered by tests.
βœ… Project coverage is 74.33%. Comparing base (bf244f9) to head (92cd39d).
⚠️ Report is 9 commits behind head on next.

Additional details and impacted files
@@            Coverage Diff            @@
##             next   #11714     +/-   ##
=========================================
  Coverage   74.33%   74.33%             
=========================================
  Files        1191     1191             
  Lines       94844    94844             
  Branches    13002    10518   -2484     
=========================================
+ Hits        70502    70505      +3     
+ Misses      24252    24249      -3     
  Partials       90       90             
Flag Coverage Ξ”
app 67.30% <ΓΈ> (+<0.01%) ⬆️
database 93.29% <ΓΈ> (ΓΈ)
packages/agent-runtime 90.20% <ΓΈ> (ΓΈ)
packages/context-engine 85.39% <ΓΈ> (ΓΈ)
packages/conversation-flow 92.28% <ΓΈ> (ΓΈ)
packages/file-loaders 88.66% <ΓΈ> (ΓΈ)
packages/memory-user-memory 69.68% <ΓΈ> (ΓΈ)
packages/model-bank 100.00% <ΓΈ> (ΓΈ)
packages/model-runtime 86.72% <ΓΈ> (ΓΈ)
packages/prompts 79.33% <ΓΈ> (ΓΈ)
packages/python-interpreter 92.90% <ΓΈ> (ΓΈ)
packages/ssrf-safe-fetch 0.00% <ΓΈ> (ΓΈ)
packages/utils 93.25% <ΓΈ> (ΓΈ)
packages/web-crawler 95.62% <ΓΈ> (ΓΈ)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Ξ”
Store 68.14% <ΓΈ> (ΓΈ)
Services 50.72% <ΓΈ> (ΓΈ)
Server 67.81% <ΓΈ> (+0.01%) ⬆️
Libs 41.13% <ΓΈ> (ΓΈ)
Utils 93.82% <ΓΈ> (ΓΈ)
πŸš€ New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • πŸ“¦ JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Innei Innei merged commit 0259270 into next Jan 22, 2026
45 of 46 checks passed
@Innei Innei deleted the fix/copilot-switch-topic-scope branch January 22, 2026 16:09
@lobehubbot
Copy link
Copy Markdown
Member

❀️ Great PR @Innei ❀️

The growth of project is inseparable from user feedback and contribution, thanks for your contribution! If you are interesting with the lobehub developer community, please join our discord and then dm @arvinxx or @canisminor1990. They will invite you to our private developer channel. We are talking about the lobe-chat development or sharing ai newsletter around the world.

lobehubbot pushed a commit that referenced this pull request Jan 22, 2026
## [Version&nbsp;2.0.0-next.342](v2.0.0-next.341...v2.0.0-next.342)
<sup>Released on **2026-01-22**</sup>

#### β™» Code Refactoring

- **userMemories**: Removed un-used code.

#### πŸ› Bug Fixes

- **copilot**: Pass correct scope when creating new session in PageEditor.

<br/>

<details>
<summary><kbd>Improvements and Fixes</kbd></summary>

#### Code refactoring

* **userMemories**: Removed un-used code, closes [#11713](#11713) ([89750fc](89750fc))

#### What's fixed

* **copilot**: Pass correct scope when creating new session in PageEditor, closes [#11714](#11714) ([0259270](0259270))

</details>

<div align="right">

[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)

</div>
@lobehubbot
Copy link
Copy Markdown
Member

πŸŽ‰ This PR is included in version 2.0.0-next.342 πŸŽ‰

The release is available on:

Your semantic-release bot πŸ“¦πŸš€

JamieStivala pushed a commit to jaworldwideorg/OneJA-Bot that referenced this pull request Jan 23, 2026
## [Version&nbsp;1.153.0](v1.152.0...v1.153.0)
<sup>Released on **2026-01-23**</sup>

#### β™» Code Refactoring

- **auth**: Remove NEXT_PUBLIC_AUTH_URL env variable.
- **model-select**: Migrate FunctionCallingModelSelect to LobeSelect.
- **ModelSwitchPanel**: Migrate from Popover to DropdownMenu with virtual scrolling.
- **userMemories**: Removed un-used code.
- **misc**: Improve memory data with experience and identity, move vercel-react-best-practices skills to .agents directory.

#### ✨ Features

- **database**: Added user memory activity.
- **desktop**: Add legacy local database detection and migration guidance.
- **misc**: Add platform-aware download client menu option, add server version check for desktop app, remove Clerk authentication code, skill setting page and skill store, support agent group unpublish agents, support client tasks mode, update the sandbox preinstall libs in sys role.

#### πŸ› Bug Fixes

- **copilot**: Pass correct scope when creating new session in PageEditor.
- **desktop**: Gracefully handle missing update manifest 404 errors.
- **model-runtime**: Filter unsupported image types (SVG) before sending to vision models.
- **pdf**: Upgrade pdfjs-dist and react-pdf to v5.x.
- **sidebar-drawer**: Fix drawer positioning and title style.
- **misc**: Fix group broadcast trigger tool use, fix local system tools, fix memory schema, fix multi agent tasks issue, fix multi tasks no summary issue, fix scope issue, fix tool argument scape and improve multi task run, fixed the sandbox tools call when error should use right callback, improve e2e server and complete i18n resources, slove the agent group editor not focus in editdata area, slove the agents header switch agents the lobeAI not show problem, sloved the old removeSessionTopics not work, TypewriterEffect not refreshing on language change, updata cron job ui & fixed commnuity pagenation goto error, update the agentbuilder tools not always use humanIntervention.

#### πŸ’„ Styles

- **misc**: Improve auto scroll and group profile, update og, update share style.

<br/>

<details>
<summary><kbd>Improvements and Fixes</kbd></summary>

#### Code refactoring

* **auth**: Remove NEXT_PUBLIC_AUTH_URL env variable, closes [lobehub#11658](https://github.com/jaworldwideorg/OneJA-Bot/issues/11658) ([c0f9875](c0f9875))
* **model-select**: Migrate FunctionCallingModelSelect to LobeSelect, closes [lobehub#11664](https://github.com/jaworldwideorg/OneJA-Bot/issues/11664) ([ad51305](ad51305))
* **ModelSwitchPanel**: Migrate from Popover to DropdownMenu with virtual scrolling, closes [lobehub#11663](https://github.com/jaworldwideorg/OneJA-Bot/issues/11663) ([c9d9dff](c9d9dff))
* **userMemories**: Removed un-used code, closes [lobehub#11713](https://github.com/jaworldwideorg/OneJA-Bot/issues/11713) ([89750fc](89750fc))
* **misc**: Improve memory data with experience and identity, closes [lobehub#11717](https://github.com/jaworldwideorg/OneJA-Bot/issues/11717) ([bdb3eb4](bdb3eb4))
* **misc**: Move vercel-react-best-practices skills to .agents directory, closes [lobehub#11703](https://github.com/jaworldwideorg/OneJA-Bot/issues/11703) ([6df7731](6df7731))

#### What's improved

* **database**: Added user memory activity, closes [lobehub#11680](https://github.com/jaworldwideorg/OneJA-Bot/issues/11680) ([0160fbd](0160fbd))
* **desktop**: Add legacy local database detection and migration guidance, closes [lobehub#11682](https://github.com/jaworldwideorg/OneJA-Bot/issues/11682) ([5664b84](5664b84))
* **misc**: Add platform-aware download client menu option, closes [lobehub#11676](https://github.com/jaworldwideorg/OneJA-Bot/issues/11676) ([55abddc](55abddc))
* **misc**: Add server version check for desktop app, closes [lobehub#11710](https://github.com/jaworldwideorg/OneJA-Bot/issues/11710) ([0cf2723](0cf2723))
* **misc**: Remove Clerk authentication code, closes [lobehub#11711](https://github.com/jaworldwideorg/OneJA-Bot/issues/11711) ([395595a](395595a))
* **misc**: Skill setting page and skill store, closes [lobehub#11665](https://github.com/jaworldwideorg/OneJA-Bot/issues/11665) ([d8c0c26](d8c0c26))
* **misc**: Support agent group unpublish agents, closes [lobehub#11687](https://github.com/jaworldwideorg/OneJA-Bot/issues/11687) ([4e060be](4e060be))
* **misc**: Support client tasks mode, closes [lobehub#11666](https://github.com/jaworldwideorg/OneJA-Bot/issues/11666) ([98cf57b](98cf57b))
* **misc**: Update the sandbox preinstall libs in sys role, closes [lobehub#11688](https://github.com/jaworldwideorg/OneJA-Bot/issues/11688) ([404c577](404c577))

#### What's fixed

* **copilot**: Pass correct scope when creating new session in PageEditor, closes [lobehub#11714](https://github.com/jaworldwideorg/OneJA-Bot/issues/11714) ([0259270](0259270))
* **desktop**: Gracefully handle missing update manifest 404 errors, closes [lobehub#11625](https://github.com/jaworldwideorg/OneJA-Bot/issues/11625) ([13e95b9](13e95b9))
* **model-runtime**: Filter unsupported image types (SVG) before sending to vision models, closes [lobehub#11698](https://github.com/jaworldwideorg/OneJA-Bot/issues/11698) ([c0c99a7](c0c99a7))
* **pdf**: Upgrade pdfjs-dist and react-pdf to v5.x, closes [lobehub#11686](https://github.com/jaworldwideorg/OneJA-Bot/issues/11686) ([2b620df](2b620df))
* **sidebar-drawer**: Fix drawer positioning and title style, closes [lobehub#11655](https://github.com/jaworldwideorg/OneJA-Bot/issues/11655) ([cf5320e](cf5320e))
* **misc**: Fix group broadcast trigger tool use, closes [lobehub#11646](https://github.com/jaworldwideorg/OneJA-Bot/issues/11646) ([831a9b3](831a9b3))
* **misc**: Fix local system tools, closes [lobehub#11702](https://github.com/jaworldwideorg/OneJA-Bot/issues/11702) ([6548fc7](6548fc7))
* **misc**: Fix memory schema, closes [lobehub#11645](https://github.com/jaworldwideorg/OneJA-Bot/issues/11645) ([3baf780](3baf780))
* **misc**: Fix multi agent tasks issue, closes [lobehub#11672](https://github.com/jaworldwideorg/OneJA-Bot/issues/11672) ([9de773b](9de773b))
* **misc**: Fix multi tasks no summary issue, closes [lobehub#11685](https://github.com/jaworldwideorg/OneJA-Bot/issues/11685) ([26ce317](26ce317))
* **misc**: Fix scope issue, closes [lobehub#11719](https://github.com/jaworldwideorg/OneJA-Bot/issues/11719) ([17adde8](17adde8))
* **misc**: Fix tool argument scape and improve multi task run, closes [lobehub#11691](https://github.com/jaworldwideorg/OneJA-Bot/issues/11691) ([b13bb8a](b13bb8a))
* **misc**: Fixed the sandbox tools call when error should use right callback, closes [lobehub#11721](https://github.com/jaworldwideorg/OneJA-Bot/issues/11721) ([e8fce68](e8fce68))
* **misc**: Improve e2e server and complete i18n resources, closes [lobehub#11678](https://github.com/jaworldwideorg/OneJA-Bot/issues/11678) ([d450dd9](d450dd9))
* **misc**: Slove the agent group editor not focus in editdata area, closes [lobehub#11677](https://github.com/jaworldwideorg/OneJA-Bot/issues/11677) ([9ac84e6](9ac84e6))
* **misc**: Slove the agents header switch agents the lobeAI not show problem, closes [lobehub#11726](https://github.com/jaworldwideorg/OneJA-Bot/issues/11726) ([f45f508](f45f508))
* **misc**: Sloved the old removeSessionTopics not work, closes [lobehub#11671](https://github.com/jaworldwideorg/OneJA-Bot/issues/11671) ([06d41e5](06d41e5))
* **misc**: TypewriterEffect not refreshing on language change, closes [lobehub#11657](https://github.com/jaworldwideorg/OneJA-Bot/issues/11657) ([ba30f46](ba30f46))
* **misc**: Updata cron job ui & fixed commnuity pagenation goto error, closes [lobehub#11700](https://github.com/jaworldwideorg/OneJA-Bot/issues/11700) ([42ad2a0](42ad2a0))
* **misc**: Update the agentbuilder tools not always use humanIntervention, closes [lobehub#11696](https://github.com/jaworldwideorg/OneJA-Bot/issues/11696) ([0d3017b](0d3017b))

#### Styles

* **misc**: Improve auto scroll and group profile, closes [lobehub#11725](https://github.com/jaworldwideorg/OneJA-Bot/issues/11725) ([550acc2](550acc2))
* **misc**: Update og, closes [lobehub#11709](https://github.com/jaworldwideorg/OneJA-Bot/issues/11709) ([01cf4e4](01cf4e4))
* **misc**: Update share style, closes [lobehub#11716](https://github.com/jaworldwideorg/OneJA-Bot/issues/11716) ([3c70dfa](3c70dfa))

</details>

<div align="right">

[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)

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

Labels

πŸ› Bug released on @next size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants