Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 0 additions & 36 deletions src/billing.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,42 +333,6 @@ func conversationPieces(entries []TranscriptEntry, skillBodyNames map[string]str
}
add("file_attachments", ext, kindUsage, float64(tokEstimate(w.File.Content)), false)
}
case "deferred_tools_delta":
// The deferred catalog mixes built-in tool names with MCP
// ones — split so each lands in its lane (built-in names are
// part of Claude Code's own overhead, not MCP rent).
lines := e.Attachment.AddedLines
names := e.Attachment.AddedNames
if len(lines) != len(names) {
lines = names // fall back to names-only sizing
}
var builtinPayload, mcpPayload []string
for i, name := range names {
line := name
if i < len(lines) {
line = lines[i]
}
if strings.HasPrefix(name, "mcp__") {
mcpPayload = append(mcpPayload, line)
} else {
builtinPayload = append(builtinPayload, line)
}
}
add("static_overhead", "deferred_tool_names", kindDefinition,
float64(measuredOrEstimate(strings.Join(builtinPayload, "\n"), "deferred_tools_payload")), false)
add("mcp_servers", "catalog_deltas", kindDefinition,
float64(measuredOrEstimate(strings.Join(mcpPayload, "\n"), "deferred_tools_payload")), false)
case "mcp_instructions_delta":
// Per-server when the parallel arrays line up.
if len(e.Attachment.AddedNames) == len(e.Attachment.AddedBlocks) && len(e.Attachment.AddedNames) > 0 {
for i, name := range e.Attachment.AddedNames {
add("mcp_servers", name, kindDefinition,
float64(measuredOrEstimate(e.Attachment.AddedBlocks[i], "prose")), false)
}
} else {
add("mcp_servers", "instructions", kindDefinition,
float64(tokEstimateAs(strings.Join(e.Attachment.AddedBlocks, "\n"), "prose")), false)
}
}
case "assistant":
if e.Message == nil || len(e.Message.Content) == 0 {
Expand Down
14 changes: 10 additions & 4 deletions src/billing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,25 +239,31 @@ func TestDeferredCatalogSplitsBuiltinFromMcp(t *testing.T) {
soItems := lanes["static_overhead"].(map[string]interface{})["items"].([]map[string]interface{})
foundBuiltin := false
for _, it := range soItems {
if it["name"] == "deferred_tool_names" && it["total"].(int) > 0 {
if it["name"] == "observed_builtin_schemas" && it["total"].(int) > 0 {
foundBuiltin = true
}
if it["name"] == "deferred_tool_names" {
t.Errorf("deferred tool delta should not be replayed separately: %v", soItems)
}
}
if !foundBuiltin {
t.Errorf("expected deferred_tool_names under static_overhead: %v", soItems)
t.Errorf("expected observed_builtin_schemas under static_overhead: %v", soItems)
}
mcp, ok := lanes["mcp_servers"].(map[string]interface{})
if !ok {
t.Fatal("expected mcp_servers lane")
}
foundMcp := false
for _, it := range mcp["items"].([]map[string]interface{}) {
if it["name"] == "catalog_deltas" && it["total"].(int) > 0 {
if it["name"] == "slack" && it["total"].(int) > 0 {
foundMcp = true
}
if it["name"] == "catalog_deltas" {
t.Errorf("MCP catalog delta should not be replayed separately: %v", mcp["items"])
}
}
if !foundMcp {
t.Errorf("expected catalog_deltas under mcp_servers: %v", mcp["items"])
t.Errorf("expected slack server under mcp_servers: %v", mcp["items"])
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ func postReconciliationScore(traceID string, billing interface{}) {
recon["cache_creation_delta"], recon["output_delta"])
}

if err := api.Put("/traces/feedback-scores", map[string]interface{}{
if err := api.Post("/traces/feedback-scores", map[string]interface{}{
"scores": []interface{}{score},
}); err != nil {
debugLog("post reconciliation score: %v", err)
Expand Down
Loading