Skip to content

fix(dashboard): exclude task-notification from human prompt count - #105

Merged
jeff-r2026 merged 1 commit into
mainfrom
fix/prompt-count-task-notifications
Jul 2, 2026
Merged

fix(dashboard): exclude task-notification from human prompt count#105
jeff-r2026 merged 1 commit into
mainfrom
fix/prompt-count-task-notifications

Conversation

@jeff-r2026

Copy link
Copy Markdown
Collaborator

Summary

  • <task-notification> messages (background task completion notifications) were being miscounted as genuine human conversation turns because their isMeta field is null instead of true
  • Added TRANSCRIPT_SYSTEM_PREFIXES constant to filter out system-injected messages in both string and array content branches of scanTranscriptStop
  • Added regression test covering this scenario

Root cause

Claude Code injects <task-notification> entries as type:"user" with isMeta: null when background tasks complete. The existing code only checked isMeta === true to exclude non-human entries, so these notifications slipped through and inflated the prompt count.

Test plan

  • New test: excludes <task-notification> system messages from prompt count
  • All existing prompt-counting tests still pass
  • TypeScript type check passes

🤖 Generated with Claude Code

System-injected task-notification messages have isMeta=null (not true),
causing them to be miscounted as genuine human conversation turns. Add
TRANSCRIPT_SYSTEM_PREFIXES to filter out these automated messages in
both string and array content branches of scanTranscriptStop.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jeff-r2026
jeff-r2026 merged commit 45c40e9 into main Jul 2, 2026
6 of 7 checks passed
@jeff-r2026
jeff-r2026 deleted the fix/prompt-count-task-notifications branch July 2, 2026 08:03
@hsuchifeng hsuchifeng mentioned this pull request Jul 3, 2026
3 tasks
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