Skip to content

feat: add estimated active time to session stats - #380

Merged
agegr merged 2 commits into
agegr:mainfrom
thy950523:feat/task-timing-comparison
Aug 7, 2026
Merged

feat: add estimated active time to session stats#380
agegr merged 2 commits into
agegr:mainfrom
thy950523:feat/task-timing-comparison

Conversation

@thy950523

@thy950523 thy950523 commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a single Estimated Active Time value to the Session info panel without persisting any new timing data.

The estimate is computed on the server from the session file's raw append-only entries. This keeps compacted history and work performed on every in-session branch in the total exactly once, while gaps ending at user messages are treated as human idle. User-initiated bash entries are also treated as boundaries because existing session files record only their completion time.

Changes

  • Compute totalActiveMs from all raw session entries instead of the active UI context.
  • Include messages, compactions, branch summaries, and custom messages in the estimate.
  • Keep old sessions compatible by using their existing entry timestamps.
  • Return the estimate with the session response and merge it into Session stats.
  • Show one compact estimated-active-time value instead of model/tool/other buckets.
  • Refresh the parent stats state when the estimate changes.

This is intentionally an estimate: it excludes obvious human-idle boundaries but does not add runtime instrumentation or modify the session file format.

Testing

  • node --test lib/session-timing.test.mjs - 9/9 pass
  • node_modules/.bin/tsc --noEmit - clean
  • npm run lint - clean
  • Verified the prospective merge with current main using the same checks

Adds a compact timing footer to the Session info panel that decomposes a
session's active time into model-wait, tool-execution, and a total —
excluding gaps where the user was idle, so the total reflects only time the
agent was actually working. Derived from existing per-entry timestamps, so
it works for both historical and live sessions without changes to pi.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@thy950523
thy950523 marked this pull request as ready for review August 4, 2026 08:01
@agegr agegr changed the title feat: add per-session task timing breakdown to session stats feat: add estimated active time to session stats Aug 7, 2026
@agegr
agegr merged commit 360667c into agegr:main Aug 7, 2026
jingxi1 pushed a commit to jingxi1/pi-web that referenced this pull request Aug 11, 2026
* feat: add per-session task timing breakdown to session stats

Adds a compact timing footer to the Session info panel that decomposes a
session's active time into model-wait, tool-execution, and a total —
excluding gaps where the user was idle, so the total reflects only time the
agent was actually working. Derived from existing per-entry timestamps, so
it works for both historical and live sessions without changes to pi.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: estimate total timing from session entries

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Alex Yang <agegcn@gmail.com>
(cherry picked from commit 360667c)
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