Skip to content

fix(web): handle legacy session summaries#751

Merged
tiann merged 1 commit into
tiann:mainfrom
junxin367:fix/session-list-message-status-crash
May 31, 2026
Merged

fix(web): handle legacy session summaries#751
tiann merged 1 commit into
tiann:mainfrom
junxin367:fix/session-list-message-status-crash

Conversation

@junxin367
Copy link
Copy Markdown
Contributor

变更概述

  • 修复会话列表状态切到详细/消息状态后,旧格式 session summary 触发 Cannot read properties of undefined (reading 'includes') 的崩溃。
  • classifySessionAttention() 对缺失的 pendingRequestKinds 做兼容兜底,并对 backgroundTaskCount 使用默认值。
  • 补充旧 API/session summary 缺失 pendingRequestKinds 的回归测试。

原因

会话列表的详细状态会调用 classifySessionAttention()。该函数默认 summary.pendingRequestKinds 一定存在并直接调用 .includes();但 Web 端可能遇到旧 Hub、缓存数据或旧格式 session summary,字段缺失时就会进入 ErrorBoundary 并显示:

Something went wrong!
Cannot read properties of undefined (reading 'includes')

影响范围

  • 仅影响 Web 会话列表状态分类逻辑。
  • 新格式数据行为不变。
  • 旧格式/缺字段数据不再导致页面崩溃,会按无 pending request 继续分类。

验证结果

  • C:\Users\junes\.bun\bin\bun.exe run --cwd web vitest run src/lib/sessionAttention.test.ts
  • C:\Users\junes\.bun\bin\bun.exe run --cwd web tsc --noEmit
  • git diff --check

风险/回滚

  • 风险低:只增加缺字段兜底,不改变正常数据路径。
  • 回滚方式:revert 本 PR。

Reviewer notes

  • 重点看 pendingRequestKinds 缺失时是否应保持 Web 端兼容;当前处理与已有 count 字段的 ?? 0 思路一致。

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Findings

  • No issues found.

Summary

  • Review mode: initial
  • Full diff reviewed. No high-confidence correctness, security, regression, data-loss, performance, or maintainability issues found in the modified lines.
  • Residual risk: focused web test could not be run in this automation environment because bun is not installed on PATH.

Testing

  • Not run (automation): bun --cwd web vitest run src/lib/sessionAttention.test.ts failed with bun: command not found.

HAPI Bot

@tiann tiann merged commit a1d144d into tiann:main May 31, 2026
2 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.

2 participants