fix(agent): resolve dream report locale before prompting - #49
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe PR makes Dream runners use initialized locales for prompt generation. It adds locale-aware dates, durations, heatmap tooltips, structured recap tracking, history-summary precedence, heatmap positioning, styling, tests, and documentation. ChangesDream localization and recap
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant DreamRunner
participant i18n
participant PromptRequest
DreamRunner->>i18n: Initialize localization
DreamRunner->>i18n: Read active locale
DreamRunner->>PromptRequest: Add locale to system and user prompts
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
5ebea89 to
cb424bd
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/dao/browser/ui/webui/resources/agent/dao_dream_app.ts (1)
1599-1609: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win不要让 Markdown 回退主题覆盖结构化摘要。
当
recap.summary非空但recap.themes没有有效项时,Line 1601 会将报告标记为结构化报告。Line 1602 至 Line 1610 随后会从 Markdown 添加回退主题。Line 2294 会优先显示该回退主题标题,而不是recap.summary。在添加 Markdown 回退主题前,单独记录是否存在有效的结构化主题。只有有效的结构化主题才应优先于结构化摘要。添加“有 summary、无有效
recap.themes、Markdown 含标题”的历史列表测试。Also applies to: 2289-2297
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/dao/browser/ui/webui/resources/agent/dao_dream_app.ts` around lines 1599 - 1609, 在 recap 解析流程中单独记录 recap.themes 是否包含有效结构化主题,不要用同时包含 summary 的 hasStructuredRecap 作为主题优先级判断;更新 Markdown 回退主题及 2289-2297 附近的展示逻辑,使仅有 recap.summary、没有有效结构化主题时始终优先显示摘要,而只有有效结构化主题才能覆盖摘要。补充“有 summary、无有效 recap.themes、Markdown 含标题”的历史列表测试。
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@src/dao/browser/ui/webui/resources/agent/dao_dream_app.ts`:
- Around line 1599-1609: 在 recap 解析流程中单独记录 recap.themes 是否包含有效结构化主题,不要用同时包含
summary 的 hasStructuredRecap 作为主题优先级判断;更新 Markdown 回退主题及 2289-2297 附近的展示逻辑,使仅有
recap.summary、没有有效结构化主题时始终优先显示摘要,而只有有效结构化主题才能覆盖摘要。补充“有 summary、无有效
recap.themes、Markdown 含标题”的历史列表测试。
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: a050f810-ab48-4fdb-a516-b83d01fb9d3e
📒 Files selected for processing (6)
docs/feature-checklist.mddocs/features.mdsrc/dao/browser/ui/webui/resources/agent/__tests__/dao_dream_app.test.tssrc/dao/browser/ui/webui/resources/agent/dao_dream_app.tssrc/dao/browser/ui/webui/resources/agent/i18n/locales/en.tssrc/dao/browser/ui/webui/resources/agent/i18n/locales/zh-CN.ts
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/dao/browser/ui/webui/resources/agent/__tests__/dao_dream_app.test.ts`:
- Around line 546-547: 收紧 dao_dream_app 热图测试中的 class="heat-cell" 数量断言,将
toBeGreaterThan(350) 提高为至少大于 364,以验证完整年度的日期单元格数量。
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: dfe1deaf-51d9-450f-82f5-eaf9a90fb897
📒 Files selected for processing (1)
src/dao/browser/ui/webui/resources/agent/__tests__/dao_dream_app.test.ts
| expect(countTemplateMarkers(template, 'class="heat-cell"')) | ||
| .toBeGreaterThan(350); |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
收紧完整一年的热图断言。
toBeGreaterThan(350) 仍允许缺少多个日期单元格,因此不能验证完整一年。生产实现至少生成 365 个单元格。请将阈值提高到 364 以上,或按固定结束日期断言精确数量。
建议修改
expect(countTemplateMarkers(template, 'class="heat-cell"'))
- .toBeGreaterThan(350);
+ .toBeGreaterThan(364);📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| expect(countTemplateMarkers(template, 'class="heat-cell"')) | |
| .toBeGreaterThan(350); | |
| expect(countTemplateMarkers(template, 'class="heat-cell"')) | |
| .toBeGreaterThan(364); |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/dao/browser/ui/webui/resources/agent/__tests__/dao_dream_app.test.ts`
around lines 546 - 547, 收紧 dao_dream_app 热图测试中的 class="heat-cell" 数量断言,将
toBeGreaterThan(350) 提高为至少大于 364,以验证完整年度的日期单元格数量。
Background
Dream report generation could read the current locale before i18n initialization, causing daily and weekly LLM prompts to use the wrong output language.
Changes
Testing
Updated WebUI tests cover locale initialization, prompt locale injection, heatmap scrolling, localized duration formatting, and history summary selection.
Summary by CodeRabbit
New Features
Bug Fixes