Skip to content

feat: emit WakaTime cadence heartbeats at coding-tool dispatch - #13177

Merged
iamwhatever merged 2 commits into
kirodotdev:mainfrom
Behordeun:feat/wakatime-cadence-heartbeats
Oct 12, 2026
Merged

iamwhatever merged 2 commits into
kirodotdev:mainfrom
Behordeun:feat/wakatime-cadence-heartbeats

Conversation

@Behordeun

@Behordeun Behordeun commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Why no screenshot: backend-only change — the WakaTime heartbeat producer (wakatime/heartbeats.py) plus its post-gating call sites in dashboard/chat_runner.py (the per-approval path and the completed-result frame). No frontend paths are touched and nothing renders.

Problem / Motivation

Goal: make a developer's agent coding turns accrue real coding-time duration on their WakaTime dashboard, not just AI attribution.

WakaTime AI-coding heartbeats from Kiro Crew (added in #9450) carry correct attribution — AI lines, tokens, prompts, sessions, spend — but accrue almost no coding-time duration. WakaTime derives duration from the cadence between heartbeats, and #9450 emits one heartbeat at end of turn, so a coding turn has no intra-turn cadence for WakaTime to interpolate across. Observed on a live dashboard: agent turns populate the AI-coding panel and per-project AI stats while wall-clock duration is driven only by the editor plugins.

Why it matters

A developer who works through the agent sees their agent coding time land in WakaTime as attribution but close to zero duration, so the AI-vs-human time breakdown still undercounts the agent's share and billable-hours totals stay driven by the editor alone. Duration accrual is what makes the shipped send-side integration reflect real time spent, which was the point of feeding agent work into the AI-coding lane.

Not a goal

  • Does not change the display side (the dashboard stats panel's totals, averages, or project count); this PR only changes what the send side emits.
  • Does not touch the end-of-turn attribution heartbeat's fields or its approval gating; the cadence beat is added alongside it, not a replacement.
  • Does not emit heartbeats for non-interactive turns (cron, injected, restricted, or app slots), or introduce any new egress field beyond the existing project label.

What changed (motivation → approach → change)

Goal: give WakaTime enough intra-turn cadence to accrue duration, without disturbing the attribution the end-of-turn beat already gets right.

Approach: emit an attribution-free cadence heartbeat at the points where a coding tool is known to have executed, in addition to (not instead of) the end-of-turn attribution beat. Keeping the two separate is what makes the change safe: the cadence beat carries no token or line-change fields, so it can never double-count attribution however often it fires, and it is only ever scheduled past the gating decision, so a denied tool is never counted as activity. Only the end-of-turn beat carries the deltas. The alternative (emitting at dispatch time, before the permission decision) was rejected because it could schedule a beat for a tool that is then denied.

Change: a new note_coding_cadence producer builds the field-free ai coding beat and schedules it fire-and-forget. A single _wt_maybe_cadence() helper in _run_chat owns the per-turn throttle (CADENCE_MIN_INTERVAL_SECS, 120s) and the scope guard (interactive user turns only, never restored, restricted, or an app slot), and re-checks the wakatime.enabled + wakatime.send_heartbeats opt-in inside the send task. It is called from two post-gating points: the per-approval path (_wt_note_approved) for prompted coding tools, and the EVENT_TOOL_RESULT completed frame for coding tools that executed without a decision. The pending-key discriminator keeps each coding tool to one beat: an approved tool's key is drained at EVENT_PERMISSION_REQUEST, so it is gone by result time and does not re-beat; an auto-approved tool's key is still pending at its result, so it beats once there. The 120s throttle matches WakaTime's coalescing bucket so a burst of tool calls produces one beat rather than flooding the API.

Since first review (commit e007468)

The First Principles and Design reviews raised the same advisory CONCERNS: the cadence beat fired only from the per-approval path, so a turn made entirely of auto-approved / pre-authorized coding tools accrued no intra-turn duration, which is exactly the harm #11336 names for operators who trust their write tools. The second commit closes that gap. A throttled cadence beat now also fires in the EVENT_TOOL_RESULT arm when a coding tool reaches its completed frame, where the tool has demonstrably executed and the decision point is already past. The discriminator keeps every coding tool to exactly one cadence opportunity: an approved tool's pending key is drained at EVENT_PERMISSION_REQUEST and is gone by result time (no re-beat), while an auto-approved tool's key is still pending so it beats once here and nowhere else. A denied tool never reaches tool_final with a pending key, so it still emits nothing, and the _wt_maybe_cadence scope guard (user-only, not restored/restricted/app, 120s throttle) is unchanged. The security-class concern from the earlier sha (emission before the permission decision) does not apply to this emission point, which is strictly past the tool result. Two review-flagged test defects are also fixed: the throttle is now pinned by test_many_auto_approved_coding_results_emit_one_throttled_cadence (five completing coding calls, one beat), and test_mcp_name_fallback_is_not_used_by_chat_runner is restored as its own method after its body had been grafted onto the tail of test_restored_queued_turn_emits_no_cadence_heartbeat, which had lost its name and pin.

Backwards compatibility

Compatible: adds one new opt-in-gated producer and one throttled call site; changes no config key, signature, or default, and sends nothing unless the existing wakatime.send_heartbeats flag (default off) is set.

Removes nothing: no path, record, validator, key, or public function is removed, renamed, or tightened; the change is purely additive behind an existing default-off flag.

Tests

  • test/test_wakatime_heartbeats.py: test_cadence_heartbeat_carries_no_attribution locks in that a cadence beat carries no ai_input_tokens/ai_output_tokens/ai_line_changes; test_send_flag_off_schedules_nothing and test_cadence_send_drops_when_opt_in_is_off lock in that it is a no-op when the send flag is off; test_cadence_schedules_a_task_without_reading_config locks in the fire-and-forget schedule.
  • test/test_chat_runner_coverage.py: test_approved_coding_call_emits_one_cadence_heartbeat locks in that an approved coding call emits one cadence beat; test_auto_approved_coding_call_emits_one_cadence_heartbeat locks in that an auto-approved call (no permission decision) emits one beat at its completed result frame; test_many_auto_approved_coding_results_emit_one_throttled_cadence drives five completing coding calls in one turn and pins the 120s throttle collapsing them to a single beat.
  • test/test_chat_runner_coverage.py: test_denied_coding_call_emits_no_cadence_heartbeat, test_restored_queued_turn_emits_no_cadence_heartbeat and test_injected_turn_emits_no_cadence_heartbeat lock in that a denied, restored, or non-user (cron/injected) turn emits none.

Manual verification

N/A — unit coverage is sufficient. The producer is exercised through the stubbed WakaTimeClient and the dispatch path through a scripted _run_chat turn; a live WakaTime call is covered by the client's own tests from the first backend PR (#8169).

Related Issues

Closes #11336.

Checklist

  • At most two commits (two here: the dispatch producer, plus one addressing review CONCERNS), with a Conventional Commits title (feat: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable) — the heartbeats.py module docstring now describes cadence + end-of-turn emission
  • No secrets, credentials, or internal references in the diff

@Behordeun
Behordeun requested review from a team and iamwhatever and a lite review from Copilot September 23, 2026 20:27

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@dwu96

dwu96 commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

👋 Hi! This PR's description is missing some required sections from our PR template. Workflow runs won't be auto-approved until the description is updated.

Missing sections:

  • ## Why it matters
  • ## Tests

Please update your PR description to include these sections, then push or re-save the description. The workflows will be approved on the next cycle.

@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention labels Sep 23, 2026
@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

Reviewed d61eac3a1819c097e7149bf07455cfd25a55cf5e via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] d61eac3

@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5, fork) — ✅ PASS

Premise-level review of d61eac3a1819c097e7149bf07455cfd25a55cf5e via the fork AI-review pipeline — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: PASS

Check that WakaTime's keystroke timeout really defaults to two minutes, as CADENCE_MIN_INTERVAL_SECS claims. The 120s throttle's justification rests on that number.

What this change ships

Inventory (6 items) — 4 justified

Intent: let a developer's agent coding turns build up real coding time on their WakaTime dashboard, not only AI attribution (closes #11336). This is an ADDITION behind the existing default-off send_heartbeats flag.

  1. An approved coding tool now sends a mid-turn WakaTime heartbeat that carries no token or line counts — justified
  2. A coding tool that runs without a permission prompt sends the same mid-turn heartbeat when its result arrives — justified
  3. Mid-turn heartbeats are limited to one per 120s per turn (CADENCE_MIN_INTERVAL_SECS, used only in chat_runner.py) — justified
  4. The mid-turn heartbeat skips the flag check on the calling thread; the send task checks it instead, so every coding turn now schedules a task even when the feature is off — justified
  5. The existing test test_enabled_and_opted_in_sends_one_heartbeat drops its sleep(0) polling loop for a bounded wait on the scheduled task — rides along, undeclared, no harm
  6. test_mcp_name_fallback_is_not_used_by_chat_runner gets an explanatory comment — rides along

[FIRST-PRINCIPLES-REVIEWED] d61eac3

Description read

[DESCRIPTION-READ] f49866a9ceb75adacc73376331d3753fa7b16ae4f5d28852cd828fbeb39a2f1d

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — ✅ no blocking findings

Reviewed d61eac3a1819c097e7149bf07455cfd25a55cf5e via the fork AI-review pipeline; updated in place on each push.

Review details

FINDING -- src/kiro_crew/dashboard/chat_runner.py:9318 -- “Fires only after … an approved permission decision” contradicts the completed EVENT_TOOL_RESULT path, which emits cadence for auto-approved coding tools without a permission request -> Fix: describe both approval and completed-result emission paths in the changed helper and producer docstrings.
[GPT-REVIEWED] d61eac3

@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of d61eac3a1819c097e7149bf07455cfd25a55cf5e via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Check a live WakaTime dashboard to confirm a multi-tool agent turn now adds duration. The unit tests stub the client, so they never test that premise.

[DESIGN-REVIEWED] d61eac3

Description read

[DESCRIPTION-READ] 6e5399fc3289650a65d25bd338f8f2a3dbea3d8f3aa4ee8ce226653de5ef7284

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@Behordeun
Behordeun force-pushed the feat/wakatime-cadence-heartbeats branch from 3e3e3c1 to 4c2aace Compare September 24, 2026 12:23
@Behordeun

Copy link
Copy Markdown
Contributor Author

Both blocking findings from the GPT review of 3e3e3c131 are addressed in 4c2aace36, and the branch is rebased onto current main (the earlier Backend Lint & Type Check failure was a stale-baseline artifact of an older base and the CloudFormation Lint failure was a runner TLS error — both clear on the rebase).

F1 (BLOCKING-FENCED, chat_runner.py — cadence recorded ineligible dispatches) — fixed. The cadence beat no longer fires in the pre-decision EVENT_TOOL_CALL branch. Emission moved to CONFIRMED coding only: the shared _wt_maybe_cadence() helper fires from _wt_note_approved (an approved permission decision) and once at the end-of-turn reconciliation that confirms unguarded execution. A denied tool therefore emits no is_write ai coding row. Same scope as the end-of-turn beat (interactive user turns, never restricted/app) and the same per-turn throttle. Pinned by test_denied_coding_call_emits_no_cadence_heartbeat.

F2 (BLOCKING, heartbeats.py — config load on the event loop) — fixed. note_coding_cadence now does zero on-thread config I/O: it always schedules the fire-and-forget send, and send_heartbeat re-checks the opt-in and resolves the destination off the loop inside its own task (dropping the row when disabled). So the dispatch/confirmation path performs no synchronous stat/read/validate. Pinned by test_cadence_schedules_a_task_without_reading_config (asserts no KiroCrewConfig.load on the calling thread) and test_cadence_send_drops_when_opt_in_is_off (the off-loop gate still drops a disabled row).

Verified: test_wakatime_heartbeats.py + test_chat_runner_coverage.py (341) pass; black / isort / flake8 / mypy --platform linux and Codacy pylint clean on the changed files.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 24, 2026
@dodgeblaster dodgeblaster added the needs-pr-triage PR scanner: awaiting automated triage label Oct 3, 2026
@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 3, 2026
@dodgeblaster

Copy link
Copy Markdown
Contributor

🤖 Kiro Crew [operator: dodgeblaster#b5f0d847]: This PR has been inactive for 7+ days. I reviewed the blockers but they require your input:

  • GPT 5.6 BLOCKING, security-class (withheld from adjudication, so the verdict stands) at chat_runner.py:11834 — a denied/restored write dispatch routes through note_coding_cadence and emits an is_write WakaTime row for activity that never qualified. Opus 5 flags the companion at chat_runner.py:9432 (gateway-restart replay drops the _turn_provenance_restored conjunct and emits a row the existing guard refuses). A security-class finding needs a repo-writer's judgment, not an automated push.
  • First Principles CONCERNS: note_coding_cadence is argued to be a second spelling of note_coding_activity(project), and its end-of-turn beat lands in the same ~2-minute bucket WakaTime coalesces away — i.e. whether the second heartbeat should exist at all. That is a design-direction call only you can make.

When you've addressed these, the pipeline will re-assess on its next cycle.

The heartbeat producer sent one beat at end-of-turn, so a turn landed its AI attribution (tokens, lines, prompts, sessions) but almost no wall-clock duration: WakaTime derives duration from the gaps between heartbeats, and a single beat gives it none. A long agent turn therefore read as an instant against the editor plugins' own time.

Emit an attribution-free cadence heartbeat on each coding-tool dispatch (the same is_coding_event classification the end-of-turn beat uses), so several beats span a turn and WakaTime accumulates duration the way an editor plugin does. The cadence beat carries no token or line-change fields — those ride the end-of-turn beat alone — so it can fire before a tool's permission decision without ever counting a denied tool as activity, and it never double-counts attribution however often it fires. Dispatch-time emission is throttled per turn to CADENCE_MIN_INTERVAL_SECS (120s), matching WakaTime's ~2-minute coalescing bucket so a burst of tool calls does not flood the API. The beat honors the same scope as the end-of-turn beat: interactive user turns only, never a restricted or app slot, and it re-checks the send opt-in inside the fire-and-forget task.

Closes #11336.
@Behordeun
Behordeun force-pushed the feat/wakatime-cadence-heartbeats branch from 4c2aace to 1c0c673 Compare October 8, 2026 08:05
@Behordeun
Behordeun requested review from a team and KiroCrewCaptain as code owners October 8, 2026 08:05
@Behordeun

Copy link
Copy Markdown
Contributor Author

Pushed 1c0c67368, rebased onto current main and addressing the open review items.

Opus BLOCK (restored-replay scope) fixed. The cadence scope gate now carries the same not _turn_provenance_restored conjunct the end-of-turn beat uses, so a gateway-restart replay (a restored queued prompt whose actor stamp was lost) emits no cadence beat even when a coding call is approved during it. Pinned by test_restored_queued_turn_emits_no_cadence_heartbeat.

Advisory same-timestamp beat removed. The end-of-turn _wt_maybe_cadence() call fired microseconds before note_coding_activity, and WakaTime coalesces same-bucket beats, so it added no duration. It is gone. Cadence now comes only from per-approval confirmation in _wt_note_approved, which is where intra-turn spacing actually accrues. The end-of-turn attribution beat still lands for auto-approved-only turns, so no turn loses its token and line-change deltas.

Merge conflict cleared. The branch was behind main; it is rebased onto the current tip, so the import collision in chat_runner.py is resolved and the branch is a single clean commit again.

Verified on the rebased tree: 397 tests pass (including the updated cadence tests and the new restored-replay regression), black format and baseline, isort, mypy strict on both changed source files, and the sync-io-in-async gate all green. The sync-io gate passing confirms the cadence producer still does zero on-loop config I/O.

GPT's last verdict was against the old SHA 3e3e3c131 and flagged the pre-decision dispatch emission that no longer exists; it should refresh against 1c0c67368 on the re-run.

@github-actions github-actions Bot removed the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 8, 2026
@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — ⏭️ skipped

Revision d61eac3a1819c097e7149bf07455cfd25a55cf5e touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Advisory — does not block merge.

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 9, 2026
@Behordeun
Behordeun force-pushed the feat/wakatime-cadence-heartbeats branch from e007468 to fb6efb0 Compare October 9, 2026 17:11
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 9, 2026
@Behordeun
Behordeun force-pushed the feat/wakatime-cadence-heartbeats branch from fb6efb0 to a296ada Compare October 9, 2026 17:36
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 9, 2026
@Behordeun
Behordeun force-pushed the feat/wakatime-cadence-heartbeats branch from a296ada to 2d1c1c0 Compare October 9, 2026 17:56
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Oct 9, 2026
@Behordeun

Copy link
Copy Markdown
Contributor Author

This one is ready for a maintainer review when someone has a moment.

What it does: agent coding turns currently accrue WakaTime attribution but little coding-time duration, because cadence beats only fired on an explicit permission approval. This makes an auto-approved (pre-authorized) coding tool emit one throttled cadence beat at its completed result frame, so a turn of trusted tools accrues intra-turn duration like a prompted one. Closes #11336.

State on head 2d1c1c0: MERGEABLE, every real check green (Backend Lint & Type Check, SAST, all Backend Tests shards, Coverage Gate, PR Hygiene, Await Fast Gate, Builtin Skill Scope Gate, and the same-repo review lanes). The only fork AI-review lanes showing non-success are the infra/quota fork copies; their same-repo counterparts passed. The two advisory CONCERNS (First Principles, Design) are addressed in code and answered point-by-point in the review reply above.

The sole remaining gate is this human approval. Two small open questions are flagged in the reply for your call, not blockers: whether note_coding_cadence should fold into note_coding_activity, and whether the 120s throttle constant should cite its WakaTime source inline (already added to the docstring).

A coding tool that runs under a pre-authorized trust decision never passes through the permission-request path, so the per-approval cadence beat never fires for it. Emit the throttled beat at the EVENT_TOOL_RESULT completed frame for a coding tool whose pending key is still present, which is exactly the auto-approved case: an approved tool's key was drained at the permission request and already produced its beat, so this adds no second beat for it, and a denied tool never reaches a completed frame with a pending key. The scope guard and the per-turn throttle are unchanged, so the denied-tool and restored/restricted/app guarantees still hold.

Restore test_mcp_name_fallback_is_not_used_by_chat_runner as its own method; its body had been grafted onto the tail of the restored-queued test, losing its name and isolation.

Await the scheduled send task under a bounded timeout in the async heartbeat tests instead of a fixed count of asyncio.sleep(0) yields. The producers schedule send_heartbeat with loop.create_task, and send_heartbeat awaits asyncio.to_thread for its destination read before it reaches the client, so a thread-pool round-trip is not deterministically outlasted by any fixed number of bare event-loop yields. A create_task spy captures the scheduled tasks and the test awaits them with a time limit, so the batch assertions run after the send has actually resolved.

Cite WakaTime's own two-minute edit-heartbeat throttle convention and its duration-combining algorithm on CADENCE_MIN_INTERVAL_SECS, so the 120s window is grounded in the provider's documented default rather than an assumed one.
@Behordeun
Behordeun force-pushed the feat/wakatime-cadence-heartbeats branch from 2d1c1c0 to d61eac3 Compare October 11, 2026 16:45
@Behordeun

Copy link
Copy Markdown
Contributor Author

Addressed the GPT 6.1 blocking finding (F1, test determinism) on d61eac3a1.

The flagged tests polled for a scheduled send with a fixed count of asyncio.sleep(0) yields. That races send_heartbeat, which awaits asyncio.to_thread(_load_destination) for its destination read before it reaches the client, and a thread-pool round-trip is not deterministically outlasted by any fixed number of bare event-loop yields. That is the sleep-as-a-barrier the tests-are-deterministic rule forbids.

Fix: a _run_scheduled_sends helper spies on the running loop's create_task, captures the task each producer schedules, and awaits it under a bounded asyncio.wait_for(task, timeout). The batch assertions now run only after the send has actually resolved. Applied to both tests the finding named (test_cadence_send_drops_when_opt_in_is_off, test_cadence_heartbeat_carries_no_attribution) and to test_enabled_and_opted_in_sends_one_heartbeat, which carried the identical pattern on the note_coding_activity path.

Verified on d61eac3a1: 23 heartbeat tests plus the 18 chat_runner WakaTime tests pass, mypy clean on the source tree, black/isort/flake8 clean on the changed file.

On the two advisory First Principles CONCERNS, since they ride the same revision:

Item 4 (the 120s / WakaTime-timeout premise): CADENCE_MIN_INTERVAL_SECS now cites WakaTime's own two-minute edit-heartbeat throttle convention and its duration-combining algorithm, so the window is grounded in the provider's documented default. Heartbeats spaced at or beyond that default fall outside the combining window and accrue duration as separate segments, which is the behavior the Goal wants.

Item 3 (note_coding_cadence as a second spelling of note_coding_activity): the two are not interchangeable at the call site. note_coding_cadence runs on the ACP per-decision hot path and deliberately reads no config on the calling thread, scheduling the send and letting send_heartbeat re-check the opt-in off the loop. note_coding_activity reads config on the calling thread for its early return. Collapsing them would move a synchronous config read onto the hot path. I have left both in place and am happy to fold them if a measured cost shows the pre-check is cheap enough to move; flagging it as the open question rather than deciding it silently.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 11, 2026

@iamwhatever iamwhatever left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This PR gives WakaTime intra-turn timestamps so agent coding turns accrue duration, not just attribution. It adds an attribution-free cadence heartbeat, throttled to one per 120 s per turn, fired after an approved coding call and at the completed result frame of an auto-approved one. The end-of-turn attribution beat is unchanged. I read heartbeats.py, both call sites in chat_runner.py and the gating around _wt_pending_coding. The security-class concerns from dodgeblaster's 2026-10-03 note are fixed on head d61eac3. A denied call's key is discarded at EVENT_PERMISSION_REQUEST, so it can reach neither the approval beat nor the result-frame beat. The scope guard now carries not _turn_provenance_restored beside the user-actor, restricted-slot and app-slot checks, so a restart replay, cron or injected turn emits nothing. The cadence beat carries only the existing project label, adds no new egress field, and send_heartbeat re-checks the default-off wakatime.send_heartbeats opt-in off the loop before sending. The GPT determinism finding was answered by waiting on the captured send tasks instead of counted yields. Checks are green and both lanes PASS. Small nit: the _wt_maybe_cadence and note_coding_cadence docstrings still say the beat fires only on an approved decision. The needs-author-decision label was set while those blockers were open and looks stale now; a maintainer should remove it. — crew-pr-reviewer (deep re-check)

@iamwhatever
iamwhatever enabled auto-merge (squash) October 12, 2026 17:19
@iamwhatever
iamwhatever merged commit 3a0145f into kirodotdev:main Oct 12, 2026
104 checks passed
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor) needs-author-decision PR blocked on author input

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WakaTime heartbeats accrue attribution but not coding-time duration (tool-dispatch emission follow-up to #9450)

5 participants