fix(stats): add TurnOutcome to prevent quick-exit paths from inflating turn count#450
Merged
Conversation
…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.
…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
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
Closes #440
TurnOutcomeenum (Completed,Failed,Skipped) toTurnCompletedoutputSkippedFailCurrentTurnerror path asFailedSessionCatalogServiceonly incrementsturn_countforCompletedandFailed;Skippedturns just updatelast_activityThe 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— verifyTurnOutcome.Failedon provider failure and timeoutModalityGateTests— verifyTurnOutcome.Skippedon image-only messagesSessionCatalogServiceTests— verify Skipped doesn't increment turn_count, Failed does