Skip to content

Fix bug where cost always shows zero for Haiku models if prompt injection guard is ON#2065

Merged
flin-8 merged 5 commits into
mainfrom
frank/promptusage
Jul 9, 2026
Merged

Fix bug where cost always shows zero for Haiku models if prompt injection guard is ON#2065
flin-8 merged 5 commits into
mainfrom
frank/promptusage

Conversation

@flin-8

@flin-8 flin-8 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Server expects one service message per model type (unique DB key).

Prompt injection was sending its own service message, so the main CLI invocation's usage stats would be dropped if its model was the same.

This PR accumulates the usages and only writes it at the end.

Relates to MD-2256: Cost always shows zero for Haiku models

@flin-8 flin-8 self-assigned this Jul 8, 2026

@liam-mackie liam-mackie 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.

LGTM, minor nit on comments, but the bones are good.


namespace Calamari.AiAgent.ClaudeCodeBehaviour;

/// <summary>

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.

Nit: These comments are pretty overdone, would prefer removing some unnecessary summaries.

@flin-8
flin-8 enabled auto-merge (squash) July 9, 2026 01:10
@flin-8
flin-8 merged commit 0fd459b into main Jul 9, 2026
35 checks passed
@flin-8
flin-8 deleted the frank/promptusage branch July 9, 2026 01:35
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.

2 participants