Skip to content

Show the hourly budget and spare the cheat sheets - #1

Merged
sergeyfast merged 9 commits into
masterfrom
release/v0.0.2
Sep 30, 2026
Merged

sergeyfast merged 9 commits into
masterfrom
release/v0.0.2

Conversation

@sergeyfast

@sergeyfast sergeyfast commented Sep 30, 2026 •

Copy link
Copy Markdown
Member
  • Update mcpkit to v0.1.4: a rate-limit denial is a 429 with JSON-RPC error -32010 and the wait and the budget in data, instead of a text/plain 429 a bridge showed as "server unavailable"
  • Spare help, repo_map, resources, prompts, the handshake and the lists the hourly budget, so a spent budget no longer takes away the cheat sheets and the reconnect first; RPM and the concurrency limits still apply to them
  • Add budget (used, limit, left, reset_in) to the answers of every tool that spends it and of help, with the call's own work in it, so a long investigation narrows its queries before it hits the ceiling
  • Label every charge with the target or repository that did the work, so app_mcp_ratelimit_charge_seconds says who spent the budget; the code tools' charges move off the wall_clock label
  • Bill a search across repositories for each of them, as a batch is billed, rather than for the slowest by the wall clock
  • Tell the model about the budget only on an instance that has one
  • Document topsrv host addresses and an IP-to-host recipe in the cheat sheet
  • Replace internal names in fixtures and comments with neutral ones
  • Run golangci-lint v2.13.2 in CI, as the Makefile does, with golangci-lint-action v9 and checkout v6
  • Test the exemptions and a spent budget through the whole endpoint, the labels per call, statement, window, repository and tracker, and that used holds an answer's own work

- Add addresses to host.list/host.get and an IP-to-host recipe, so
  the model finds whose machine an IP from a DSN is instead of
  guessing it from metric labels
- Note the pitfalls: an empty list proves nothing, network is the
  interface mask (/32 in clouds), the Nomad bridge still comes through
- Extend the hosts fixture and assert DefaultJQ keeps addresses whole
- Take the rate-limit denial as a JSON-RPC error -32010 with the
  reason, retry_after and the budget in data, instead of a text/plain
  429 the bridge showed as "server unavailable"
- Take the transport's refusal of a repeated key and of a call without
  an id, and the RPM fix for slow batches
- Assert in the conformance test that the 429 answers the call
- Exempt help, repo_map, resources/read and prompts/get from the hourly
  budget: they cost nothing and teach the caller to spend less, and a
  spent budget used to take them away first
- Exempt the handshake and the lists too, so a bridge reconnecting with
  the budget spent can still connect and ask for help
- Keep RPM and the concurrency slots on every exempt call
- Test the exemptions and a spent budget through the whole endpoint
- Label every charge with the target it went to: api_call per call,
  db_query per statement, db_introspect per table, so
  app_mcp_ratelimit_charge_seconds{label} says who spent the budget
  instead of an evening of summing duration_ms in Loki
- Label only after the catalogue has resolved the target, so a name
  the caller made up cannot become a series
- Add budget (used, limit, left, reset_in) to the answers of api_call,
  db_query and db_introspect, with the call's own charges in it, so a
  long investigation narrows its queries before it hits the ceiling
- Add it to help as well: exempt from the budget, it is the one call
  that still answers once the budget is spent
- Tell the model in the instructions what the field and a -32010
  refusal mean, and that help and repo_map keep working
- Note in local.toml.dist which calls the budget spares
- Charge code_read per window, code_search per repository and the
  other code tools per call, so their answers carry the budget with
  the call's own work in it, and the charge histogram shows which
  repository spent it
- Bill a search across repositories for every one of them, as a
  batch is billed, rather than for the slowest by the wall clock
- Charge the tracker lookup in why under the tracker's own name
- Tell the model about the budget only when CostBudgetPerHour is
  set, as one rule for every paid tool instead of a list
- Take the handshake methods and the refusal code from mcpkit
- Test that used holds the answer's own work summed, that charges
  are labelled per window, repository and tracker, and that the
  spared calls answer without any error
- Let the topsrv jq example pass a host without addresses
- Rename the task keys in fixtures from a real tracker project to
  ABC-, and drop the key of a real incident from a comment
- Rename service and function names borrowed from real projects in
  fixtures and comments to made-up ones
@sergeyfast
sergeyfast merged commit 4d4eeed into master Sep 30, 2026
2 checks passed
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