From 69885a456b311594d47f0a369cdbda0527ab67b4 Mon Sep 17 00:00:00 2001 From: Ammar Date: Thu, 9 Oct 2025 10:09:18 -0500 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=A4=96=20Make=201M=20context=20settin?= =?UTF-8?q?g=20global=20instead=20of=20per-workspace?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change use1MContext hook to use global localStorage instead of per-workspace. The 1M context setting now applies to all workspaces. Changes: - Remove workspaceId parameter from use1MContext hook - Update all call sites to not pass workspaceId - Remove workspaceId from ChatContext (no longer needed) - Update ChatProvider in AIView to not require workspaceId This simplifies the UX - users either want 1M context or they don't, regardless of which workspace they're in. --- src/components/AIView.tsx | 1 - src/components/ChatInput.tsx | 2 +- src/components/ChatMetaSidebar/CostsTab.tsx | 4 ++-- src/components/Context1MCheckbox.tsx | 2 +- src/contexts/ChatContext.tsx | 5 +---- src/hooks/use1MContext.ts | 8 ++++---- 6 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/components/AIView.tsx b/src/components/AIView.tsx index 01e60f3e8c..93123caf9f 100644 --- a/src/components/AIView.tsx +++ b/src/components/AIView.tsx @@ -324,7 +324,6 @@ const AIViewInner: React.FC = ({ messages={messages} cmuxMessages={cmuxMessages} model={currentModel} - workspaceId={workspaceId} > diff --git a/src/components/ChatInput.tsx b/src/components/ChatInput.tsx index 31e39d116d..f1c97b2489 100644 --- a/src/components/ChatInput.tsx +++ b/src/components/ChatInput.tsx @@ -306,7 +306,7 @@ export const ChatInput: React.FC = ({ const modelSelectorRef = useRef(null); const [thinkingLevel] = useThinkingLevel(); const [mode, setMode] = useMode(); - const [use1M] = use1MContext(workspaceId); + const [use1M] = use1MContext(); const { recentModels } = useModelLRU(); const focusMessageInput = useCallback(() => { diff --git a/src/components/ChatMetaSidebar/CostsTab.tsx b/src/components/ChatMetaSidebar/CostsTab.tsx index 35979f3810..5022bce64e 100644 --- a/src/components/ChatMetaSidebar/CostsTab.tsx +++ b/src/components/ChatMetaSidebar/CostsTab.tsx @@ -280,9 +280,9 @@ const VIEW_MODE_OPTIONS: Array> = [ ]; export const CostsTab: React.FC = () => { - const { stats, isCalculating, workspaceId } = useChatContext(); + const { stats, isCalculating } = useChatContext(); const [viewMode, setViewMode] = usePersistedState("costsTab:viewMode", "last-request"); - const [use1M] = use1MContext(workspaceId); + const [use1M] = use1MContext(); // Only show loading if we don't have any stats yet if (isCalculating && !stats) { diff --git a/src/components/Context1MCheckbox.tsx b/src/components/Context1MCheckbox.tsx index 10642070b1..04a95a5339 100644 --- a/src/components/Context1MCheckbox.tsx +++ b/src/components/Context1MCheckbox.tsx @@ -67,7 +67,7 @@ export const Context1MCheckbox: React.FC = ({ workspaceId, modelString, }) => { - const [use1M, setUse1M] = use1MContext(workspaceId); + const [use1M, setUse1M] = use1MContext(); const isSupported = supports1MContext(modelString); if (!isSupported) { diff --git a/src/contexts/ChatContext.tsx b/src/contexts/ChatContext.tsx index 5192ac1cef..3a64187be9 100644 --- a/src/contexts/ChatContext.tsx +++ b/src/contexts/ChatContext.tsx @@ -8,7 +8,6 @@ interface ChatContextType { messages: DisplayedMessage[]; stats: ChatStats | null; isCalculating: boolean; - workspaceId: string; } const ChatContext = createContext(undefined); @@ -18,7 +17,6 @@ interface ChatProviderProps { messages: DisplayedMessage[]; cmuxMessages: CmuxMessage[]; model: string; - workspaceId: string; } export const ChatProvider: React.FC = ({ @@ -26,7 +24,6 @@ export const ChatProvider: React.FC = ({ messages, cmuxMessages, model, - workspaceId, }) => { const [stats, setStats] = useState(null); const [isCalculating, setIsCalculating] = useState(false); @@ -91,7 +88,7 @@ export const ChatProvider: React.FC = ({ }, [cmuxMessages, model]); return ( - + {children} ); diff --git a/src/hooks/use1MContext.ts b/src/hooks/use1MContext.ts index 82d1e98acd..1df0cee67a 100644 --- a/src/hooks/use1MContext.ts +++ b/src/hooks/use1MContext.ts @@ -2,11 +2,11 @@ import { usePersistedState } from "@/hooks/usePersistedState"; /** * Custom hook for 1M context state. - * Persists state per workspace in localStorage. + * Persists state globally in localStorage (applies to all workspaces). * - * @param workspaceId - Unique identifier for the workspace * @returns [use1MContext, setUse1MContext] tuple */ -export function use1MContext(workspaceId: string): [boolean, (value: boolean) => void] { - return usePersistedState(`use1MContext:${workspaceId}`, false); +export function use1MContext(): [boolean, (value: boolean) => void] { + return usePersistedState("use1MContext", false); } + From ad66469f2abbe3d26c936b5e5b3ec29658c29f47 Mon Sep 17 00:00:00 2001 From: Ammar Date: Thu, 9 Oct 2025 10:53:33 -0500 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A4=96=20Add=20closed=20PR=20detectio?= =?UTF-8?q?n=20to=20wait=5Fpr=5Fchecks.sh?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Script now fails early if PR is closed (not merged), preventing infinite waiting on closed PRs. --- scripts/wait_pr_checks.sh | 6 ++++++ src/components/AIView.tsx | 6 +----- src/components/ChatInput.tsx | 2 +- src/components/ChatToggles.tsx | 5 ++--- src/components/Context1MCheckbox.tsx | 6 +----- src/hooks/use1MContext.ts | 1 - 6 files changed, 11 insertions(+), 15 deletions(-) diff --git a/scripts/wait_pr_checks.sh b/scripts/wait_pr_checks.sh index a2a03935da..f0fdcad240 100755 --- a/scripts/wait_pr_checks.sh +++ b/scripts/wait_pr_checks.sh @@ -30,6 +30,12 @@ while true; do exit 0 fi + # Check if PR is closed without merging + if [ "$PR_STATE" = "CLOSED" ]; then + echo "❌ PR #$PR_NUMBER is closed (not merged)!" + exit 1 + fi + MERGEABLE=$(echo "$STATUS" | jq -r '.mergeable') MERGE_STATE=$(echo "$STATUS" | jq -r '.mergeStateStatus') diff --git a/src/components/AIView.tsx b/src/components/AIView.tsx index 93123caf9f..5c3aef98b6 100644 --- a/src/components/AIView.tsx +++ b/src/components/AIView.tsx @@ -320,11 +320,7 @@ const AIViewInner: React.FC = ({ } return ( - + diff --git a/src/components/ChatInput.tsx b/src/components/ChatInput.tsx index f1c97b2489..d8d5e77a59 100644 --- a/src/components/ChatInput.tsx +++ b/src/components/ChatInput.tsx @@ -763,7 +763,7 @@ export const ChatInput: React.FC = ({ )} - + = ({ workspaceId, modelString, children }) => { +export const ChatToggles: React.FC = ({ modelString, children }) => { return ( {children} - + ); }; diff --git a/src/components/Context1MCheckbox.tsx b/src/components/Context1MCheckbox.tsx index 04a95a5339..16e5d12d1e 100644 --- a/src/components/Context1MCheckbox.tsx +++ b/src/components/Context1MCheckbox.tsx @@ -59,14 +59,10 @@ const Checkbox = styled.input` `; interface Context1MCheckboxProps { - workspaceId: string; modelString: string; } -export const Context1MCheckbox: React.FC = ({ - workspaceId, - modelString, -}) => { +export const Context1MCheckbox: React.FC = ({ modelString }) => { const [use1M, setUse1M] = use1MContext(); const isSupported = supports1MContext(modelString); diff --git a/src/hooks/use1MContext.ts b/src/hooks/use1MContext.ts index 1df0cee67a..0fe5efe1c3 100644 --- a/src/hooks/use1MContext.ts +++ b/src/hooks/use1MContext.ts @@ -9,4 +9,3 @@ import { usePersistedState } from "@/hooks/usePersistedState"; export function use1MContext(): [boolean, (value: boolean) => void] { return usePersistedState("use1MContext", false); } -