Skip to content

fix(newchat): restore conversation after returning - #3908

Open
xuyaqist wants to merge 3 commits into
developfrom
xyq/bugfix_back_conversation
Open

fix(newchat): restore conversation after returning#3908
xuyaqist wants to merge 3 commits into
developfrom
xyq/bugfix_back_conversation

Conversation

@xuyaqist

@xuyaqist xuyaqist commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

1 . 修复从”当前会话“返回后,无法再次进入这个会话并渲染会话记录的问题
2. 同步hotfix/v2.5.1修改的代码

Switch to a fresh thread before returning to the agent landing page so the previous conversation can be selected and rendered again.

Co-authored-by: Codex <noreply@openai.com>
Generated-by: gpt-5
Copilot AI lite review requested due to automatic review settings September 10, 2026 12:18

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.

🟢 Approval recommended

The functional change is small and consistent with existing thread-switching flows; only a minor test brittleness nit was identified.

Pull request overview

This PR fixes a “newchat” navigation/state issue where returning from the “current conversation” could leave the app unable to re-enter and render that conversation’s history, by explicitly clearing the active thread when navigating back.

Changes:

  • Make handleThreadBack async and switch to a new thread before calling onBack().
  • Add a regression test asserting that “back” clears the active conversation state before returning to the landing page.
  • Minor test formatting adjustment.
File summaries
File Description
frontend/app/[locale]/newchat/page.tsx Ensures “back” leaves the active thread via runtime.threads.switchToNewThread() before navigating away.
frontend/tests/newchatThreadAgentBinding.test.ts Adds/updates source-based assertions to cover the new “back leaves conversation” behavior.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +38 to +41
assert.match(
page,
/const handleThreadBack = useCallback\(async \(\) => \{[\s\S]*?shouldRestoreAgentRef\.current = false;[\s\S]*?await runtime\.threads\.switchToNewThread\(\);[\s\S]*?onBack\(\);[\s\S]*?\}, \[onBack, runtime\]\);/
);
Port deployment-aware knowledge tool filtering, historical conversation timing, and parallel tool-call completion from #3895. Exclude the already handled empty agent input fix.

Co-authored-by: Codex <noreply@openai.com>

Generated-by: gpt-5
@codecov

codecov Bot commented Sep 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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