Skip to content

[codex] 修复 Schedule Aggregator 空窗口刷新收敛#152

Merged
utopiafar merged 1 commit into
memex-lab:mainfrom
utopiafar:codex/schedule-aggregation-noop
May 18, 2026
Merged

[codex] 修复 Schedule Aggregator 空窗口刷新收敛#152
utopiafar merged 1 commit into
memex-lab:mainfrom
utopiafar:codex/schedule-aggregation-noop

Conversation

@utopiafar
Copy link
Copy Markdown
Collaborator

背景

Closes #147

真实 replay 中,Schedule Aggregator 遇到「当前刷新窗口没有 temporal cards,但 dirty state 指向历史卡片」时,会继续回读历史 Cards 并尝试推理,最终触发 max-turn loop detection。根因是刷新窗口只跟随真实 wall clock,而 dirty card 的历史日期没有参与窗口选择;同时空窗口没有一个结构性的 no-op completion path,清 dirty 只能依赖 agent 成功保存 aggregation。

改动

  • 新增 ScheduleAggregationRunPlan,在 agent 启动前统一解析目标窗口、刷新状态、当前 schedule cards 和最新 aggregation。
  • 当 dirty state 带有可解析 card id 时,目标窗口改为基于 dirty card 日期推导,避免历史 replay 被真实 wall clock 带偏。
  • 当目标窗口内没有 temporal cards 时,不再启动 LLM agent,直接保存 no-op schedule aggregation,并清理 dirty state、发送 UI update 事件。
  • get_schedule_cards 的默认窗口改为读取本次 run metadata,确保 agent 工具默认使用同一个目标窗口。
  • Schedule Aggregator 的 loop detection 在 task handler 层转为 non-retryable failure,避免 max-turn 后继续占用 active/retrying 状态。
  • 增加单测覆盖历史 dirty card 窗口推导、no-op payload、task handler 空窗口完成并清 dirty。

验证

  • flutter pub get --offline
  • flutter test --no-pub --concurrency=1 test/agent/schedule_aggregation_run_context_test.dart test/data/services/task_handlers/schedule_aggregator_handler_test.dart
  • flutter test --no-pub --concurrency=1 test/agent/schedule_aggregation_run_lifecycle_test.dart test/data/repositories/get_schedule_briefing_timeline_card_test.dart test/domain/models/schedule_aggregation_model_test.dart test/ui/schedule/models/schedule_item_test.dart
  • flutter analyze --no-pub lib/agent/schedule_aggregator_agent/schedule_aggregation_run_context.dart lib/agent/schedule_aggregator_agent/schedule_aggregator_agent.dart lib/agent/skills/schedule_aggregation/schedule_aggregation_skill.dart lib/data/services/task_handlers/schedule_aggregator_handler.dart lib/domain/models/task_exceptions.dart test/agent/schedule_aggregation_run_context_test.dart test/data/services/task_handlers/schedule_aggregator_handler_test.dart
  • git diff --check

发布前检查

  • 已从最新 upstream/main 创建分支。
  • PR 创建前再次 git fetch upstream main,确认 upstream/main...HEAD0 1,当前分支只领先目标分支一个提交且没有落后。

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 18, 2026

PR Preflight Summary / PR 预检汇总

中文

  • 统一结论:低风险:两个预检均已完成,质量预检通过,可走普通手动合并流程。
  • Policy preflight:低风险。未命中打回、高风险或警告规则。
  • Flutter quality:通过。Analyzer 和 test baseline 均未发现新增问题。
  • PR head:0e20b7eff4c7d700ce1ead2978f419b3cbde54db
  • Policy run:26049146000
  • Flutter run:26049139522

English

  • Combined result: Low risk: both preflights completed and quality passed; use the normal manual merge flow.
  • Policy preflight: LOW RISK. No blocking, high-risk, or warning policy signal was found.
  • Flutter quality: PASS. Analyzer and test baselines found no newly introduced issue.
  • PR head: 0e20b7eff4c7d700ce1ead2978f419b3cbde54db
  • Policy run: 26049146000
  • Flutter run: 26049139522
PR Policy Preflight / PR 规则预检

PR Policy Preflight / PR 规则预检

中文

  • 判定:低风险
  • 变更文件数:0
  • 变更行数:0
  • Diff 是否截断:false

未发现确定性规则问题。

English

  • Decision: LOW RISK
  • Changed files: 0
  • Changed lines: 0
  • Diff truncated: false

No deterministic policy findings.

PR Flutter Quality / Flutter 质量预检

PR Flutter Quality / Flutter 质量预检

中文

  • 总体:通过
  • Analyzer baseline:通过
  • Test baseline:通过

English

  • Overall: PASS
  • Analyzer baseline: PASS
  • Test baseline: PASS

Flutter Analyzer Baseline

  • Base issues: 324
  • PR issues: 324
  • New issues: 0

No new analyzer issues introduced by this PR.

Flutter Test Baseline

  • Base failures: 11
  • PR failures: 11
  • New failures: 0

No new Flutter test failures introduced by this PR.

@utopiafar utopiafar force-pushed the codex/schedule-aggregation-noop branch from 374a96b to 0e20b7e Compare May 18, 2026 17:12
@utopiafar utopiafar marked this pull request as ready for review May 18, 2026 17:22
@utopiafar utopiafar merged commit 6114db5 into memex-lab:main May 18, 2026
3 checks passed
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.

Schedule Aggregator 对空时间窗/历史 dirty card 缺少 no-op completion path,导致真实 replay 未收敛

1 participant