Skip to content

Commit 09a32d1

Browse files
shivamhwpclaude
andcommitted
fix(web): hide limit recovery actions while a request is pending
The server refuses limit recovery changes while any request is pending, so the actions next to an open question could only fail. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent d83412a commit 09a32d1

3 files changed

Lines changed: 17 additions & 3 deletions

File tree

‎apps/web/src/components/ChatView.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2559,6 +2559,7 @@ export default function ChatView(props: ChatViewProps) {
25592559
resetAt: serverRuntime?.usageLimitResetAt ?? null,
25602560
stoppedAt: limitRecoveryRun.completedAt ?? activeThreadShell.updatedAt,
25612561
settled: activeThreadShell.settledOverride === "settled",
2562+
requestPending: pendingApprovals.length > 0 || pendingUserInputs.length > 0,
25622563
recovery: activeThreadShell.limitRecovery ?? null,
25632564
snoozedUntil: activeThreadShell.snoozedUntil,
25642565
timestampFormat,

‎apps/web/src/components/chat/UsageLimitRecoveryBanner.test.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ function bannerDescription(resetAt: Date, timestampFormat: TimestampFormat) {
1313
resetAt: resetAt.toISOString(),
1414
stoppedAt: stoppedAt.toISOString(),
1515
settled: false,
16+
requestPending: false,
1617
snoozedUntil: null,
1718
recovery: null,
1819
timestampFormat,

‎apps/web/src/components/chat/UsageLimitRecoveryBanner.tsx‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,28 @@ type RecoveryProps = {
2727
resetAt: string | null;
2828
stoppedAt: string;
2929
settled: boolean;
30+
requestPending: boolean;
3031
snoozedUntil: string | null;
3132
recovery: OrchestrationV2LimitRecovery | null;
3233
timestampFormat: TimestampFormat;
3334
onChange: (recovery: OrchestrationV2LimitRecoveryUpdate) => Promise<void>;
3435
};
3536

3637
export function usageLimitRecoveryBannerItem(props: RecoveryProps): ComposerBannerStackItem {
37-
const { runId, errorCode, resetAt, stoppedAt, settled, recovery, snoozedUntil, timestampFormat } =
38-
props;
39-
const canSchedule = !settled && resetAt !== null && Date.parse(resetAt) > Date.parse(stoppedAt);
38+
const {
39+
runId,
40+
errorCode,
41+
resetAt,
42+
stoppedAt,
43+
settled,
44+
requestPending,
45+
recovery,
46+
snoozedUntil,
47+
timestampFormat,
48+
} = props;
49+
// The server refuses recovery changes while a request is pending.
50+
const canSchedule =
51+
!settled && !requestPending && resetAt !== null && Date.parse(resetAt) > Date.parse(stoppedAt);
4052
const resumes =
4153
canSchedule && recovery?.runId === runId && recovery.resetAt === resetAt && recovery.autoResume;
4254
const workspaceLimit = errorCode === CHATGPT_WORKSPACE_USAGE_LIMIT_CODE;

0 commit comments

Comments
 (0)