Skip to content

Commit d41b8e3

Browse files
committed
PromptFuel C14: Fix tooltip mislabel when liveQuotaEnabled=true but auth unavailable
- Skip stub reader creation when live quota is disabled so liveQuotaStates stays empty (clean disabled/enabled-but-unavailable distinction) - Use liveQuotaStates.length > 0 instead of hasAnyLiveQuota() in tooltip routing so enabled-but-unavailable/error states show the correct 'Live quota unavailable' message instead of 'Live quota not enabled yet'
1 parent 2a48cee commit d41b8e3

2 files changed

Lines changed: 25 additions & 21 deletions

File tree

src/core/refreshScheduler.ts

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { LiveQuotaStatus } from './liveQuotaTypes';
77
import { ClaudeLocalReader } from '../providers/claudeLocal';
88
import { CodexLocalReader } from '../providers/codexLocal';
99
import { runEnabledReaders } from '../providers/readProviders';
10-
import { createStubReader } from '../providers/liveQuotaReader';
1110
import { runLiveQuotaReaders } from '../providers/readLiveQuota';
1211
import { createAuthenticatedReader } from '../providers/authenticatedQuota';
1312

@@ -84,29 +83,34 @@ export class RefreshScheduler {
8483
const cfg = getConfig();
8584
const localReaders = [new ClaudeLocalReader(), new CodexLocalReader()];
8685

87-
let liveReaders;
86+
let localResults: ReadResult[];
87+
let liveResults: LiveQuotaStatus[] = [];
88+
8889
if (cfg.liveQuotaEnabled) {
89-
liveReaders = await Promise.all(
90+
const liveReaders = await Promise.all(
9091
cfg.enabledProviders.map(id => createAuthenticatedReader(id)),
9192
);
93+
try {
94+
[localResults, liveResults] = await Promise.all([
95+
runEnabledReaders(localReaders, cfg.enabledProviders),
96+
runLiveQuotaReaders(liveReaders, cfg.enabledProviders),
97+
]);
98+
} catch {
99+
localResults = cfg.enabledProviders.map((id) => ({
100+
providerId: id,
101+
status: 'error' as const,
102+
}));
103+
liveResults = [];
104+
}
92105
} else {
93-
liveReaders = cfg.enabledProviders.map(id => createStubReader(id));
94-
}
95-
96-
let localResults: ReadResult[];
97-
let liveResults: LiveQuotaStatus[];
98-
99-
try {
100-
[localResults, liveResults] = await Promise.all([
101-
runEnabledReaders(localReaders, cfg.enabledProviders),
102-
runLiveQuotaReaders(liveReaders, cfg.enabledProviders),
103-
]);
104-
} catch {
105-
localResults = cfg.enabledProviders.map((id) => ({
106-
providerId: id,
107-
status: 'error' as const,
108-
}));
109-
liveResults = [];
106+
try {
107+
localResults = await runEnabledReaders(localReaders, cfg.enabledProviders);
108+
} catch {
109+
localResults = cfg.enabledProviders.map((id) => ({
110+
providerId: id,
111+
status: 'error' as const,
112+
}));
113+
}
110114
}
111115

112116
try {

src/core/statusTooltip.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export { formatLiveQuotaTooltip, hasUsableLiveQuota, hasAnyLiveQuota };
88
const LINE_SEPARATOR = '\n';
99

1010
export function formatTooltip(status: PromptFuelStatus): string {
11-
if (hasAnyLiveQuota(status)) {
11+
if (status.liveQuotaStates.length > 0) {
1212
return formatLiveQuotaTooltip(status);
1313
}
1414

0 commit comments

Comments
 (0)