GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(mobile): one aligned notice for ChatGPT sharing limits by shivamhwp · Pull Request #31277 · pingdotgg/t3code

fix(mobile): one aligned notice for ChatGPT sharing limits #31277

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
shivamhwp merged 8 commits into pingdotgg:main from shivamhwp:t3/fix-mobile-chatgpt-limit-single-notice
Nov 5, 2026

Uh oh!

There was an error while loading. Please reload this page.

Merged

fix(mobile): one aligned notice for ChatGPT sharing limits #31277

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
8 commits
Select commit Hold shift + click to select a range
2a59ac2
fix(mobile): show one notice for ChatGPT sharing limits
shivamhwp Nov 5, 2026
283d19f
fix(mobile): keep reset controls when a ChatGPT limit has a reset time
shivamhwp Nov 5, 2026
315d227
fix(mobile): fold the ChatGPT limit notice into the one usage-limit card
shivamhwp Nov 5, 2026
218b5ea
fix(mobile): align the ChatGPT limit notice in one column with an inl…
shivamhwp Nov 5, 2026
7c06c17
fix(mobile): clear a stale ChatGPT action error when the action is re…
shivamhwp Nov 5, 2026
f243061
fix(mobile): ignore a ChatGPT action tap while the last one is in flight
shivamhwp Nov 5, 2026
16b0985
fix(mobile): announce the ChatGPT limit notice to screen readers
maria-rcks Nov 5, 2026
8a92e3b
Merge branch 'main' into t3/fix-mobile-chatgpt-limit-single-notice
shivamhwp Nov 5, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view

There are no files selected for viewing

69 changes: 0 additions & 69 deletions 69 apps/mobile/src/features/threads/ChatGptUsageLimitNotice.tsx
Show comments
View file
Open in desktop

This file was deleted.

Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

5 changes: 0 additions & 5 deletions 5 apps/mobile/src/features/threads/ThreadDetailScreen.tsx
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { parseThreadKey, threadKey } from "@t3tools/client-runtime/state/entitie
import { createThreadVisitTracker } from "@t3tools/client-runtime/state/thread-visits";
import { useChildThreadInputs, useThreadReportedModelSelection } from "../../state/entities";
import { UsageLimitRecoveryCard } from "./UsageLimitRecoveryCard";
import { ChatGptUsageLimitNotice } from "./ChatGptUsageLimitNotice";
import { useFocusEffect, useNavigation } from "@react-navigation/native";
import {
effectiveSnoozed,
Expand Down Expand Up @@ -1618,10 +1617,6 @@ function ThreadDetailBody(
thread={props.selectedThread}
environmentId={props.environmentId}
/>
<ChatGptUsageLimitNotice
key={`chatgpt-limit:${props.selectedThread.latestRun?.runId}`}
thread={props.selectedThread}
/>
<ChildThreadApprovals
threadRef={props.selectedThreadDetailRef}
maxHeight={pendingUserInputMaxHeight}
Expand Down
96 changes: 94 additions & 2 deletions 96 apps/mobile/src/features/threads/UsageLimitRecoveryCard.test.tsx
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import type { EnvironmentThreadShell } from "@t3tools/client-runtime/state/shell";
import type { EnvironmentId } from "@t3tools/contracts";
import {
CHATGPT_USAGE_LIMIT_CODE,
CHATGPT_WORKSPACE_USAGE_LIMIT_CODE,
} from "@t3tools/shared/usageLimits";
import * as Clipboard from "expo-clipboard";
import type { ReactNode } from "react";
import { act } from "react";
import { createRoot } from "react-dom/client";
Expand All @@ -8,8 +13,16 @@ import { describe, expect, it, vi } from "vite-plus/test";
type ButtonProps = { label: string; disabled?: boolean; onPress: () => void };

vi.mock("react-native", () => ({
Linking: { openURL: vi.fn() },
Pressable: ({ children, disabled, onPress }: ButtonProps & { children: ReactNode }) => (
<button type="button" disabled={disabled} onClick={onPress}>
{children}
</button>
),
View: ({ children }: { children: ReactNode }) => <div>{children}</div>,
}));
vi.mock("expo-clipboard", () => ({ setStringAsync: vi.fn() }));
vi.mock("../../components/ProviderIcon", () => ({ ProviderIcon: () => null }));
vi.mock("../../components/ui/AppText", () => ({
AppText: ({ children }: { children: ReactNode }) => <span>{children}</span>,
}));
Expand All @@ -27,18 +40,97 @@ import { UsageLimitRecoveryCard } from "./UsageLimitRecoveryCard";

const DAY_MS = 24 * 60 * 60 * 1000;

function failedThread(resetAt: string): EnvironmentThreadShell {
function failedThread(
resetAt: string | null,
lastErrorCode?: string,
lastErrorClass = "usage_limit",
): EnvironmentThreadShell {
return {
id: "thread-1",
updatedAt: new Date(0).toISOString(),
snoozedUntil: null,
latestRun: { runId: "run-1", completedAt: new Date(0).toISOString() },
limitRecovery: null,
runtime: { status: "failed", lastErrorClass: "usage_limit", usageLimitResetAt: resetAt },
runtime: { status: "failed", lastErrorClass, lastErrorCode, usageLimitResetAt: resetAt },
} as unknown as EnvironmentThreadShell;
}

describe("UsageLimitRecoveryCard", () => {
// Older servers report ChatGPT sharing limits as provider errors and may store a reset.
it.each([
[CHATGPT_USAGE_LIMIT_CODE, "usage_limit", null, ["Manage usage"]],
[CHATGPT_WORKSPACE_USAGE_LIMIT_CODE, "usage_limit", null, ["Copy request for admin"]],
[CHATGPT_USAGE_LIMIT_CODE, "provider_error", null, ["Manage usage"]],
[
CHATGPT_USAGE_LIMIT_CODE,
"usage_limit",
new Date(DAY_MS).toISOString(),
["Manage usage", "Resume at reset", "Snooze until reset"],
],
])("shows one ChatGPT notice for %s (%s, reset %s)", (code, errorClass, resetAt, actions) => {
const container = document.createElement("div");
const root = createRoot(container);
using _root = { [Symbol.dispose]: () => act(() => root.unmount()) };
act(() =>
root.render(
<UsageLimitRecoveryCard
thread={failedThread(resetAt, code, errorClass)}
environmentId={"env-1" as EnvironmentId}
/>,
),
);
expect(container.textContent).toContain("ChatGPT usage limit reached");
expect(container.textContent).not.toContain("did not report a reset time");
expect([...container.querySelectorAll("button")].map((button) => button.textContent)).toEqual(
actions,
);
});

it("drops a failed copy's error once a retry copies the request", async () => {
vi.mocked(Clipboard.setStringAsync)
.mockRejectedValueOnce(new Error("denied"))
.mockResolvedValueOnce(true);
const container = document.createElement("div");
const root = createRoot(container);
using _root = { [Symbol.dispose]: () => act(() => root.unmount()) };
act(() =>
root.render(
<UsageLimitRecoveryCard
thread={failedThread(null, CHATGPT_WORKSPACE_USAGE_LIMIT_CODE)}
environmentId={"env-1" as EnvironmentId}
/>,
),
);
const copy = () => container.querySelector("button")!.click();
await act(async () => copy());
expect(container.textContent).toContain("Could not copy the request");
await act(async () => copy());
expect(container.textContent).toContain("Request copied");
expect(container.textContent).not.toContain("Could not copy the request");
});

it("ignores a second copy while the first is still in flight", async () => {
const first = Promise.withResolvers<boolean>();
vi.mocked(Clipboard.setStringAsync).mockReset().mockReturnValueOnce(first.promise);
const container = document.createElement("div");
const root = createRoot(container);
using _root = { [Symbol.dispose]: () => act(() => root.unmount()) };
act(() =>
root.render(
<UsageLimitRecoveryCard
thread={failedThread(null, CHATGPT_WORKSPACE_USAGE_LIMIT_CODE)}
environmentId={"env-1" as EnvironmentId}
/>,
),
);
const copy = () => container.querySelector("button")!.click();
act(() => copy());
act(() => copy());
expect(Clipboard.setStringAsync).toHaveBeenCalledTimes(1);
await act(async () => first.resolve(true));
expect(container.textContent).toContain("Request copied");
});

it("disables Snooze once a reset more than 24.8 days away passes", () => {
using _timers = { [Symbol.dispose]: () => vi.useRealTimers() };
vi.useFakeTimers({ now: 0 });
Expand Down
133 changes: 106 additions & 27 deletions 133 apps/mobile/src/features/threads/UsageLimitRecoveryCard.tsx
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,17 @@ import { squashAtomCommandFailure } from "@t3tools/client-runtime/state/runtime"
import { AsyncResult } from "effect/reactivity";
import type { EnvironmentThreadShell } from "@t3tools/client-runtime/state/shell";
import type { EnvironmentId } from "@t3tools/contracts";
import {
CHATGPT_USAGE_LIMIT_CODE,
CHATGPT_USAGE_URL,
CHATGPT_WORKSPACE_ADMIN_REQUEST,
CHATGPT_WORKSPACE_USAGE_LIMIT_CODE,
} from "@t3tools/shared/usageLimits";
import * as DateTime from "effect/DateTime";
import * as Clipboard from "expo-clipboard";
import { useState } from "react";
import { View } from "react-native";
import { Linking, Pressable, View } from "react-native";
import { ProviderIcon } from "../../components/ProviderIcon";
import { AppText as Text } from "../../components/ui/AppText";
import { useDeadlinePassed } from "../../lib/clock";
import { threadEnvironment } from "../../state/threads";
Expand All @@ -30,12 +38,22 @@ export function UsageLimitRecoveryCard({
const recovery = thread.limitRecovery;
const scheduled =
recovery?.runId === runId && recovery?.resetAt === resetAt && recovery?.autoResume;
const [copied, setCopied] = useState(false);
const [actionPending, setActionPending] = useState(false);
const code = thread.runtime?.lastErrorCode;
// OpenAI's partner guidelines specify the ChatGPT notice and its action.
const workspaceLimit = code === CHATGPT_WORKSPACE_USAGE_LIMIT_CODE;
const chatGptLimit = workspaceLimit || code === CHATGPT_USAGE_LIMIT_CODE;
if (
thread.runtime?.status !== "failed" ||
thread.runtime.lastErrorClass !== "usage_limit" ||
// Older servers report ChatGPT sharing limits as provider errors.
(thread.runtime.lastErrorClass !== "usage_limit" && !chatGptLimit) ||
!runId
)
return null;
const resetText = resetAt
? `Usage limit resets ${DateTime.toDateUtc(DateTime.makeUnsafe(resetAt)).toLocaleString()}.`
: null;
const snoozed =
recovery?.snooze === true &&
recovery.runId === runId &&
Expand Down Expand Up @@ -68,34 +86,95 @@ export function UsageLimitRecoveryCard({
setError(cause instanceof Error ? cause.message : "Could not change limit recovery.");
}
}
const action = workspaceLimit
? {
label: "Copy request for admin",
role: "button" as const,
run: () => {
setError(null);
setCopied(false);
setActionPending(true);
void Clipboard.setStringAsync(CHATGPT_WORKSPACE_ADMIN_REQUEST)
.then(
() => setCopied(true),
() => setError("Could not copy the request. Try again."),
)
.finally(() => setActionPending(false));
},
}
: {
label: "Manage usage",
role: "link" as const,
run: () => {
setError(null);
setActionPending(true);
void Linking.openURL(CHATGPT_USAGE_URL)
.catch(() => setError("Could not open ChatGPT. Go to chatgpt.com → Settings → Usage."))
.finally(() => setActionPending(false));
},
};
return (
<View className="mx-3 mb-2 gap-2 rounded-xl border border-warning-foreground/25 bg-screen p-3">
<Text className="text-sm text-warning-foreground">
{resetAt
? `Usage limit resets ${DateTime.toDateUtc(DateTime.makeUnsafe(resetAt)).toLocaleString()}.`
: "The provider did not report a reset time. Retry manually when your limit is available."}
</Text>
{canSchedule ? (
<View className="flex-row flex-wrap gap-2">
<Button
label={scheduled ? "Cancel auto-resume" : "Resume at reset"}
tone="secondary"
disabled={pending}
onPress={() => void toggle("resume")}
/>
<Button
label={snoozed ? "Wake now" : "Snooze until reset"}
tone="secondary"
disabled={pending || (!snoozed && resetPassed)}
onPress={() => void toggle("snooze")}
/>
<View
accessibilityRole={chatGptLimit ? "alert" : undefined}
className="mx-3 mb-2 flex-row gap-2 rounded-xl border border-warning-foreground/25 bg-screen p-3"
>
{chatGptLimit ? (
<View className="pt-0.5">
<ProviderIcon provider="codex" size={16} />
</View>
) : null}
{error ? (
<Text accessibilityRole="alert" className="text-sm text-destructive">
{error}
</Text>
) : null}
<View className="min-w-0 flex-1 gap-2">
{chatGptLimit ? (
<View className="gap-1">
<Text className="text-sm font-t3-medium text-foreground">
ChatGPT usage limit reached
Comment thread
shivamhwp marked this conversation as resolved.
Resolved

Uh oh!

There was an error while loading. Please reload this page.

</Text>
<Text className="text-sm text-foreground-muted">
{workspaceLimit
? copied
? "Request copied. Send it to your workspace admin."
: "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."
: (resetText ?? "Review your usage settings in ChatGPT.")}
</Text>
<Pressable
accessibilityRole={action.role}
accessibilityState={{ disabled: actionPending }}
disabled={actionPending}
hitSlop={14}
className="mt-1 self-start active:opacity-70"
onPress={action.run}
>
<Text className="text-sm font-t3-medium text-primary">{action.label}</Text>
</Pressable>
</View>
) : (
<Text className="text-sm text-warning-foreground">
{resetText ??
"The provider did not report a reset time. Retry manually when your limit is available."}
</Text>
)}
{canSchedule ? (
<View className="flex-row flex-wrap gap-2">
<Button
label={scheduled ? "Cancel auto-resume" : "Resume at reset"}
tone="secondary"
disabled={pending}
onPress={() => void toggle("resume")}
/>
<Button
label={snoozed ? "Wake now" : "Snooze until reset"}
tone="secondary"
disabled={pending || (!snoozed && resetPassed)}
onPress={() => void toggle("snooze")}
/>
</View>
) : null}
{error ? (
<Text accessibilityRole="alert" className="text-sm text-destructive">
{error}
</Text>
) : null}
</View>
</View>
);
}
Loading
Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.