Problem
When a Claude subscription is healthy at the pre-dispatch exhaustion check (line 1794) but becomes exhausted during the primary OSS model dispatch (concurrent request burns the plan window), the baseline failover path has a race that causes the deployment key cost to be absorbed silently with no billing record.
Execution trace of the race:
| Line |
Action |
ctx suppressed? |
| 1794 |
claudeSubscriptionExhausted = false → suppression NOT applied to ctx |
No |
| 2051 |
Primary OSS dispatch fails; concurrent request flips snapshot to exhausted |
No |
| 2097 |
claudeSubscriptionExhausted = true — only baselineCtx suppressed, not ctx |
ctx: No |
| 2109 |
Baseline dispatch succeeds on Weave's deployment key |
— |
| 2147 |
ctx = resolveAndInjectCredentials(ctx, ProviderAnthropic) → subscription token injected |
No ← bug |
| 2200 |
servedOnSubscription(ctx) → true → delta = 0 → deployment key cost unrecorded |
— |
Three attributes are misattributed:
cost.subscription_served OTel attribute — reports true instead of false
SubscriptionServed billing field — causes delta = 0 instead of full cost debit
credentialKeyPrefix/Suffix/credSource telemetry — attributes the turn to the subscription token instead of the deployment key
Fix
Add ctx = withSuppressedClaudeSubscription(ctx) alongside baselineCtx at the baseline exhaustion check (line 2097) so the re-resolution at line 2147 falls through to the deployment key correctly.
Fix available in PR #533.
Problem
When a Claude subscription is healthy at the pre-dispatch exhaustion check (line 1794) but becomes exhausted during the primary OSS model dispatch (concurrent request burns the plan window), the baseline failover path has a race that causes the deployment key cost to be absorbed silently with no billing record.
Execution trace of the race:
claudeSubscriptionExhausted = false→ suppression NOT applied toctxclaudeSubscriptionExhausted = true— onlybaselineCtxsuppressed, notctxctx = resolveAndInjectCredentials(ctx, ProviderAnthropic)→ subscription token injectedservedOnSubscription(ctx)→true→delta = 0→ deployment key cost unrecordedThree attributes are misattributed:
cost.subscription_servedOTel attribute — reportstrueinstead offalseSubscriptionServedbilling field — causesdelta = 0instead of full cost debitcredentialKeyPrefix/Suffix/credSourcetelemetry — attributes the turn to the subscription token instead of the deployment keyFix
Add
ctx = withSuppressedClaudeSubscription(ctx)alongsidebaselineCtxat the baseline exhaustion check (line 2097) so the re-resolution at line 2147 falls through to the deployment key correctly.Fix available in PR #533.