Repository navigation
feat(dsh): make total elapsed task-level across interjections - #18
Conversation
- Add taskStartedAt/taskEndedAt and per-task aggregates (tools, thinking, working time, tokens, subagents, streak) to the tracker and projection. - A task spans consecutive turns while a next-turn message is queued during a running turn (the durable signal a user interjection produces). A turn that ends with an empty queue closes the task; the next turn starts a new one. - Render the `总` counter from the task start, and aggregate the done summary across the task. Expose taskStartedAt to clients so Web/GUI local ticking uses the task anchor; turnStartedAt remains the per-turn start. - Keep older lines without agent/inbox/spliced on the per-turn fallback. - Remove the duplicate HUD token badge; the existing done summary already carries the task token total. Version remains 0.7.0 (unpublished).
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing: 16
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 05d9ca21fd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| : this.thinkingMs + Math.max(0, nowMs - this.thinkingStartedAt) | ||
| const elapsed = fmtDuration(this.turnElapsedMs(nowMs)) | ||
| const elapsed = fmtDuration(this.taskElapsedMs(nowMs)) | ||
| const elapsedLine = t('line-elapsed', { elapsed }) |
There was a problem hiding this comment.
Anchor redraws to the task clock
After an interjection starts a subsequent turn, renderThinking() now formats elapsed time from taskStartedAt, but nextWakeAt() still schedules each refresh from turnStartedAt. When those timestamps have different millisecond offsets, the TUI wakes before the task counter changes and then misses the actual second boundary, leaving the displayed total up to nearly one second stale on every tick. Use the task anchor, with the turn anchor only as a fallback, when scheduling waiting/thinking redraws.
Useful? React with 👍 / 👎.
为什么
现在状态行的
总是每个turn的用时;用户在一次任务中途插话会开启新 turn,计时器看起来被清零。期望是按「任务」计时:用户插话不算新任务,直到 AI 自己结束任务。改动
taskStartedAt/taskEndedAt/ 每任务工具数、思考耗时、干活耗时、token、子代理与连击。next-turn,回合结束时队列非空 → 任务继续;队列为空 → 任务结束,下一条消息开启新任务。这样回放投影也能得到相同结果,不依赖投影拿不到的agent/status。总改为任务计时;done 摘要按任务聚合,并显示总…。taskStartedAt,Web/GUI 的本地跳秒改用它;turnStartedAt仍保留为当前回合起点。agent/inbox/spliced的宿主退回按回合计时。验证
pnpm run build✅pnpm test→ 22 files / 293 tests ✅pnpm run test:rc2→ 24 tests ✅pnpm run test:alpha2→ 1 test ✅pnpm run prepublishOnly✅verify:gui --strict-baseline→ 31 ok ✅新增回归覆盖:单回合任务、插话后跨回合累计、空闲后新任务重置、任务级工具/token 聚合、projection
taskStartedAt、客户端任务锚点。注意
0.7.0(尚未发布);合并后 0.7.0 会同时包含 HUD 与任务级总用时。agent/inbox/spliced(0.1.7+);更早的宿主仍按回合计时。