Repository navigation
fix(usage): a leg refused before any send does not make the row unreported - #7336
vadymhimself wants to merge 1 commit into
Conversation
…orted A multi-attempt row takes its usage status from aggregateAttemptUsage, which let any usage-less attempt mark the whole row "unreported". A combo leg the gateway refused locally (input admission, a local cooldown) never reached upstream and carries no usage, so a combo that then served the turn on its next leg with fully reported usage was still logged as unreported. The status now ignores usage-less attempts that never sent or were answered locally -- the same "spent nothing" rule summary.ts already prices by. An attempt that was sent and reported nothing still leaves the row unreported. The existing "folds partial and unsupported" test built its unreported 503 without a send; it now notes the send, which is the case it describes. Co-Authored-By: Claude Code <noreply@anthropic.com>
|
✅ Deterministic PR hygiene checks passed. |
✅ READY
Review readiness checklist
✅ 4/4 boxes ticked. This pull request has been marked Ready for Review. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
|
Intake/scoped review at The measured-attempt filter excludes a usage-less unsent/local leg while retaining a physically sent leg with missing usage as unreported. Keep the explicit send-count negative control and unsupported/estimated status precedence. This is a scoped static accounting review; named current-head CI is still needed. Current-head functional workflows are awaiting fork approval; that is pending execution, not a passing test result. No local suite was run for this branch in this intake. No workflow approval, new scan, live configuration change or merge was performed. Required review/readiness gates remain in force. |
Summary
aggregateAttemptUsage, where any usage-less attempt marks the whole rowunreported. A combo leg the gateway refused locally (input admission incore-combo.ts, a local pool cooldown) never reached upstream and carries no usage, so a combo that then served the turn on its next leg with fully reported usage was still logged asunreported.sendCount === 0) or were answered locally (locallyAnswered), the same "spent nothing" rulesummary.tsalready prices by (spentNothing). An attempt that was sent and reported nothing still leaves the rowunreported, and an attempt that carries usage always counts. Token totals are unchanged (those legs carry no usage).src/server/request-log.tschanges (+6/-4).Verification
a combo leg refused before any send does not make the served row unreportedintests/usage/request-log-attempt-identity.test.ts, run before the src change: 1 fail ("status": "unreported"where"reported"was expected). It also pins that a sent leg with no usage still yieldsunreported. The existingfolds partial and unsupported attempt measurement honestlytest intests/usage/request-log.test.tsbuilt its "unreported 503" attempt without a send; it now notes the send, which is the case it describes. After:bun test tests/usage/-> 1184 pass, 0 fail.bun x tsc --noEmit-> exit 0.bun scripts/file-size-ratchet.ts-> passed.bun run test:changed(Bun 1.4.3 viaOCX_TEST_RUNNER_BUN,OCX_TEST_MAIN_TIMEOUT_MS=2400000on a loaded machine) -> 16943 pass, 34 skip, 3 fail across 692 files. Two failures stalled for about 1060 s in a machine-wide pause and pass alone (responses-devin-401-replay,claude-desktop-first-party: 69 pass, 0 fail). The third,tests/cli/cli-connect-readiness.test.ts"a rejected preferred runtime falls back without rewriting the saved selection", also fails on an unmodifiedupstream/dev8640c2f checkout on this machine (local-environment dependent) and is unrelated to usage logging.bun run testwas not run locally:test:changedalready covered the changed module's import graph; the remainder is left to CI.Checklist
Source: carried from the vadymhimself fork build (
physicalUsageAttemptsinaggregateAttemptUsage, commit 8fb1bbb), re-authored smaller: no new helper, the filter applies to the status only, and an attempt that carries usage is never dropped. The fork's finalized-attempt overwrite guard is not carried (no reproducible caller path on currentdev), and its cache-read fix is a separate PR.🤖 Generated with Claude Code
Review readiness checklist
This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:
Required local validation passed; commands, results, and any full-suite exception are documented.
I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.
Summary by CodeRabbit