Repository navigation
Conversation
…ounts Fixes #80793 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
✅ PR Specification Reviewer completed successfully! PR Specification ReviewerOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. The No-op messageReviewed PR #80794 at head fa5e02f against T-UAS-031 and T-UAS-081; no actionable specification finding or update proposal.
|
|
✅ Ponytail Reviewer completed successfully! Ponytail ReviewerOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. The No-op messageLean already. Ship.
|
|
✅ Test Quality Sentinel completed test quality analysis.
|
|
✅ PR Code Quality Reviewer completed the code quality review. PR Code Quality ReviewerOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. The No-op messageCompleted PR #80794 review: submitted a no-finding review and recorded the outcome for head fa5e02f.
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
There was a problem hiding this comment.
Reviewed the changed lines in the provider-aware token accounting update. I found no actionable correctness, reliability, performance, or maintainability issues that should block merge. The explicit provider defaults are covered by the native Anthropic/OpenAI routing conventions, and the tests cover explicit overrides, missing providers, and the defensive OpenAI clamp. Specialist first-pass findings were independently adjudicated and none were retained.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~2 AIC · ⊞ 1.7K
Comment /review to run again
Comment MemoryPeek at saved memory (spec-review-history)History |
Comment MemoryPeek at saved memory (review-history)History |
🧪 Test Quality Sentinel Report✅ Test Quality Score: 90/100 — Excellent
📊 Metrics (1 test)
|
There was a problem hiding this comment.
✅ Test Quality Sentinel: 90/100. 0% implementation tests (threshold: 30%). No guideline violations.
🧪 Test quality analysis by Test Quality Sentinel · copilot · routed: haiku55 xhigh · ~4 AIC · ⌖ ~2 AIC · ⊞ 7.4K
Comment /review to run again
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are identified for the provider-specific token-accounting changes.
No open issues 🎉
What changed in this PR
Updates adaptive-routing token accounting to use provider-specific defaults, improving cross-model cost estimates without changing measured credits.
Changes:
- Uses Anthropic’s additive and OpenAI’s inclusive input-token conventions when no explicit cache flag is present; preserves the heuristic for other or missing providers.
- Adds tests for provider defaults, explicit flag overrides, and zero-clamping.
- Documents the provider-aware fallback behavior.
| File | Description |
|---|---|
docs/src/content/docs/reference/adaptive-routing.md |
Explains provider-specific token-counting defaults. |
actions/setup/js/push_routing_history.test.cjs |
Covers provider defaults, overrides, and fallback behavior. |
actions/setup/js/push_routing_history.cjs |
Passes record.provider into token accounting and applies the appropriate default. |
Review effort: Balanced (adaptive)
There was a problem hiding this comment.
Review summary
The provider-aware branches in requestTokens match the PR table and the new test expectations. The Copilot heuristic, explicit inputTokensIncludeCache override, and clamping at 0 are preserved. No other caller uses the old heuristic, and the fixture-based tests only use copilot, so they are unaffected.
One non-blocking readability suggestion is posted inline on line 176, where the nested ternary is hard to scan.
Verification
The vitest suite could not be installed in this sandbox because the npm registry failed TLS verification. Instead, I extracted requestTokens and checked every expectation from the new tests with Node, and all of them pass.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~6 AIC · ⌖ ~2 AIC · ⊞ 5.1K
Comment /matt to run again
Fixes #80793. Part of #79102.
Summary
Passes
record.providerfromrunCostintorequestTokensinactions/setup/js/push_routing_history.cjsso non-cached input token counts match AWF's credit meter (gh-aw-firewallcontainers/api-proxy/guards/ai-credits/accounting.js) wheninputTokensIncludeCacheis absent fromfirewall.token_usage:used.inputTokensIncludeCacheremains authoritative whenever AWF provides it.provider === "anthropic"is treated as additive (does not subtract cached tokens),provider === "openai"is treated as inclusive (subtracts cached tokens, clamped at0), and"copilot"(or any other/missing provider) retains the existinginput >= cacheRead + cacheWriteheuristic.Measured
creditsare unaffected; this improves repriced cross-model cost estimates for native Anthropic (Claude) and OpenAI (Codex) workflows.Concrete examples
record.providerusage(input,cacheRead,cacheWrite,output,inputTokensIncludeCache)input)input)anthropic20000,0,15000,300, omitted500020000openai23799,23194,0,45, omitted605605openai382,19712,0,69, omitted3820copilot23799,23194,0,45, omitted605605copilot382,19712,0,69, omitted382382anthropic20000,0,15000,300,true50005000Changes
actions/setup/js/push_routing_history.cjs: Passrecord.providerintorequestTokens(used, provider)and apply provider-aware defaults whenused.inputTokensIncludeCacheis not a boolean.actions/setup/js/push_routing_history.test.cjs: Add unit tests foranthropic(includinginput >= cacheWriteand explicit flag override),openai(input >= cacheRead,input < cacheReadclamped at0, and explicit flag override), andcopilotplus other/missing providers retaining the heuristic unless the flag is explicitly set.docs/src/content/docs/reference/adaptive-routing.md: Update the token-counting note under "What is recorded".Validation (head
fa5e02f74a)eslint-factoryESLint onpush_routing_history.cjsandpush_routing_history.test.cjs: passednpx prettier --check push_routing_history.cjs push_routing_history.test.cjs: passednpm run typecheck(tsc --noEmit): passednpx vitest run push_routing_history.test.cjs: 23/23 passed