A Claude Code turn relayed on Messages with its advisor on has the advisor run at the vendor. The reply's top-level usage is the executor's alone; each advisor call is an advisor_message entry of usage.iterations, billed at the advisor model's rates (Anthropic's advisor tool page, "Usage and billing"). magpie read only the top level, so an Opus advisor beside a Sonnet executor was in no row and priced nowhere. aUsage reads iterations, whole and from a stream's message_delta (whose list is cumulative, so the latest stands for the reply). Each advisor call becomes its own row (advisorRows, written by appendAdvised at every row of a try that reached a provider, and on the native route): under the advisor's model by magpie's id (advisorKeyModel of the request's advisor tool), Served as the vendor names it, Kind "advisor" (named Advisor in Usage's filters, already translated), the request's route, agent, account and session, status 200, counted as its own request as magpie's own advisor calls already are. The executor's row is unchanged. Routing prices the calls too, before the request's own usage so the prompt is still read from the last entry. Iterations with no advisor entry (Copilot) leave Usage as it was. The fixture is Anthropic's documented example word for word; no real reply with an advisor call was captured. The core script budget is raised by 52, the Advisor entry in the generated purposes.js (the base had no room; 1 byte less is red). The kinds are read wherever Usage and Routing draw a row, so there is no page to move it to. Run at this commit's tree onf1b0663f1, then onb1f044fc1(which changed core scripts only, i18n.js and syncfiles.js, so internal/gui and the GUI files were run again there): - mica: gofmt -l (nothing), go vet (darwin), GOOS=linux go vet -tags nogui, GOOS=windows go vet for internal/gateway, internal/usage, internal/gui: ok. - mica: go test -timeout 45m -count=1 ./internal/gateway ./internal/usage ./internal/gui: ok (916s, 64s, 161s). - mote: node --test purpose-filter, routing-purpose-state, usage-big-write, usage-ledger-mcp, usage-ledger-search, i18n-keys (Chromium and WebKit): 74 of 74 pass. - Onb1f044fc1, the pushed base: mica go test -timeout 45m -count=1 ./internal/gui ok (147s); mote the same six GUI files, 74 of 74 pass. - Before the rebase, atae94571d7, the same packages on mote were ok except TestCoreScriptBudget, which this commit's budget line answers. Broken by hand: - aUsage.usage never setting advised: TestAdvisorIterationsRead red ("stream=false: advisor calls <nil>, want one"), TestAdvisorCallHasItsOwnRow red in both subtests ("advisor rows: []"). - passthrough without advisedAs: TestAdvisorCallHasItsOwnRow red in both subtests, the row named claude-opus-5-5 and not magpie's claude-opus-5.5. Not tried: a real Anthropic reply with an advisor call (no account with the advisor beta at hand); Bedrock and Vertex passthrough with an advisor (they share the sniffer, not run); the Usage page with an advisor row in a real browser session beyond the GUI files above. Reported by Refeccd on Discord.
3 lines
2.4 KiB
JavaScript
3 lines
2.4 KiB
JavaScript
// Code generated by go generate ./internal/usage; DO NOT EDIT.
|
|
const REQUEST_KINDS = {"advisor":{"purpose":"kind:advisor","name":"Advisor"},"agent_job":{"purpose":"kind:collab_spawn","name":"Subagent"},"agent_summary":{"purpose":"kind:agent_summary","name":"Progress summary"},"agent_summary_inferred":{"purpose":"kind:agent_summary","name":"Progress summary (inferred)"},"ambient_suggestion_safety":{"purpose":"kind:ambient_suggestions","name":"Suggestions"},"ambient_suggestions":{"purpose":"kind:ambient_suggestions","name":"Suggestions"},"api_detect":{"purpose":"kind:api_detect","name":"Detect APIs"},"auto_mode_check":{"purpose":"kind:auto_mode_check","name":"Auto mode check"},"auto_mode_check_inferred":{"purpose":"kind:auto_mode_check","name":"Auto mode check (inferred)"},"auto_review":{"purpose":"kind:guardian","name":"Approval check"},"cache_keepalive":{"purpose":"kind:cache_keepalive","name":"Cache keep-alive"},"collab_spawn":{"purpose":"kind:collab_spawn","name":"Subagent"},"compact":{"purpose":"kind:compact","name":"Compaction"},"composer_predictions":{"purpose":"kind:composer_predictions","name":"Prediction"},"connection_check":{"purpose":"kind:connection_check","name":"Connection check"},"guardian":{"purpose":"kind:guardian","name":"Approval check"},"guardian_review":{"purpose":"kind:guardian","name":"Approval check"},"luna_reserve":{"purpose":"kind:luna_reserve","name":"Luna Reserve"},"mcp":{"purpose":"kind:mcp","name":"MCP tool"},"memgen":{"purpose":"kind:memory_consolidation","name":"Memory"},"memory":{"purpose":"kind:memory_consolidation","name":"Memory"},"memory_consolidation":{"purpose":"kind:memory_consolidation","name":"Memory"},"model_list":{"purpose":"kind:model_list","name":"Model list"},"provider_test":{"purpose":"kind:provider_test","name":"Test"},"review":{"purpose":"kind:review","name":"Review"},"routing":{"purpose":"kind:routing","name":"Routing classifier"},"thread_description":{"purpose":"kind:thread_description","name":"Description"},"thread_spawn":{"purpose":"kind:collab_spawn","name":"Subagent"},"thread_title":{"purpose":"kind:thread_title","name":"Title"},"thread_title_reconsideration":{"purpose":"kind:thread_title","name":"Title"},"title":{"purpose":"kind:thread_title","name":"Title"},"title_generation":{"purpose":"kind:thread_title","name":"Title"},"vision":{"purpose":"kind:vision","name":"Image description"},"web_search":{"purpose":"kind:web_search","name":"Web search"}};
|