From a02aa16cae7c7345739e327bff7f5dcd63ff47ec Mon Sep 17 00:00:00 2001 From: mlsmaycon Date: Sun, 23 Aug 2026 06:25:37 +0000 Subject: [PATCH] [misc] Report the cost the repricing loop actually saw MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The failure message read repriced.InputCostUsd, and repriced is the zero value on every path that reaches that line — so a run that gave up always reported "last input_cost_usd=$0.000000", which reads as a row priced at zero rather than as a row still at the old rate, or as no row at all. Keep the last cost read and report that, saying so plainly when no row was ever read. --- e2e/agentnetwork/custom_pricing_test.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/e2e/agentnetwork/custom_pricing_test.go b/e2e/agentnetwork/custom_pricing_test.go index 253a3d7ed..33bb13db7 100644 --- a/e2e/agentnetwork/custom_pricing_test.go +++ b/e2e/agentnetwork/custom_pricing_test.go @@ -420,6 +420,11 @@ func TestPriceChangeUpdatesRecordedCost(t *testing.T) { wantInputB := float64(vllmPromptTokens) / 1000 * inRateB var repriced api.AgentNetworkAccessLog var lastSession string + // The cost last read, kept separately: repriced is the zero value on every + // path that gives up, so reporting its cost would say "$0.000000" whether + // the rows were still at rate A or no row was ever read. + var lastCost float64 + var sawRow bool deadline := time.Now().Add(repriceDeadline) for time.Now().Before(deadline) { lastSession = fmt.Sprintf("e2e-session-reprice-b-%d", time.Now().UnixNano()) @@ -442,10 +447,15 @@ func TestPriceChangeUpdatesRecordedCost(t *testing.T) { break } // Still priced at the old rate — the push hasn't landed yet; retry. + lastCost, sawRow = row.InputCostUsd, true time.Sleep(5 * time.Second) } - require.NotEmpty(t, repriced.Id, "a request after the price change must be priced at the new rate B; last input_cost_usd=$%.6f, wanted $%.6f\n=== proxy logs ===\n%s", - repriced.InputCostUsd, wantInputB, env.proxy.Logs(context.Background())) + lastSeen := "no row was ever read" + if sawRow { + lastSeen = fmt.Sprintf("last input_cost_usd=$%.6f", lastCost) + } + require.NotEmpty(t, repriced.Id, "a request after the price change must be priced at the new rate B; %s, wanted $%.6f\n=== proxy logs ===\n%s", + lastSeen, wantInputB, env.proxy.Logs(context.Background())) assertOpenAICostAtRates(t, repriced, inRateB, outRateB) verifyUsageRowForSession(t, lastSession, inRateB, outRateB)