feat: add estimated active time to session stats - #380
Merged
Conversation
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
marked this pull request as ready for review
August 4, 2026 08:01
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
totalActiveMsfrom all raw session entries instead of the active UI context.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 passnode_modules/.bin/tsc --noEmit- cleannpm run lint- cleanmainusing the same checks