Count what each provider actually serves, and name the model that answered each turn - #136
Merged
Merged
Conversation
…wered each turn Refs #39 Co-Authored-By: Colonizer <noreply@colonizer.dev>
#136 makes TurnSummary.models required, which `tsc --noEmit` caught against the fixtures the CI tests (#138) landed with: neither knew the field. The fixtures carry it now, and the diff-against-the-previous-turn rule it exists for has tests of its own — the models a turn actually served, biggest share first, and nothing named when no total grew. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
ParallelEntrepreneur
added a commit
that referenced
this pull request
Sep 18, 2026
#136 rewired the `openai`-wire response path to count what each provider serves; this branch rewired the same path to price what a colony spends. Both now run on one path: `openai_response` takes the provider's counters and the spend recorder the caller already builds, so a routed response is counted once and priced once. `pricing` joins main's `Provider` fixtures, and the protocol doc lists `pricing` beside `usage` and `used_by`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
ParallelEntrepreneur
added a commit
that referenced
this pull request
Sep 23, 2026
#136 makes TurnSummary.models required, which `tsc --noEmit` caught against the fixtures the CI tests (#138) landed with: neither knew the field. The fixtures carry it now, and the diff-against-the-previous-turn rule it exists for has tests of its own — the models a turn actually served, biggest share first, and nothing named when no total grew.
ParallelEntrepreneur
added a commit
that referenced
this pull request
Sep 23, 2026
Count what each provider actually serves, and name the model that answered each turn
ParallelEntrepreneur
added a commit
that referenced
this pull request
Sep 23, 2026
#136 rewired the `openai`-wire response path to count what each provider serves; this branch rewired the same path to price what a colony spends. Both now run on one path: `openai_response` takes the provider's counters and the spend recorder the caller already builds, so a routed response is counted once and priced once. `pricing` joins main's `Provider` fixtures, and the protocol doc lists `pricing` beside `usage` and `used_by`.
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.
#122 cherry-picked onto current
main, with three trivial conflicts resolved and one compile break fixed that only appears on top of today'smain. #122 is superseded by this. Closes #39.A user wired a local DeepSeek server into Colonizer, saw Settings report it
Reachable · 1 ms · 1 model, and concluded the local model was never used. Nothing was broken: the provider was pointed atsubagent_model, and colonies almost never spawn subagents, so it legitimately saw almost no traffic. The gateway was the only component that knew anything, and it kept only live gauges — in-flight and queued, both zero whenever nobody is mid-request, which is almost always. "Is this thing ever used?" had no answer in the UI.This adds the record, and makes the UI say what it knows and no more.
requests,failures,fallbacks,duration_ms,last_request_at, backed by atomics with aTimedRAII guard so a panic mid-request still counts. They survive a restart inprovider-usage.jsonunder the data directory, written back when dirty by a flush loop; a missing or corrupt file means the counters start over, never that the gateway fails to build.+Nand a tooltip when more than one was involved.What changed on the way
main.rsstartup tasksversion::run(the update check, merged since) andgateway::flush_loopChatPanel.tsxSettingsDialog.tsximportsmeshBroken(#128) andformatDuration(this branch) both surviveOne break git could not see.
Gateway::new()grew adata_dirargument on this branch, andmain.rshas a test helper — added onmainafter this branch was cut — that still called it with none. The cherry-pick merged cleanly and then failed to compile:Fixed here by passing the helper's own temp root. Worth noting because a textual merge would have produced exactly the same break with no conflict to warn anyone.
Testing
cargo test -p colonizer-harness— 180 pass (three new).npx tsc --noEmitclean,npm run buildsucceeds. The web suite has nonpm testscript yet; #132 adds one.