Skip to content

fix(stats): add TurnOutcome to prevent quick-exit paths from inflating turn count#450

Merged
Aaronontheweb merged 5 commits into
devfrom
claude-wt-turn-count
Mar 27, 2026
Merged

fix(stats): add TurnOutcome to prevent quick-exit paths from inflating turn count#450
Aaronontheweb merged 5 commits into
devfrom
claude-wt-turn-count

Conversation

@Aaronontheweb

Copy link
Copy Markdown
Collaborator

Summary

Closes #440

  • Adds TurnOutcome enum (Completed, Failed, Skipped) to TurnCompleted output
  • Tags vision-only rejections, skill file errors, and unknown slash commands as Skipped
  • Tags FailCurrentTurn error path as Failed
  • SessionCatalogService only increments turn_count for Completed and Failed; Skipped turns just update last_activity

The 7:17 turns-to-replies ratio reported in the issue is expected behavior — each turn with tool calls produces 2+ Slack replies (preamble text before tools + final text after). The real bug was quick-exit paths (LLM never invoked) inflating the catalog count.

Test plan

  • ErrorCorrelationTests — verify TurnOutcome.Failed on provider failure and timeout
  • ModalityGateTests — verify TurnOutcome.Skipped on image-only messages
  • SessionCatalogServiceTests — verify Skipped doesn't increment turn_count, Failed does
  • Full test suite (689 actor + 16 daemon tests pass)

…g turn count (#440)

Add TurnOutcome enum (Completed, Failed, Skipped) to TurnCompleted so
downstream counters can distinguish real turns from quick-exit no-ops.

Vision-only rejections, skill file errors, and unknown slash commands now
emit TurnOutcome.Skipped. FailCurrentTurn emits TurnOutcome.Failed.
SessionCatalogService only increments turn_count for Completed and Failed
outcomes; Skipped turns update last_activity only.
@Aaronontheweb Aaronontheweb marked this pull request as ready for review March 26, 2026 16:55
@Aaronontheweb Aaronontheweb enabled auto-merge (squash) March 26, 2026 16:55
@Aaronontheweb Aaronontheweb added bug Something isn't working stats Stats, metrics, and telemetry labels Mar 26, 2026
@Aaronontheweb Aaronontheweb disabled auto-merge March 26, 2026 16:58
…sumers

- Add TurnOutcome to SessionOutputDto and round-trip it through
  SessionOutputDtoMapper (ToDto/FromDto) so the field survives
  SignalR transport
- Include outcome in SessionLogActor log lines and memory observer
  transcripts for diagnostic clarity
- Skip updating memory observer _turnCount for Skipped turns
- Inject FakeMetrics into catalog service tests to verify
  RecordTurnCompleted is called for Failed but not Skipped
@Aaronontheweb Aaronontheweb enabled auto-merge (squash) March 27, 2026 01:33
@Aaronontheweb Aaronontheweb merged commit 3eae904 into dev Mar 27, 2026
3 checks passed
@Aaronontheweb Aaronontheweb deleted the claude-wt-turn-count branch March 27, 2026 01:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working stats Stats, metrics, and telemetry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(stats): turn count underreports — turns that timeout or error before TurnRecorded are not counted

1 participant