Skip to content

blackbox: cpa proxy turns → lane cpa + served vendor/provider, priced estimated (stacked on #1392) - #1396

Merged
ang-fleet-lander[bot] merged 2 commits into
mainfrom
daedalus/t_d59c7936-cpa-blackbox
Sep 28, 2026
Merged

ang-fleet-lander[bot] merged 2 commits into
mainfrom
daedalus/t_d59c7936-cpa-blackbox

Conversation

@ang-fleet-workers

@ang-fleet-workers ang-fleet-workers Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Card t_d59c7936. Stacked on #1392 (native kimi-oauth + K3 snapshot + Kimi in _infer_vendor_from_model). This branch contains #1392's commits; merge #1392 first, then this rebases to one commit (7fc5851).

Problem

A cpa/kimi-k3 turn (CLIProxyAPI, which serves Kimi, Codex and Grok behind one key) was recorded as provider=cpa, lane_family='other', with no vendor and no cost (billing_mode=unknown).

Change

  • agent/usage_pricing.py
    • NOTIONAL_PROXY_PROVIDERS = {cpa, kimi-code, kimi-cpa, cliproxyapi}, also reached as custom:<name>.
    • resolve_billing_route dispatches a proxy turn on the SERVED model's vendor. It uses the one existing map, _infer_vendor_from_model: moonshotai goes to the kimi-oauth route (K3 snapshot), openai to openai-codex (OpenRouter notional), xai to xai-oauth. All three are estimated. An unknown vendor stays unpriced.
    • codex-* joins the openai vendor prefix.
    • attribute_route(provider, model) returns {vendor, vendor_label, served_provider}. cpa/kimi-k3 gives moonshotai, Kimi (Moonshot), kimi. An unknown model gives vendor-unknown, never other.
  • plugins/blackbox/store.py
    • lane_family never returns other. Proxy lanes return cpa, a custom:<name> lane is unwrapped, anything else returns its own provider name, and an empty provider returns unknown.
    • The backfill now calls lane_family() and no longer keeps a SQL copy of the map. It also re-derives rows already stored as other.
    • Guarded additive columns: turns.lane_family/vendor/served_provider and turn_api_calls.vendor/served_provider, written at insert.
  • plugins/blackbox/last_turn.py: proxy turns get a • Route: vendor Kimi (Moonshot) · provider kimi · lane cpa line. Other lanes are unchanged.

Not in scope: the subs.ace and tokens.ace renderers (scripts/subs_data in hermes-home) belong to the sibling Kimi usage card, which consumes attribute_route and the new columns.

Verified

  • tests/plugins/blackbox/test_cpa_lane_attribution.py has 52 tests. They cover kimi, gpt, codex and grok through every alias and custom:cpa, pricing parity with the native lanes ($0.00465 for 1k/100/500 on K3), the vendor-unknown negative control, every providers.list_providers() name and alias mapping to a named family, the stored columns, the backfill retiring other, and the last-turn line. All 52 pass. With store.py and last_turn.py reverted, 41 of them fail.
  • Neighbour tests pass: blackbox, usage_pricing, vendor fallback and kimi-oauth, 456 in total. test_codex_auto_review_stays_unknown still passes.
  • Not verified yet: the live cpa/kimi-k3 turn on tokens.ace. That waits for the batched restart.

Override: none by design — the 4 refusal lines are #1392's kimi-oauth device-flow terminal errors (access_denied / expired_token in hermes_cli/auth.py), carried here only because this PR is stacked on #1392; a user who denied the browser login must log in again, no operator bypass applies. This PR adds no refusal of its own.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

…ider, priced estimated (t_d59c7936)

- usage_pricing: NOTIONAL_PROXY_PROVIDERS (cpa, kimi-code, kimi-cpa,
  cliproxyapi, + custom:<name>) re-route per SERVED model vendor via the
  one map _infer_vendor_from_model: moonshotai->kimi-oauth route,
  openai->openai-codex, xai->xai-oauth; unknown vendor stays unpriced.
  codex-* added to the openai vendor prefix. attribute_route() gives
  {vendor, vendor_label, served_provider}; unknown -> vendor-unknown.
- blackbox store: lane_family never returns 'other' (proxy -> cpa,
  custom:<name> unwrapped, else the provider's own name, empty -> unknown);
  backfill uses lane_family() instead of a SQL copy and re-derives stored
  'other' rows. turns gains lane_family/vendor/served_provider, turn_api_calls
  gains vendor/served_provider (guarded additive ALTER).
- last_turn: proxy turns render 'Route: vendor Kimi (Moonshot) · provider kimi · lane cpa'.

Verified: new test file 52 passed; 41 fail with store.py+last_turn.py reverted;
blackbox + usage_pricing + kimi-oauth neighbours 456 passed.
@ang-fleet-interactive
ang-fleet-interactive Bot force-pushed the daedalus/t_d59c7936-cpa-blackbox branch from 7fc5851 to 4071e0e Compare September 28, 2026 05:57
@ang-fleet-lander

Copy link
Copy Markdown

🤖 merged-by: apollo · lane: kanban-merge-pass · gate: ADVISORY (FleetReview not green for 4071e0e): fleetreview-advisory-20260927-standing.md · why: t_d59c7936: Blackbox: CLIProxyAPI (cpa) turns attributed to vendor/provider Kimi (etc.) with; Argus off card review (Ace 13:08), CI green

@ang-fleet-lander
ang-fleet-lander Bot added this pull request to the merge queue Sep 28, 2026
Merged via the queue into main with commit fbfcf03 Sep 28, 2026
47 checks passed
@ang-fleet-lander
ang-fleet-lander Bot deleted the daedalus/t_d59c7936-cpa-blackbox branch September 28, 2026 06:35
@ang-fleet-ci-actuators ang-fleet-ci-actuators Bot added the fleetreview:post-merge Ask FleetReview to review this MERGED pull (merge commit vs first parent) label Sep 28, 2026
@ang-prism

ang-prism Bot commented Sep 28, 2026

Copy link
Copy Markdown

FleetReview

Review: post-merge · head fbfcf03a309b · duration 13m 31s
Profile: light (merit: default light: lines 297<800, files 4<1000000, hunks 15<1000000, no hot path) · policy: below-size-and-path-gates
Roster: B-state → gpt-6-sol (openai), C-assert-xhigh → claude-code-opus-5-5 (anthropic), G → gpt-6-sol (openai), L6 → gpt-6-sol (openai)

Post-merge review (fleetreview:post-merge override): this reviewed the merge commit against its first parent — the bytes that already shipped. It is not a pre-merge gate pass.

Reviewed with 2 of 3 model families — xai unavailable.

profile: light (rule: default light: lines 297<800, files 4<1000000, hunks 15<1000000, no hot path) · round 0 · members: B-state, L6, C-assert-xhigh, G · families: anthropic,openai

Confidence: 3/5

Findings

  • P1 agent/usage_pricing.py:2093 — Unsupported proxy vendors still receive estimated prices · agreed: C-assert-xhigh,G (anthropic, openai)

FleetReview provenance · models: B=gpt-6-sol, C=claude-code-opus-5-5, D=grok-4.6, F=gpt-6-sol · cost: $2.55 · duration: 13m 29s · rounds: 2 · files examined: 4

ang-fleet-workers Bot added a commit that referenced this pull request Sep 28, 2026
…priced

resolve_billing_route returns billing_mode=unknown for a cpa/kimi-code/
kimi-cpa/cliproxyapi turn whose served vendor is not in
_PROXY_VENDOR_PRICING_LANE, but get_pricing_entry still reached the M1
vendor fallback, so claude-*/gemini-* via cpa priced estimated at direct
vendor rates and is_known_model reported them known.

get_pricing_entry now returns None and is_known_model False for such a
route. FleetReview P1 on #1396 (key c56cf5329e7c), card t_244968e4.

Verified: test_cpa_lane_attribution.py + test_usage_pricing.py 186 passed;
source reverted -> 12 new cases fail.
ang-fleet-workers Bot added a commit that referenced this pull request Sep 28, 2026
…priced

resolve_billing_route returns billing_mode=unknown for a cpa/kimi-code/
kimi-cpa/cliproxyapi turn whose served vendor is not in
_PROXY_VENDOR_PRICING_LANE, but get_pricing_entry still reached the M1
vendor fallback, so claude-*/gemini-* via cpa priced estimated at direct
vendor rates and is_known_model reported them known.

get_pricing_entry now returns None and is_known_model False for such a
route. FleetReview P1 on #1396 (key c56cf5329e7c), card t_244968e4.

Verified: test_cpa_lane_attribution.py + test_usage_pricing.py 186 passed;
source reverted -> 12 new cases fail.
Kyzcreig pushed a commit that referenced this pull request Sep 28, 2026
…priced

resolve_billing_route returns billing_mode=unknown for a cpa/kimi-code/
kimi-cpa/cliproxyapi turn whose served vendor is not in
_PROXY_VENDOR_PRICING_LANE, but get_pricing_entry still reached the M1
vendor fallback, so claude-*/gemini-* via cpa priced estimated at direct
vendor rates and is_known_model reported them known.

get_pricing_entry now returns None and is_known_model False for such a
route. FleetReview P1 on #1396 (key c56cf5329e7c), card t_244968e4.

Verified: test_cpa_lane_attribution.py + test_usage_pricing.py 186 passed;
source reverted -> 12 new cases fail.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fleetreview:post-merge Ask FleetReview to review this MERGED pull (merge commit vs first parent)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants