Skip to content

[Reliability] Research run 进入终态前确保报告已持久化 #69

Closed

Description

@yc2bgr8

Background

ResearchService 当前通过 onStatus 持久化 ResearchRunner 的状态。ResearchRunner 会先发布 completed / partial 终态,随后 ResearchService 才保存对应 report。

因此调用方可能观察到:

  • run.status 已经是 completed / partial;
  • run.reportId 已存在;
  • 但 getReport(reportId) 暂时返回 undefined。

现有测试也明确使用额外的 waitForReports 轮询等待报告落盘。全量测试中,这个时间窗口还可能在临时目录清理后触发后台写入的 ENOENT / EPERM。

Current behavior

当前顺序为:

  1. onStatus 保存 terminal run summary;
  2. terminal 状态对调用方可见;
  3. ResearchService.execute() 随后调用 saveReport()。

这使 completed / partial 与“报告已经可读取”之间存在竞态。

Expected behavior

对于包含 reportId 的 completed / partial run:

  1. report 先成功持久化;
  2. 然后再发布并持久化 terminal summary;
  3. 一旦调用方观察到 terminal status,对应 report 应立即可读。

failed / cancelled 等没有报告的终态保持现有行为。

Acceptance criteria

  • completed / partial 状态不会早于 report 持久化
  • 观察到 terminal status 后,getReport(reportId) 立即成功
  • 不改变现有公开 API
  • 不影响 failed / cancelled 流程
  • 增加确定性回归测试
  • ResearchService 测试不再需要额外的 waitForReports 轮询

Scope

建议仅调整 ResearchService 的终态发布顺序及对应测试,不在本 Issue 中扩展 checkpoint、恢复协议或底层存储重构。

Activity

  1. yc2bgr8 commented on Sep 11, 2026

    @yc2bgr8
    ContributorAuthor

    /claim

  2. github-actions commented on Sep 11, 2026

    @github-actions

    @yc2bgr8 已认领该 Issue,并已自动设为 Assignee。提交 PR 时请在描述中写 Closes #69。

  3. added
    claimed
    on Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

claimed

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions