Repository navigation
fix(workbench): stop double-prefixing the conversation route guard re… - #4558
Merged
Merged
Conversation
…direct The guard wrapped its router.replace href in withBasePath, but the Next.js router already prepends the configured basePath internally. Under subpath deployments this produced /nexent/nexent/zh/workbench -> 404 whenever an automation-task detail link opened a workbench conversation through newchat. Pass an app-internal path and let the router own the prefix. Replace the identity withBasePath mock (which hid the bug) with a real-prefix mock and add a subpath regression assertion; verified red before / green after.
jeffwu-1999
requested review from
WMC001,
YehongPan,
hhhhsc701 and
xuyaqist
as code owners
December 4, 2026 06:26
YehongPan
approved these changes
Dec 4, 2026
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.
问题
子路径部署(如 /nexent)下,工作台创建的自动任务点"详情"必 404:地址栏出现双重前缀 /nexent/nexent/zh/workbench?conversation_id=N。
根因
useConversationRouteGuard(#4010 引入)给 router.replace 传了 withBasePath(...) 手动加过前缀的路径,而 Next.js router 内部 addBasePath 会再加一次(构建期内联的 __NEXT_ROUTER_BASEPATH)。根路径部署时 BASE_PATH 为空,加不加都一样,bug 隐形;#4502 让子路径部署可用后暴露。
触发链:工作台建定时任务 → 任务绑定 workbench 会话 → 详情链接写死指向 /newchat → 守卫判定类型不匹配需重定向 → 双拼 404。newchat 里建的任务(普通会话)不触发重定向,故不炸——这解释了现网"有的账号炸有的不炸"。
本地已用 CONFIGURED_BASE_PATH=/nexent 构建镜像完整复现(conversation 293 双前缀 404)。
修复
验证
影响面
仅守卫重定向一处;分享链接(#4502)等 window.location/剪贴板场景的手动加前缀是正确的,不受影响。