The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 04:30 UTC
fix(codex): sharing usage limits offer the existing recovery options (#25341)
Co-authored-by: PR Batch Tester <agent@local.test> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: maria-rcks <maria@kuuro.net>
shivam committed
Nov 5, 2026 at 07:02 UTC
935818e422f9b58c46e14d70f4ef386fa3575105
8 files changed
+290
-58
apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.test.ts
+101
-13
@@ -480,6 +480,8 @@ describe("CodexAdapterV2 fork boundary", () => {
480
});
481
482
const DEFAULT_CODEX_SETTINGS = Schema.decodeSync(CodexSettings)({});
483
+const CHATGPT_SHARING_LIMIT_MESSAGE =
484
+ "stream disconnected before completion: The ChatGPT user has reached their Subscription Sharing usage limit. Ask the user to try again after their usage limit resets or use an API key instead.";
485
const CODEX_TEST_MODEL_SELECTION = {
486
instanceId: CodexAdapterV2.CODEX_DEFAULT_INSTANCE_ID,
487
model: "gpt-5.4",
@@ -1235,6 +1237,7 @@ describe("CodexAdapterV2 post-settle continuation", () => {
1237
onRequest: (method: string, params: unknown) => Effect.Effect<void> = () => Effect.void,
1238
readChildMetadata?: Parameters<typeof withCodexReplayChildMetadata>[2],
1239
beforeEmitInbound?: CodexReplay.CodexAppServerReplayDriver["beforeEmitInbound"],
1240
+ onUsageLimits?: CodexAdapterV2.CodexAdapterV2Options["onUsageLimits"],
1241
) =>
1242
Effect.gen(function* () {
1243
const fileSystem = yield* FileSystem.FileSystem;
@@ -1292,6 +1295,7 @@ describe("CodexAdapterV2 post-settle continuation", () => {
1295
settings: DEFAULT_CODEX_SETTINGS,
1296
environment: {},
1297
clientFactory,
1298
+ ...(onUsageLimits ? { onUsageLimits } : {}),
1299
digest: yield* Digest.Digest,
1300
fileSystem,
1301
idAllocator,
@@ -5612,14 +5616,58 @@ describe("CodexAdapterV2 post-settle continuation", () => {
5616
code: "other",
5617
details: "subscription_sharing_workplace_individual_usage_limit_exceeded",
5618
notification: true,
5619
+ usedBefore: 100,
5620
+ expectedClass: "usage_limit",
5621
+ expectedCode: "subscription_sharing_workplace_individual_usage_limit_exceeded",
5622
+ expectedMessage: "workspace admin",
5623
+ },
5624
+ // regression: #25333 ChatGPT sharing limit prose classifies as a usage limit
5625
+ {
5626
+ name: "chatgpt-sharing-prose-retry",
5627
+ code: "responseStreamDisconnected",
5628
+ errorInfo: { responseStreamDisconnected: { httpStatusCode: null } },
5629
+ message: CHATGPT_SHARING_LIMIT_MESSAGE,
5630
+ notification: true,
5631
+ willRetry: true,
5632
+ usedBefore: 100,
5633
+ expectedClass: "usage_limit",
5634
+ expectedCode: "subscription_sharing_usage_limit_exceeded",
5635
+ expectedMessage: "Usage settings",
5636
+ },
5637
+ {
5638
+ name: "chatgpt-sharing-prose",
5639
+ code: "responseStreamDisconnected",
5640
+ errorInfo: { responseStreamDisconnected: { httpStatusCode: null } },
5641
+ message: CHATGPT_SHARING_LIMIT_MESSAGE,
5642
+ notification: false,
5643
+ resetAfter: true,
5644
+ expectedClass: "usage_limit",
5645
+ expectedCode: "subscription_sharing_usage_limit_exceeded",
5646
+ expectedMessage: "Usage settings",
5647
+ },
5648
+ {
5649
+ name: "sharing-code-mention",
5650
+ code: "responseStreamDisconnected",
5651
+ errorInfo: { responseStreamDisconnected: { httpStatusCode: null } },
5652
+ message: "Transport unavailable; this is not subscription_sharing_usage_limit_exceeded.",
5653
+ notification: false,
5654
expectedClass: "provider_error",
5655
},
5656
+ {
5657
+ name: "sharing-code-mention-retry",
5658
+ code: "responseStreamDisconnected",
5659
+ errorInfo: { responseStreamDisconnected: { httpStatusCode: null } },
5660
+ message: "Transport unavailable; this is not subscription_sharing_usage_limit_exceeded.",
5661
+ notification: true,
5662
+ willRetry: true,
5663
+ expectedClass: "transport_error",
5664
+ },
5665
] as const)("classifies Codex terminal failures from $name evidence", (scenario) =>
5666
Effect.scoped(
5667
Effect.gen(function* () {
5668
const nativeThreadId = `native-limit-${scenario.name}`;
5669
const nativeTurnId = `turn-limit-${scenario.name}`;
5622
- const message = "Provider stopped this request.";
5670
+ const message = "message" in scenario ? scenario.message : "Provider stopped this request.";
5671
const errorInfo = "errorInfo" in scenario ? scenario.errorInfo : scenario.code;
5672
const resetAt = "2033-05-19T07:20:00.000Z";
5673
const snapshot = {
@@ -5639,6 +5687,26 @@ describe("CodexAdapterV2 post-settle continuation", () => {
5687
scenario: `codex-limit-${scenario.name}`,
5688
entries: [
5689
...codexReplayPreamble({ nativeThreadId, nativeTurnId, prompt: "Continue." }),
5690
+ ...("usedBefore" in scenario
5691
+ ? [
5692
+ {
5693
+ ...snapshot,
5694
+ frame: {
5695
+ method: "account/rateLimits/updated",
5696
+ params: {
5697
+ rateLimits: {
5698
+ limitId: "codex",
5699
+ primary: {
5700
+ usedPercent: scenario.usedBefore,
5701
+ resetsAt: 2000100000,
5702
+ windowDurationMins: 300,
5703
+ },
5704
+ },
5705
+ },
5706
+ },
5707
+ },
5708
+ ]
5709
+ : []),
5710
...(scenario.name === "deferred-reset" ? [snapshot] : []),
5711
...(scenario.name === "deferred-reset"
5712
? [
@@ -5686,7 +5754,7 @@ describe("CodexAdapterV2 post-settle continuation", () => {
5754
params: {
5755
threadId: nativeThreadId,
5756
turnId: nativeTurnId,
5689
- willRetry: scenario.name === "retry",
5757
+ willRetry: scenario.name === "retry" || "willRetry" in scenario,
5758
error: {
5759
message,
5760
codexErrorInfo: errorInfo,
@@ -5723,7 +5791,7 @@ describe("CodexAdapterV2 post-settle continuation", () => {
5791
},
5792
},
5793
},
5726
- ...(scenario.name === "late-reset" ? [snapshot] : []),
5794
+ ...(scenario.name === "late-reset" || "resetAfter" in scenario ? [snapshot] : []),
5795
...(scenario.name === "deferred-reset"
5796
? [
5797
{
@@ -5761,12 +5829,19 @@ describe("CodexAdapterV2 post-settle continuation", () => {
5829
],
5830
});
5831
const resetReceipt = yield* Deferred.make<void>();
5764
- const harness = yield* makeCodexReplayHarness(transcript, (event) =>
5765
- event.type === "turn_item.updated" &&
5766
- event.turnItem.type === "error" &&
5767
- event.turnItem.failure.resetAt === resetAt
5768
- ? Deferred.succeed(resetReceipt, undefined)
5769
- : Effect.void,
5832
+ const snapshotReceipt = yield* Deferred.make<void>();
5833
+ const harness = yield* makeCodexReplayHarness(
5834
+ transcript,
5835
+ (event) =>
5836
+ event.type === "turn_item.updated" &&
5837
+ event.turnItem.type === "error" &&
5838
+ event.turnItem.failure.resetAt === resetAt
5839
+ ? Deferred.succeed(resetReceipt, undefined)
5840
+ : Effect.void,
5841
+ undefined,
5842
+ undefined,
5843
+ undefined,
5844
+ () => Deferred.succeed(snapshotReceipt, undefined),
5845
);
5846
yield* harness.runtime.startTurn(
5847
makeCodexTestTurnInput({
@@ -5786,6 +5861,17 @@ describe("CodexAdapterV2 post-settle continuation", () => {
5861
if (scenario.name === "deferred-reset") assert.equal(terminal.failure.resetAt, resetAt);
5862
if (scenario.name === "matching-details")
5863
assert.equal(terminal.failure.message, "Detailed provider allowance explanation.");
5864
+ if ("resetAfter" in scenario) {
5865
+ yield* Deferred.await(snapshotReceipt);
5866
+ assert.isFalse(
5867
+ harness.events.some(
5868
+ (event) =>
5869
+ event.type === "turn_item.updated" &&
5870
+ event.turnItem.type === "error" &&
5871
+ event.turnItem.failure.resetAt != null,
5872
+ ),
5873
+ );
5874
+ }
5875
if (scenario.name === "late-reset") {
5876
yield* Deferred.await(resetReceipt);
5877
const item = harness.events.find(
@@ -5796,10 +5882,12 @@ describe("CodexAdapterV2 post-settle continuation", () => {
5882
);
5883
assert.isDefined(item);
5884
}
5799
- if (scenario.name === "retry") assert.equal(terminal.retry?.attempt, 1);
5800
- if (scenario.name === "chatgpt-workspace-limit") {
5801
- assert.equal(terminal.failure.code, scenario.details);
5802
- assert.include(terminal.failure.message, "workspace admin");
5885
+ if (scenario.name === "retry" || "willRetry" in scenario)
5886
+ assert.equal(terminal.retry?.attempt, 1);
5887
+ if ("expectedCode" in scenario && "expectedMessage" in scenario) {
5888
+ assert.equal(terminal.failure.code, scenario.expectedCode);
5889
+ assert.include(terminal.failure.message, scenario.expectedMessage);
5890
+ assert.equal(terminal.failure.resetAt, null);
5891
}
5892
}).pipe(
5893
Effect.provide(
apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts
+22
-5
@@ -1148,7 +1148,8 @@ function codexUsageLimitError(
1148
1149
/**
1150
* ChatGPT sharing reports its own reason inside Codex's generic turn error, so
1151
- * the code it names replaces Codex's, and clients pick a recovery from it.
1151
+ * the code it names replaces Codex's, and clients pick a recovery from it. Its
1152
+ * allowance limits get the usage-limit recovery; other sharing failures keep their class.
1153
*/
1154
function withCodexManagedFailure(
1155
failure: OrchestrationV2ProviderFailure,
@@ -1157,7 +1158,22 @@ function withCodexManagedFailure(
1158
const managed = classifyCodexManagedError(nativeError);
1159
return managed === undefined
1160
? failure
1160
- : { ...failure, message: managed.message, code: managed.code };
1161
+ : {
1162
+ ...failure,
1163
+ message: managed.message,
1164
+ code: managed.code,
1165
+ ...(managed.usageLimit ? { class: "usage_limit" } : {}),
1166
+ };
1167
+}
1168
+
1169
+function failureResetAt(
1170
+ failure: OrchestrationV2ProviderFailure,
1171
+ snapshot: CodexRateLimitSnapshot | undefined,
1172
+) {
1173
+ // Sharing caps have no reset timestamp in the ordinary Codex allowance snapshot.
1174
+ return classifyCodexManagedError(failure.code)?.usageLimit
1175
+ ? null
1176
+ : codexUsageLimitResetAt(snapshot);
1177
}
1178
1179
interface ActiveCodexTurnContext {
@@ -4480,8 +4496,9 @@ export const makeCodexAdapterV2 = Effect.fn("makeCodexAdapterV2")(function* (
4496
const previous = yield* Ref.getAndUpdate(rateLimitSnapshot, (previous) =>
4497
mergeCodexRateLimits(previous, payload.rateLimits),
4498
);
4483
- const resetAt = codexUsageLimitResetAt(yield* Ref.get(rateLimitSnapshot));
4499
+ const snapshot = yield* Ref.get(rateLimitSnapshot);
4500
for (const item of (yield* Ref.get(limitedTurnItems)).values()) {
4501
+ const resetAt = failureResetAt(item.failure, snapshot);
4502
if (resetAt === null || item.failure.resetAt != null) continue;
4503
const updated = {
4504
...item,
@@ -5826,7 +5843,7 @@ export const makeCodexAdapterV2 = Effect.fn("makeCodexAdapterV2")(function* (
5843
failure.class === "usage_limit"
5844
? {
5845
...failure,
5829
- resetAt: codexUsageLimitResetAt(yield* Ref.get(rateLimitSnapshot)),
5846
+ resetAt: failureResetAt(failure, yield* Ref.get(rateLimitSnapshot)),
5847
}
5848
: failure,
5849
...(input.providerRetry === undefined
@@ -5866,7 +5883,7 @@ export const makeCodexAdapterV2 = Effect.fn("makeCodexAdapterV2")(function* (
5883
...event.failure,
5884
resetAt:
5885
event.failure.resetAt ??
5869
- codexUsageLimitResetAt(yield* Ref.get(rateLimitSnapshot)),
5886
+ failureResetAt(event.failure, yield* Ref.get(rateLimitSnapshot)),
5887
},
5888
}
5889
: event;
apps/server/src/provider/CodexManagedErrors.test.ts
+50
@@ -12,6 +12,7 @@ it("maps streamed failures to safe actionable messages and reconnect decisions",
12
message:
13
"ChatGPT could not validate this connection. Check the selected account and sharing permissions.",
14
code: "subscription_sharing_v2_invalid_user",
15
+ usageLimit: false,
16
},
17
);
18
assert.include(
@@ -58,3 +59,52 @@ it("preserves credentials for the current subscriber and permission error codes"
59
assert.strictEqual(classifyCodexManagedError({ error: { code } })?.code, code);
60
}
61
});
62
+
63
+it("treats only ChatGPT sharing allowance limits as usage limits", () => {
64
+ assert.deepInclude(
65
+ classifyCodexManagedError(
66
+ "stream disconnected before completion: The ChatGPT user has reached their Subscription Sharing usage limit. Ask the user to try again after their usage limit resets or use an API key instead.",
67
+ ),
68
+ { code: "subscription_sharing_usage_limit_exceeded", usageLimit: true },
69
+ );
70
+ assert.isTrue(
71
+ classifyCodexManagedError("subscription_sharing_workplace_individual_usage_limit_exceeded")!
72
+ .usageLimit,
73
+ );
74
+ assert.isFalse(classifyCodexManagedError("subscription_sharing_usage_unavailable")!.usageLimit);
75
+ assert.isUndefined(
76
+ classifyCodexManagedError("stream disconnected before completion: error decoding response"),
77
+ );
78
+ assert.isUndefined(classifyCodexManagedError("You've hit your usage limit."));
79
+});
80
+
81
+it("does not infer sharing codes from incidental mentions in turn errors", () => {
82
+ const mention = "Transport unavailable; this is not subscription_sharing_usage_limit_exceeded.";
83
+ for (const value of [
84
+ mention,
85
+ { message: mention },
86
+ { message: "Transport unavailable", additionalDetails: mention },
87
+ { code: "other", message: mention },
88
+ ]) {
89
+ assert.isUndefined(classifyCodexManagedError(value));
90
+ }
91
+ assert.deepInclude(
92
+ classifyCodexManagedError({
93
+ error: { code: "subscription_sharing_usage_unavailable", message: mention },
94
+ }),
95
+ { code: "subscription_sharing_usage_unavailable", usageLimit: false },
96
+ );
97
+});
98
+
99
+it("reads sharing codes from structured errors and exact turn details", () => {
100
+ const code = "subscription_sharing_usage_limit_exceeded";
101
+ const response = { error: { code } };
102
+ for (const value of [
103
+ response,
104
+ JSON.stringify(response),
105
+ { message: "Provider stopped", additionalDetails: code },
106
+ { message: "Provider stopped", additionalDetails: JSON.stringify(response) },
107
+ ]) {
108
+ assert.deepInclude(classifyCodexManagedError(value), { code, usageLimit: true });
109
+ }
110
+});
apps/server/src/provider/CodexManagedErrors.ts
+62
-27
@@ -49,33 +49,68 @@ const failures = {
49
"ChatGPT could not authorize this connection. Check the client and sharing permissions.",
50
},
51
};
52
-export function classifyCodexManagedError(value: unknown) {
53
- let text: string;
54
- try {
55
- text = typeof value === "string" ? value : JSON.stringify(value);
56
- } catch {
57
- return undefined;
58
- }
59
- if (typeof text !== "string") return undefined;
60
- for (const [code, failure] of Object.entries(failures)) {
61
- if (!text.includes(code)) continue;
62
- if (code === "subscription_sharing_unsupported_capability") {
63
- if (text.includes("tool 'namespace'"))
64
- return {
65
- ...failure,
66
- code,
67
- message:
68
- "Codex sent a tool namespace that ChatGPT sharing does not support. Use another provider for this request.",
69
- };
70
- if (text.includes("additional_tools"))
71
- return {
72
- ...failure,
73
- code,
74
- message:
75
- "Codex sent an input item that ChatGPT sharing does not support. Use another provider for this request.",
76
- };
52
+const usageLimitCodes = new Set<string>([
53
+ "subscription_sharing_usage_limit_exceeded",
54
+ "subscription_sharing_workplace_individual_usage_limit_exceeded",
55
+]);
56
+
57
+function unwrapError(value: unknown): unknown {
58
+ if (typeof value === "string") {
59
+ try {
60
+ value = JSON.parse(value);
61
+ } catch {
62
+ return value;
63
}
78
- return { ...failure, code };
64
}
80
- return undefined;
65
+ return typeof value === "object" && value !== null && "error" in value ? value.error : value;
66
+}
67
+
68
+function isManagedCode(value: unknown): value is keyof typeof failures {
69
+ return typeof value === "string" && Object.hasOwn(failures, value);
70
+}
71
+
72
+function sharingCode(value: unknown) {
73
+ const error = unwrapError(value);
74
+ const code = typeof error === "object" && error !== null && "code" in error ? error.code : error;
75
+ return isManagedCode(code) ? code : undefined;
76
+}
77
+
78
+export function classifyCodexManagedError(value: unknown) {
79
+ const error = unwrapError(value);
80
+ const messages =
81
+ typeof error === "string"
82
+ ? [error]
83
+ : typeof error === "object" && error !== null
84
+ ? [
85
+ "message" in error ? error.message : null,
86
+ "additionalDetails" in error ? error.additionalDetails : null,
87
+ ].filter((message): message is string => typeof message === "string")
88
+ : [];
89
+ const code =
90
+ sharingCode(error) ??
91
+ messages.map(sharingCode).find((code) => code !== undefined) ??
92
+ // Codex can stream ChatGPT's sharing-limit prose without its code.
93
+ (messages.some((message) =>
94
+ message.includes("has reached their Subscription Sharing usage limit"),
95
+ )
96
+ ? "subscription_sharing_usage_limit_exceeded"
97
+ : undefined);
98
+ if (code === undefined) return undefined;
99
+ const failure = { ...failures[code], code, usageLimit: usageLimitCodes.has(code) };
100
+ const text = messages.join(" ");
101
+ if (code === "subscription_sharing_unsupported_capability") {
102
+ if (text.includes("tool 'namespace'"))
103
+ return {
104
+ ...failure,
105
+ message:
106
+ "Codex sent a tool namespace that ChatGPT sharing does not support. Use another provider for this request.",
107
+ };
108
+ if (text.includes("additional_tools"))
109
+ return {
110
+ ...failure,
111
+ message:
112
+ "Codex sent an input item that ChatGPT sharing does not support. Use another provider for this request.",
113
+ };
114
+ }
115
+ return failure;
116
}
apps/web/src/components/ChatView.tsx
+1
@@ -2538,6 +2538,7 @@ export default function ChatView(props: ChatViewProps) {
2538
activeThreadShell?.latestRun
2539
? usageLimitRecoveryBannerItem({
2540
runId: activeThreadShell.latestRun.runId,
2541
+ errorCode: serverRuntime.lastErrorCode ?? null,
2542
resetAt: serverRuntime.usageLimitResetAt ?? null,
2543
stoppedAt: activeThreadShell.latestRun.completedAt ?? activeThreadShell.updatedAt,
2544
recovery: activeThreadShell.limitRecovery ?? null,
apps/web/src/components/chat/ThreadErrorBanner.tsx
+8
-6
@@ -14,7 +14,7 @@ import { OpenAI } from "../Icons";
14
import { ChatGptUsageButton } from "../settings/ChatGptUsageButton";
15
import { ExpandableText } from "../settings/ExpandableText";
16
17
-function copyAdminRequest() {
17
+export function copyAdminRequest() {
18
void writeTextToClipboard(CHATGPT_WORKSPACE_ADMIN_REQUEST, "admin request").then(
19
() =>
20
toastManager.add({
@@ -96,11 +96,13 @@ export const ThreadErrorBanner = memo(function ThreadErrorBanner({
96
{chatGptLimit ? (
97
<div className="space-y-1">
98
<p className="font-medium">ChatGPT usage limit reached</p>
99
- <p>
100
- {workspaceLimit
101
- ? "You've reached your workspace's limit for using your ChatGPT plan in other apps. Copy a request to ask your workspace admin for increased usage limits."
102
- : "Review your usage settings in ChatGPT."}
103
- </p>
99
+ {workspaceLimit ? (
100
+ <p>
101
+ {
102
+ "You've reached your workspace's limit for using your ChatGPT plan in other apps. Copy a request to ask your workspace admin for increased usage limits."
103
+ }
104
+ </p>
105
+ ) : null}
106
</div>
107
) : (
108
<ExpandableText text={error} collapsedText={getThreadErrorBannerMessage(error)} />
apps/web/src/components/chat/UsageLimitRecoveryBanner.test.tsx
+1
@@ -9,6 +9,7 @@ const stoppedAt = new Date(2026, 9, 20, 12, 0);
9
function bannerDescription(resetAt: Date, timestampFormat: TimestampFormat) {
10
return usageLimitRecoveryBannerItem({
11
runId: RunId.make("run-1"),
12
+ errorCode: null,
13
resetAt: resetAt.toISOString(),
14
stoppedAt: stoppedAt.toISOString(),
15
snoozedUntil: null,
apps/web/src/components/chat/UsageLimitRecoveryBanner.tsx
+45
-7
@@ -5,16 +5,24 @@ import {
5
} from "@t3tools/contracts";
6
import { type TimestampFormat } from "@t3tools/contracts/settings";
7
import { deadlineStore } from "@t3tools/client-runtime/clock";
8
+import {
9
+ CHATGPT_USAGE_LIMIT_CODE,
10
+ CHATGPT_WORKSPACE_USAGE_LIMIT_CODE,
11
+} from "@t3tools/shared/usageLimits";
12
import { GaugeIcon } from "lucide-react";
13
import { useState } from "react";
14
import { useDeadlinePassed } from "../../hooks/useDeadline";
15
+import { OpenAI } from "../Icons";
16
+import { ChatGptUsageButton } from "../settings/ChatGptUsageButton";
17
import { Button } from "../ui/button";
18
import { formatUpcomingTimestamp } from "../../timestampFormat";
19
import { toastManager } from "../ui/toast";
20
import type { ComposerBannerStackItem } from "./ComposerBannerStack";
21
+import { copyAdminRequest } from "./ThreadErrorBanner";
22
23
type RecoveryProps = {
24
runId: RunId;
25
+ errorCode: string | null;
26
resetAt: string | null;
27
stoppedAt: string;
28
snoozedUntil: string | null;
@@ -24,17 +32,47 @@ type RecoveryProps = {
32
};
33
34
export function usageLimitRecoveryBannerItem(props: RecoveryProps): ComposerBannerStackItem {
27
- const { runId, resetAt, stoppedAt, timestampFormat } = props;
35
+ const { runId, errorCode, resetAt, stoppedAt, timestampFormat } = props;
36
const canSchedule = resetAt !== null && Date.parse(resetAt) > Date.parse(stoppedAt);
37
+ const workspaceLimit = errorCode === CHATGPT_WORKSPACE_USAGE_LIMIT_CODE;
38
+ const chatGptLimit = workspaceLimit || errorCode === CHATGPT_USAGE_LIMIT_CODE;
39
+ const recoveryActions = canSchedule ? (
40
+ <RecoveryActions key={`${runId}:${resetAt}`} {...props} />
41
+ ) : null;
42
+ const resetDescription = resetAt
43
+ ? `Resets ${formatUpcomingTimestamp(resetAt, timestampFormat)}`
44
+ : "Reset time unavailable; retry manually";
45
+ if (!chatGptLimit) {
46
+ return {
47
+ id: `usage-limit-recovery:${runId}`,
48
+ variant: "warning",
49
+ icon: <GaugeIcon />,
50
+ title: "Usage limit reached",
51
+ description: resetDescription,
52
+ actions: recoveryActions,
53
+ };
54
+ }
55
+ // OpenAI's partner guidelines specify this ChatGPT notice and its actions.
56
return {
57
id: `usage-limit-recovery:${runId}`,
58
variant: "warning",
32
- icon: <GaugeIcon />,
33
- title: "Usage limit reached",
34
- description: resetAt
35
- ? `Resets ${formatUpcomingTimestamp(resetAt, timestampFormat)}`
36
- : "Reset time unavailable; retry manually",
37
- actions: canSchedule ? <RecoveryActions key={`${runId}:${resetAt}`} {...props} /> : null,
59
+ icon: <OpenAI aria-hidden="true" />,
60
+ title: "ChatGPT usage limit reached",
61
+ description: workspaceLimit
62
+ ? "You've reached your workspace's limit for using your ChatGPT plan in other apps."
63
+ : resetDescription,
64
+ actions: (
65
+ <>
66
+ {recoveryActions}
67
+ {workspaceLimit ? (
68
+ <Button size="xs" variant="ghost" onClick={copyAdminRequest}>
69
+ Copy request for admin
70
+ </Button>
71
+ ) : (
72
+ <ChatGptUsageButton size="xs" variant="ghost" />
73
+ )}
74
+ </>
75
+ ),
76
};
77
}
78