Skip to content

feat(dsh): make total elapsed task-level across interjections - #18

Merged
ccch1mneyyy merged 1 commit into
mainfrom
feat/task-elapsed
Oct 18, 2026
Merged

ccch1mneyyy merged 1 commit into
mainfrom
feat/task-elapsed

Conversation

@ccch1mneyyy

Copy link
Copy Markdown
Owner

为什么

现在状态行的 总 是每个 turn 的用时;用户在一次任务中途插话会开启新 turn,计时器看起来被清零。期望是按「任务」计时:用户插话不算新任务,直到 AI 自己结束任务。

改动

  • 新增任务级计时与聚合:taskStartedAt / taskEndedAt / 每任务工具数、思考耗时、干活耗时、token、子代理与连击。
  • 任务边界用 durable inbox 判定:回合进行中用户插话会把下一条输入排进 next-turn,回合结束时队列非空 → 任务继续;队列为空 → 任务结束,下一条消息开启新任务。这样回放投影也能得到相同结果,不依赖投影拿不到的 agent/status。
  • 总 改为任务计时;done 摘要按任务聚合,并显示 总…。
  • 投影暴露 taskStartedAt,Web/GUI 的本地跳秒改用它;turnStartedAt 仍保留为当前回合起点。
  • 0.1.7 以下没有 agent/inbox/spliced 的宿主退回按回合计时。
  • 去掉 HUD 里重复的 token 徽章(done 摘要本来就有 token 总量)。

验证

  • 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+);更早的宿主仍按回合计时。

- 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).
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-18T19:16:15.321233Z 05d9ca2 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 18, 2026

Copy link
Copy Markdown

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 807adf9c-e975-4733-a8ba-add16f2e0736
📥 Commits

Reviewing files that changed from the base of the PR and between fe50e04 and 05d9ca2.

📒 Files selected for processing: 16
  • README.md
  • docs/dsh-working-activity.md
  • packages/activity/working-activity/README.i18n.yaml
  • packages/activity/working-activity/README.md
  • packages/activity/working-activity/README.zh.md
  • packages/activity/working-activity/src/client/elapsed.ts
  • packages/activity/working-activity/src/config.ts
  • packages/activity/working-activity/src/index.ts
  • packages/activity/working-activity/src/projection.ts
  • packages/activity/working-activity/src/status.ts
  • packages/activity/working-activity/tests/client-elapsed.spec.ts
  • packages/activity/working-activity/tests/config.spec.ts
  • packages/activity/working-activity/tests/hud.spec.ts
  • packages/activity/working-activity/tests/projection.spec.ts
  • packages/activity/working-activity/tests/status-purity.spec.ts
  • packages/activity/working-activity/tests/task-timer.spec.ts
+----------------------------------------+
| Your docs say 'TBD'. I'm here to 'Do'. |
+----------------------------------------+
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ccch1mneyyy
ccch1mneyyy merged commit 8999ac3 into main Oct 18, 2026
6 of 7 checks passed
@ccch1mneyyy
ccch1mneyyy deleted the feat/task-elapsed branch October 18, 2026 19:14

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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 })

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

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.

1 participant