fix(newchat): restore conversation after returning - #3908
Open
xuyaqist wants to merge 3 commits into
Open
Conversation
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
xuyaqist
requested review from
Dallas98,
WMC001 and
jeffwu-1999
as code owners
September 10, 2026 12:18
Contributor
There was a problem hiding this comment.
🟢 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
handleThreadBackasync and switch to a new thread before callingonBack(). - 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 Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1 . 修复从”当前会话“返回后,无法再次进入这个会话并渲染会话记录的问题
2. 同步hotfix/v2.5.1修改的代码