Skip to content

Commit aeaae01

Browse files
vitalyiegorovclaude
andcommitted
test(claude): pin that an exhausted overage still surfaces the pause row
A reviewer flagged that dual exhaustion (base window rejected and overage also rejected) could theoretically silence the pause row, since the guard only checks isUsingOverage/overageInUse. That specific claim doesn't hold in practice, but the dual-rejection shape itself — the vendor's overage-exhausted / out-of-credits scenarios — was untested. Add a regression test alongside the sibling overageStatus: "allowed" suppression test to lock in that this shape still surfaces the warning. Co-Authored-By: Claude Fable 5 <[email protected]>
1 parent 895f6a4 commit aeaae01

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

‎apps/server/src/provider/Layers/ClaudeAdapter.test.ts‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3168,6 +3168,52 @@ describe("ClaudeAdapterLive", () => {
31683168
);
31693169
});
31703170

3171+
it.effect("still surfaces the pause when overage is exhausted too", () => {
3172+
const harness = makeHarness();
3173+
return Effect.gen(function* () {
3174+
const adapter = yield* ClaudeAdapter;
3175+
const runtimeEvents: Array<ProviderRuntimeEvent> = [];
3176+
const runtimeEventsFiber = yield* Stream.runForEach(adapter.streamEvents, (event) =>
3177+
Effect.sync(() => runtimeEvents.push(event)),
3178+
).pipe(Effect.forkChild);
3179+
3180+
yield* adapter.startSession({
3181+
threadId: THREAD_ID,
3182+
provider: ProviderDriverKind.make("claudeAgent"),
3183+
runtimeMode: "full-access",
3184+
});
3185+
yield* adapter.sendTurn({ threadId: THREAD_ID, input: "hello", attachments: [] });
3186+
3187+
const nowMs = yield* Clock.currentTimeMillis;
3188+
const resetsAt = Math.floor(nowMs / 1000) + 60 * 60;
3189+
// The overage-exhausted / out-of-credits shape: the base window and the
3190+
// overage it would have spent both reject, with neither isUsingOverage
3191+
// nor overageInUse set to say anything is still covered. Nothing is
3192+
// carrying the turn here, so staying quiet would be the silent spin
3193+
// this row exists to prevent.
3194+
harness.query.emit({
3195+
type: "rate_limit_event",
3196+
rate_limit_info: {
3197+
status: "rejected",
3198+
rateLimitType: "five_hour",
3199+
resetsAt,
3200+
overageStatus: "rejected",
3201+
},
3202+
session_id: "sdk-session-dual-reject",
3203+
uuid: "rate-limit-dual-reject",
3204+
} as unknown as SDKMessage);
3205+
yield* Effect.yieldNow;
3206+
yield* Effect.yieldNow;
3207+
3208+
assert.equal(runtimeEvents.filter((event) => event.type === "runtime.warning").length, 1);
3209+
3210+
runtimeEventsFiber.interruptUnsafe();
3211+
}).pipe(
3212+
Effect.provideService(Random.Random, makeDeterministicRandomService()),
3213+
Effect.provide(harness.layer),
3214+
);
3215+
});
3216+
31713217
it.effect("keeps one row per window when two Claude limits interleave", () => {
31723218
const harness = makeHarness();
31733219
return Effect.gen(function* () {

0 commit comments

Comments
 (0)