Skip to content

fix(records): count overlapping calls once in session model time - #107

Merged
Calcium-Ion merged 3 commits into
Calcium-Ion:mainfrom
yyhhyyyyyy:fix/session-model-time-overlap
Oct 26, 2026
Merged

Calcium-Ion merged 3 commits into
Calcium-Ion:mainfrom
yyhhyyyyyy:fix/session-model-time-overlap

Conversation

@yyhhyyyyyy

Copy link
Copy Markdown
Contributor

⚠️ 提交说明 / PR Notice

English template: .github/PULL_REQUEST_TEMPLATE/en.md

Important

  • 描述可用 AI 辅助。提交前请人工审阅、精炼内容,并对其准确性与完整性负责。
  • PR 正文及后续评论不得直接粘贴未经人工过滤的大段 AI 文本;多次提交可能会被 block。
  • 不接受基于 AI 批量扫描结果提交的 Issue / PR,提交者将被直接 block。
  • 请按本模板填写后再提交。

🔗 关联任务 / Related Issue

🚀 变更类型 / Type of change

  • 🐛 Bug 修复 (Bug fix)
  • ✨ 新功能 (New feature)
  • ⚡ 性能优化 / 重构 (Refactor)
  • 📝 文档更新 (Documentation)

📝 变更描述 / Description

Session Model time summed every call's latency, so parallel calls (for example Claude Code subagents) were counted once each, and the live value advanced once per running call.

  • loadSessionRuntimes now merges the call intervals (root calls and retry children) and returns the length of their union. Gaps between calls and the unknown runtime of interrupted calls stay excluded, as before.
  • Running calls all end at "now", so they always merge into one final block. The new running_since field is that block's start, and duration_ms covers only the finished intervals before it. The desktop app shows duration_ms + (now - running_since), so the value grows by one second per second however many calls run. A finished call that overlaps the running block is absorbed into it instead of being counted twice.
  • active_request_starts stays for running-call counts. The Go contract, OpenAPI, desktop parser and the Model time hint (en, ja, zh-CN) are updated. Output TPS, TTFT and tool time are unchanged.

📸 运行证明 / Proof of Work

(请写明如何验证:实际命令或步骤,以及观察结果。仅声明 go build 通过或测试通过,不视为有效证明。UI 变更请附截图或录屏;Bug 修复请说明复现过程与修复后结果。)

✅ 提交前检查项 / Checklist

  • 人工确认: 我已审阅并精炼全文,对其准确性与完整性负责;正文及后续评论均未粘贴未经人工过滤的大段 AI 文本。
  • 非重复提交: 我已搜索现有的 Issues 与 PRs,确认不是重复提交。
  • 新功能关联 Issue: 若此 PR 标记为 New feature,我已关联对应 Issue;若尚无 Issue,我已先自行创建。
  • 事前沟通: 若改动较大或涉及方向性变更,已在关联 Issue 中与维护者沟通并达成一致。
  • 范围聚焦: 本 PR 为一项聚焦改动,未包含无关代码。
  • 本地验证: 已按变更路径实际验证,并写明命令与观察结果。仅声明 go build 通过或测试通过,不视为有效证明。
  • 安全合规: 代码中无敏感凭据,且符合项目代码规范。

yyhhyyyyyy and others added 3 commits October 25, 2026 22:22
Session model time summed every call's latency, so parallel calls were
counted once each and the live value advanced once per running call.

Compute the union of call intervals instead. Calls still running share one
merged block whose start is exposed as running_since, so clients add the
elapsed time once whatever the number of running calls.
Cover identical, partially overlapping and nested call intervals once
each, instead of naming a partial overlap as full and testing nesting
twice.
Subagent fixtures added on main predate running_since, which this branch
makes a required session field. Set it to null for idle sessions and to the
running call's start for the working subagent.
@Calcium-Ion
Calcium-Ion merged commit 752791a into Calcium-Ion:main Oct 26, 2026
17 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.

[Bug] Session model time adds up parallel calls and exceeds the session's wall-clock time

2 participants