Skip to content

Commit d22369c

Browse files
author
Shaun Hawk
committed
fix(server): fix Muse limits rebase fallout in tests and comments
Shorten two over-length comments the lint gate rejects, repair the adapter test line the conflict merge joined, and expect the fixture's current model slug in the signed-out status test.
1 parent 0d77bfa commit d22369c

4 files changed

Lines changed: 14 additions & 18 deletions

File tree

‎packages/provider-core/src/server/usageLimits.ts‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,9 @@ export function applyUsageLimitsUpdate(input: {
6666
const merged = replace
6767
? new Map<ServerProviderUsageWindow["id"], ServerProviderUsageWindow>()
6868
: new Map(published);
69-
// Codex sends this notification beside every token-usage tick, almost
70-
// always with unchanged numbers. Decide "nothing changed" per window on
71-
// the way through so the no-op case never allocates a new snapshot. A
72-
// whole-state report that only moves the time is still news: Limits picks
73-
// the freshest report for an account across environments by `checkedAt`.
69+
// Decide "nothing changed" per window so a no-op never allocates a new
70+
// snapshot. A whole-state report that only moves the time is still news:
71+
// Limits picks the freshest report per account by `checkedAt`.
7472
let changed =
7573
replace &&
7674
(update.windows.length !== published.size || input.checkedAt !== previous?.checkedAt);

‎packages/provider-muse/src/server/adapter.test.ts‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ import * as TestClock from "effect/testing/TestClock";
3636
import * as TestProviderHost from "@t3tools/provider-testing/TestProviderHost";
3737
import * as McpProviderSessions from "@t3tools/provider-core/server/McpProviderSessions";
3838
import type { MuseItem, MuseSubscriptionUsage } from "./protocol.ts";
39-
import type { MuseSdkHost, MuseSdkHostOptions } from "./sdk.ts";import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
39+
import type { MuseSdkHost, MuseSdkHostOptions } from "./sdk.ts";
40+
import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
4041
import * as ProviderAdapter from "@t3tools/provider-core/server/ProviderAdapter";
4142
import type * as ProviderContinuationRequests from "@t3tools/provider-core/server/ProviderContinuationRequests";
4243
import { makeMuseAdapterV2, type MuseAdapterV2Options } from "./adapter.ts";
@@ -182,10 +183,11 @@ const makeFakeMuse = Effect.fnUntraced(function* (idPrefix = "native") {
182183
Effect.sync(() => {
183184
notify({ jsonrpc: "2.0", method, params: { sessionId, ...params } });
184185
}),
185-
/** A notification about the host or account rather than a session, as `usage/changed` is. */ emitHostWide: (method: string, params: Record<string, unknown>) =>
186-
Effect.sync(() => {
187-
notify({ jsonrpc: "2.0", method, params });
188-
}),
186+
/** A notification about the host or account rather than a session, as `usage/changed` is. */ emitHostWide:
187+
(method: string, params: Record<string, unknown>) =>
188+
Effect.sync(() => {
189+
notify({ jsonrpc: "2.0", method, params });
190+
}),
189191
takeCall: Effect.fnUntraced(function* (method: string) {
190192
while (true) {
191193
const call = yield* Queue.take(requests);
@@ -361,7 +363,8 @@ const startConversation = Effect.fnUntraced(function* (
361363
return { nativeId: call.commandId!, providerTurn: event.providerTurn };
362364
});
363365

364-
// `usage/changed` as Muse 1.4.3 sent it after a reply (2026-10-08), with a placeholder tier.const SUBSCRIPTION_USAGE = {
366+
// `usage/changed` as Muse 1.4.3 sent it after a reply (2026-10-08), with a placeholder tier.
367+
const SUBSCRIPTION_USAGE = {
365368
window: { usedPercent: 0, windowDurationMins: 300, resetsAtMs: 1791465557000 },
366369
weekly: { usedPercent: 5, resetsAtMs: 1791763200000 },
367370
tier: "tier-1",

‎packages/provider-muse/src/server/status.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ it.layer(NodeServices.layer)("Muse status", (it) => {
171171
expect(snapshot.status).toBe("error");
172172
expect(snapshot.auth).toEqual({ status: "unauthenticated" });
173173
expect(snapshot.message).toContain("muse login");
174-
expect(snapshot.models.map((model) => model.slug)).toEqual(["muse-discovered"]);
174+
expect(snapshot.models.map((model) => model.slug)).toEqual(["muse-wonder-1.0"]);
175175
}),
176176
),
177177
);

‎packages/provider-muse/src/server/usageLimits.ts‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
/**
22
* Muse Code's subscription usage limits. Meta reports the account's windows
3-
* with every model response, and Muse forwards them as `usage/changed`. When a
4-
* window runs out, Meta refuses the next request and Muse fails the turn.
5-
*
6-
* Meta has no usage endpoint, so the last report is all there is between
7-
* responses. Windows are re-derived from it against the clock: a window whose
8-
* reset has passed starts over empty.
3+
* with every model response; the last report is re-derived against the clock.
94
*/
105
import type {
116
ServerProviderAuth,

0 commit comments

Comments
 (0)