Skip to content

fix(orchestrator): localize intent confirmation bubble#560

Merged
jinyu918 merged 4 commits into
mainfrom
xgopilot/issue-559-1778673607
May 13, 2026
Merged

fix(orchestrator): localize intent confirmation bubble#560
jinyu918 merged 4 commits into
mainfrom
xgopilot/issue-559-1778673607

Conversation

@fennoai

@fennoai fennoai Bot commented May 13, 2026

Copy link
Copy Markdown
Contributor

Requested by @jinyu918

This PR applies the minimal backend fix for the intent confirmation bubble.

Summary

  • stop exposing retrieval summary text in clarification bubbles
  • unify confirmation bubble language selection with session/default language fallback
  • add regressions for default language, remembered session language, and hidden memory context

Closes #559

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: jinyu918 <183728970+jinyu918@users.noreply.github.com>
@fennoai fennoai Bot mentioned this pull request May 13, 2026

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I found one functional regression in the confirmation-language fallback. The other reviewed areas looked okay.

Comment thread services/local-service/internal/orchestrator/task_confirm_prompt.go Outdated
@jinyu918

Copy link
Copy Markdown
Collaborator

@xgopilot 解决ci报错问题,并提交推送commit到这个分支

@fennoai

fennoai Bot commented May 13, 2026

Copy link
Copy Markdown
Contributor Author

Result

已修复 CI 对应的确认气泡语言回退问题,并推送到当前 PR 分支。

  • 提交:f66e74a3 fix(orchestrator): restore confirmation language fallback
  • 修复内容:确认/澄清气泡的语言探测只使用真实用户输入信号,不再把 memoryQueryFromSnapshot() 的兜底值 task_context 误判成英文,从而正确回退到 session/default language。
  • 测试:go test ./services/local-service/internal/orchestrator -run 'Test(BubbleTextForConfirmationUsesSettingsDefaultLanguage|BubbleTextForConfirmationUsesChineseDefaultLanguageWithoutInputSignal|BubbleTextForConfirmationPrefersRememberedSessionLanguage|BuildTaskConfirmQuestionPromptUsesReplyLanguage|ServiceSubmitInputClarificationDoesNotExposeRetrievedMemoryContext|ServiceClarificationReusesMaterializedMemoryHits)' -count=1

View job run

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: jinyu918 <183728970+jinyu918@users.noreply.github.com>
@jinyu918

Copy link
Copy Markdown
Collaborator

@xgopilot 现在重新看看还有什么问题

@fennoai

fennoai Bot commented May 13, 2026

Copy link
Copy Markdown
Contributor Author

Findings

  • Low: services/local-service/internal/orchestrator/memory_handoffs.go:202 and services/local-service/internal/orchestrator/memory_handoffs.go:223 still describe clarification bubbles as surfacing or acknowledging retrieved memory context. After this PR, clarificationBubbleTextForLanguage() no longer renders any retrieval summary, so these comments are now inaccurate and will mislead the next person touching the clarification/memory handoff path.

Summary

I did not find a new functional regression in the changed code beyond the stale comments above.

Validated with:

  • go test ./services/local-service/internal/orchestrator -run 'Test(BubbleTextForConfirmationUsesSettingsDefaultLanguage|BubbleTextForConfirmationUsesChineseDefaultLanguageWithoutInputSignal|BubbleTextForConfirmationPrefersRememberedSessionLanguage|BuildTaskConfirmQuestionPromptUsesReplyLanguage|ServiceSubmitInputClarificationDoesNotExposeRetrievedMemoryContext|ServiceClarificationReusesMaterializedMemoryHits|ServiceConfirmTaskAcceptedReusesMaterializedMemoryHits|ServiceConfirmTaskReusesRetrievalHitsAfterConfirmation)' -count=1
  • go test ./services/local-service/internal/orchestrator -run 'TestPreferredReplyLanguage|Test.*Confirm.*' -count=1

View job run

@jinyu918

Copy link
Copy Markdown
Collaborator

Findings

  • Low: services/local-service/internal/orchestrator/memory_handoffs.go:202 and services/local-service/internal/orchestrator/memory_handoffs.go:223 still describe clarification bubbles as surfacing or acknowledging retrieved memory context. After this PR, clarificationBubbleTextForLanguage() no longer renders any retrieval summary, so these comments are now inaccurate and will mislead the next person touching the clarification/memory handoff path.

Summary

I did not find a new functional regression in the changed code beyond the stale comments above.

Validated with:

  • go test ./services/local-service/internal/orchestrator -run 'Test(BubbleTextForConfirmationUsesSettingsDefaultLanguage|BubbleTextForConfirmationUsesChineseDefaultLanguageWithoutInputSignal|BubbleTextForConfirmationPrefersRememberedSessionLanguage|BuildTaskConfirmQuestionPromptUsesReplyLanguage|ServiceSubmitInputClarificationDoesNotExposeRetrievedMemoryContext|ServiceClarificationReusesMaterializedMemoryHits|ServiceConfirmTaskAcceptedReusesMaterializedMemoryHits|ServiceConfirmTaskReusesRetrievalHitsAfterConfirmation)' -count=1
  • go test ./services/local-service/internal/orchestrator -run 'TestPreferredReplyLanguage|Test.*Confirm.*' -count=1

View job run

@xgopilot 帮我解决这个问题,并提交推送commit到这个分支

@fennoai

fennoai Bot commented May 13, 2026

Copy link
Copy Markdown
Contributor Author

Result

已修复先前 review 提到的陈旧注释问题,并推送到当前 PR 分支。

  • 提交:635fbf98 fix(orchestrator): correct memory handoff comments
  • 修改内容:更新 services/local-service/internal/orchestrator/memory_handoffs.go 中两处英文注释,明确澄清/确认流程只复用 retrieval hits 作为后续对齐证据,不再暗示确认气泡会直接展示 memory summary。
  • 未做内容:没有改动运行时逻辑、协议或测试代码;本次仅修正文档性注释。

Verification

  • go test ./services/local-service/internal/orchestrator -run 'Test(BubbleTextForConfirmationUsesSettingsDefaultLanguage|BubbleTextForConfirmationUsesChineseDefaultLanguageWithoutInputSignal|BubbleTextForConfirmationPrefersRememberedSessionLanguage|BuildTaskConfirmQuestionPromptUsesReplyLanguage|ServiceSubmitInputClarificationDoesNotExposeRetrievedMemoryContext|ServiceClarificationReusesMaterializedMemoryHits|ServiceConfirmTaskAcceptedReusesMaterializedMemoryHits|ServiceConfirmTaskReusesRetrievalHitsAfterConfirmation)' -count=1
  • go test ./services/local-service/internal/orchestrator -run 'TestPreferredReplyLanguage|Test.*Confirm.*' -count=1

View job run

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: jinyu918 <183728970+jinyu918@users.noreply.github.com>
@jinyu918

Copy link
Copy Markdown
Collaborator

@xgopilot 现在重新看看还有什么问题

@fennoai

fennoai Bot commented May 13, 2026

Copy link
Copy Markdown
Contributor Author

Findings

  • Medium: services/local-service/internal/orchestrator/task_confirm_prompt.go:102 builds the new English fallback question with intentConfirmAction(...), but that helper still derives its verb from presentation.TaskTitle(...) in services/local-service/internal/presentation/messages.go:373. Those task-title templates are rendered from the default Chinese locale, so the no-model / invalid-model path can now emit mixed-language bubbles such as Do you want me to 处理 "workspace/release-notes.md"? for English sessions.
  • Medium: services/local-service/internal/orchestrator/task_confirm_prompt.go:154 narrows confirmation-language detection to Text, ErrorText, and SelectionText only. Before this change, the clarification path eventually fell back through memoryQueryFromSnapshot(...), which also considered file drops, page title, visible text, screen summary, window title, and clipboard text. After this PR, confirmation/clarification bubbles for those non-text entry points will fall back to session/default language even when the actual task context is clearly English, which is a behavior regression from the previous implementation.

Validation

Ran:

  • go test ./services/local-service/internal/orchestrator -run 'Test(BubbleTextForConfirmationUsesSettingsDefaultLanguage|BubbleTextForConfirmationUsesChineseDefaultLanguageWithoutInputSignal|BubbleTextForConfirmationPrefersRememberedSessionLanguage|BuildTaskConfirmQuestionPromptUsesReplyLanguage|ServiceSubmitInputClarificationDoesNotExposeRetrievedMemoryContext|ServiceClarificationReusesMaterializedMemoryHits|ServiceConfirmTaskAcceptedReusesMaterializedMemoryHits|ServiceConfirmTaskReusesRetrievalHitsAfterConfirmation)' -count=1

View job run

@jinyu918

Copy link
Copy Markdown
Collaborator

Findings 发现

  • Medium: services/local-service/internal/orchestrator/task_confirm_prompt.go:102 builds the new English fallback question with intentConfirmAction(...), but that helper still derives its verb from presentation.TaskTitle(...) in services/local-service/internal/presentation/messages.go:373. Those task-title templates are rendered from the default Chinese locale, so the no-model / invalid-model path can now emit mixed-language bubbles such as Do you want me to 处理 "workspace/release-notes.md"? for English sessions.Medium:构建新的英语备用问题with,但该助手仍然从in services/local-service/internal/presentation/messages.go:373中派生动词。这些任务标题模板是从默认的中文语言环境中呈现的,因此no-model / invalid-model路径现在可以发出混合语言的气泡,例如英语会话。
  • Medium: services/local-service/internal/orchestrator/task_confirm_prompt.go:154 narrows confirmation-language detection to Text, ErrorText, and SelectionText only. Before this change, the clarification path eventually fell back through memoryQueryFromSnapshot(...), which also considered file drops, page title, visible text, screen summary, window title, and clipboard text. After this PR, confirmation/clarification bubbles for those non-text entry points will fall back to session/default language even when the actual task context is clearly English, which is a behavior regression from the previous implementation.中等:将确认语言检测范围缩小到、、和。在此更改之前,澄清路径最终回落,它还考虑了文件掉落、页面标题、可见文本、屏幕摘要、窗口标题和剪贴板文本。在此PR之后,那些非文本入口点的确认/澄清气泡将回落到会话/默认语言,即使实际任务上下文显然是英语,这是先前实现的行为回归。

Validation 验证

Ran: 跑:

  • go test ./services/local-service/internal/orchestrator -run 'Test(BubbleTextForConfirmationUsesSettingsDefaultLanguage|BubbleTextForConfirmationUsesChineseDefaultLanguageWithoutInputSignal|BubbleTextForConfirmationPrefersRememberedSessionLanguage|BuildTaskConfirmQuestionPromptUsesReplyLanguage|ServiceSubmitInputClarificationDoesNotExposeRetrievedMemoryContext|ServiceClarificationReusesMaterializedMemoryHits|ServiceConfirmTaskAcceptedReusesMaterializedMemoryHits|ServiceConfirmTaskReusesRetrievalHitsAfterConfirmation)' -count=1

View job run 查看作业运行情况

@xgopilot 这两个看着无关紧要,为什么要修?影响实机展示吗?给我个理由

@fennoai

fennoai Bot commented May 13, 2026

Copy link
Copy Markdown
Contributor Author

Why These Matter

先说结论:这两个都不是“会把主链路跑挂”的问题,但也都不是纯洁癖。

1. task_confirm_prompt.go#L102 这个更值得修,而且会直接影响实机展示。原因是英文确认气泡新增后,fallbackConfirmIntentText() 已经会按英文模板输出,但它拼进去的动词仍然来自 messages.go#L373 的中文 task title 模板。只要命中 fallback 路径,就可能出现 Do you want me to 处理 "..."? 这种中英混排。这个 fallback 不是死代码,currentModel()==nil、占位模型未配置密钥、模型返回非法确认句时都会走到这里,所以在“英语设置 + 模型不可用/异常”的现场演示里是能直接看到的。这个 PR 标题就是 localize confirmation bubble,留着它会让“已本地化”这个结论站不住。

2. task_confirm_prompt.go#L162 这个影响比第一个小,但它是功能回退,不只是实现细节。现在确认/澄清气泡的语种判断只看 Text/ErrorText/SelectionText,而之前同一路径还能从 memory_handoffs.go#L445 这类非文本信号里拿到英语上下文,比如 FilesPageTitleVisibleTextScreenSummaryWindowTitleClipboardText。这意味着文件拖拽、页面感知、错误承接这类官方入口在需要确认时,会更容易退回 session/default language,而不是沿着当前任务语境出英语气泡。它不会让任务失败,但会让这些入口的展示一致性变差。按仓库当前主链路定义,这些并不是边缘场景。

Merge Judgment

如果只问“今天的中文文本输入 demo 会不会炸”,答案是大概率不会。

如果问“这个 PR 既然号称修 confirmation bubble localization,这两个该不该修”,我的建议是:

  • 第一个应当修,它是用户可见的本地化破口。
  • 第二个可以按发布时间权衡;如果这次只保文本输入路径,可降级为后续修复,但最好不要当成无关紧要,因为它确实让非文本入口退化了。

Validation

  • go test ./services/local-service/internal/orchestrator -run 'Test(BubbleTextForConfirmationUsesSettingsDefaultLanguage|BubbleTextForConfirmationUsesChineseDefaultLanguageWithoutInputSignal|BubbleTextForConfirmationPrefersRememberedSessionLanguage|BuildTaskConfirmQuestionPromptUsesReplyLanguage|ServiceSubmitInputClarificationDoesNotExposeRetrievedMemoryContext|ServiceClarificationReusesMaterializedMemoryHits|ServiceConfirmTaskAcceptedReusesMaterializedMemoryHits|ServiceConfirmTaskReusesRetrievalHitsAfterConfirmation)' -count=1

View job run

@jinyu918

Copy link
Copy Markdown
Collaborator

Why These Matter 为什么这些很重要

先说结论:这两个都不是“会把主链路跑挂”的问题,但也都不是纯洁癖。

1. task_confirm_prompt.go#L102 这个更值得修,而且会直接影响实机展示。原因是英文确认气泡新增后,fallbackConfirmIntentText() 已经会按英文模板输出,但它拼进去的动词仍然来自 messages.go#L373 的中文 task title 模板。只要命中 fallback 路径,就可能出现 Do you want me to 处理 "..."? 这种中英混排。这个 fallback 不是死代码,currentModel()==nil、占位模型未配置密钥、模型返回非法确认句时都会走到这里,所以在“英语设置 + 模型不可用/异常”的现场演示里是能直接看到的。这个 PR 标题就是 localize confirmation bubble,留着它会让“已本地化”这个结论站不住。

2. task_confirm_prompt.go#L162 这个影响比第一个小,但它是功能回退,不只是实现细节。现在确认/澄清气泡的语种判断只看 Text/ErrorText/SelectionText,而之前同一路径还能从 memory_handoffs.go#L445 这类非文本信号里拿到英语上下文,比如 FilesPageTitleVisibleTextScreenSummaryWindowTitleClipboardText。这意味着文件拖拽、页面感知、错误承接这类官方入口在需要确认时,会更容易退回 session/default language,而不是沿着当前任务语境出英语气泡。它不会让任务失败,但会让这些入口的展示一致性变差。按仓库当前主链路定义,这些并不是边缘场景。

Merge Judgment 合并的判断

如果只问“今天的中文文本输入 demo 会不会炸”,答案是大概率不会。

如果问“这个 PR 既然号称修 confirmation bubble localization,这两个该不该修”,我的建议是:如果问“这个 PR 既然号称修 confirmation bubble localization,这两个该不该修”,我的建议是:

  • 第一个应当修,它是用户可见的本地化破口。
  • 第二个可以按发布时间权衡;如果这次只保文本输入路径,可降级为后续修复,但最好不要当成无关紧要,因为它确实让非文本入口退化了。

Validation 验证

  • go test ./services/local-service/internal/orchestrator -run 'Test(BubbleTextForConfirmationUsesSettingsDefaultLanguage|BubbleTextForConfirmationUsesChineseDefaultLanguageWithoutInputSignal|BubbleTextForConfirmationPrefersRememberedSessionLanguage|BuildTaskConfirmQuestionPromptUsesReplyLanguage|ServiceSubmitInputClarificationDoesNotExposeRetrievedMemoryContext|ServiceClarificationReusesMaterializedMemoryHits|ServiceConfirmTaskAcceptedReusesMaterializedMemoryHits|ServiceConfirmTaskReusesRetrievalHitsAfterConfirmation)' -count=1

View job run 查看作业运行情况

@xgopilot 行,那你修吧,修完提交推送commit到这个分支

@fennoai

fennoai Bot commented May 13, 2026

Copy link
Copy Markdown
Contributor Author

Result

已修复这两个确认气泡本地化回退点,并推送到当前 PR 分支。

  • 提交:1c485d71 fix(orchestrator): restore confirmation bubble localization fallback
  • 修复内容:英文 fallback 确认句现在直接按 replyLanguage 选择动作词,不再从中文 TaskTitle 模板反推,避免出现 Do you want me to 处理 ... 这类中英混排。
  • 修复内容:确认/澄清气泡的语言探测重新覆盖文件、页面标题、可见文本、屏幕摘要、窗口标题、剪贴板等非文本入口,但不会再把 task_context 这种伪值当成真实语言信号。
  • 测试:补充了英文 fallback 动作词和非文本英语上下文的回归用例。
  • 未做内容:docs/work-priority-plan.md 对应的确认气泡联调整体验收项仍未完成,这次没有改排期勾选。

Verification

  • go test ./services/local-service/internal/orchestrator -run 'Test(BubbleTextForConfirmationUsesSettingsDefaultLanguage|BubbleTextForConfirmationUsesChineseDefaultLanguageWithoutInputSignal|BubbleTextForConfirmationPrefersRememberedSessionLanguage|BubbleTextForConfirmationUsesEnglishPageContextWithoutTextSignal|FallbackConfirmIntentTextUsesEnglishAction|BuildTaskConfirmQuestionPromptUsesReplyLanguage|ServiceSubmitInputClarificationDoesNotExposeRetrievedMemoryContext|ServiceClarificationReusesMaterializedMemoryHits|ServiceConfirmTaskAcceptedReusesMaterializedMemoryHits|ServiceConfirmTaskReusesRetrievalHitsAfterConfirmation)' -count=1

View job run

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: jinyu918 <183728970+jinyu918@users.noreply.github.com>
@jinyu918

Copy link
Copy Markdown
Collaborator

@xgopilot 现在重新看看还有什么问题

@fennoai

fennoai Bot commented May 13, 2026

Copy link
Copy Markdown
Contributor Author

Findings

No additional review findings after the latest fixes.

Validation

  • Compared the PR against origin/main and re-checked the updated confirmation/clarification language path in services/local-service/internal/orchestrator/task_confirm_prompt.go, services/local-service/internal/orchestrator/task_confirm.go, and services/local-service/internal/orchestrator/memory_handoffs.go.
  • Re-ran:
    • go test ./services/local-service/internal/orchestrator -run 'Test(BubbleTextForConfirmationUsesSettingsDefaultLanguage|BubbleTextForConfirmationUsesChineseDefaultLanguageWithoutInputSignal|BubbleTextForConfirmationPrefersRememberedSessionLanguage|BubbleTextForConfirmationUsesEnglishPageContextWithoutTextSignal|FallbackConfirmIntentTextUsesEnglishAction|BuildTaskConfirmQuestionPromptUsesReplyLanguage|ServiceSubmitInputClarificationDoesNotExposeRetrievedMemoryContext|ServiceClarificationReusesMaterializedMemoryHits|ServiceConfirmTaskAcceptedReusesMaterializedMemoryHits|ServiceConfirmTaskReusesRetrievalHitsAfterConfirmation)' -count=1
  • Repository instruction check: no CLAUDE.md file is present in this checkout.

View job run

@jinyu918 jinyu918 merged commit 75f6440 into main May 13, 2026
4 checks passed
@jinyu918 jinyu918 deleted the xgopilot/issue-559-1778673607 branch May 13, 2026 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

优化:意图确认气泡

3 participants