Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(desktop): 修复 device-link 远程审查 CHANNEL_NOT_ALLOWED 降级路径
david21807ca4b41c
diff --git a/apps/desktop/src/renderer/features/right-sidebar/plugins/review/ReviewTabBody.tsx b/apps/desktop/src/renderer/features/right-sidebar/plugins/review/ReviewTabBody.tsxindex d183eef811..81ec489af6 100644--- a/apps/desktop/src/renderer/features/right-sidebar/plugins/review/ReviewTabBody.tsx+++ b/apps/desktop/src/renderer/features/right-sidebar/plugins/review/ReviewTabBody.tsx@@ -57,7 +57,7 @@ import type {ReviewStageOperationSummary,} from '@/lib/gitReview.types';import { formatSidebarTime } from '@/features/cc-agent/lib/formatSidebarTime';-import { isDeviceTooOldError } from '@/lib/fileBrowserTransport';+import { gitReviewApiFor, isReviewRemoteOversizeError } from '@/lib/gitReviewTransport';import { makerChatStore } from '@/lib/makerChatStore';import type { TurnChangeSetDetail } from '../../../../../shared/turnChangeSet';@@ -583,7 +583,7 @@ function GitReviewTabBody({ state, ctx, source, setSource, selectedCommitOid, seconst sessionId = ctx.sessionId || null;const hideWhitespace = state.hideWhitespace ?? false;const branchBaseRef = state.branchBaseRef ?? null;- const { data, loading, error, refresh, setData: setReviewData } = useReviewGitState(sessionId, hideWhitespace, deviceLinkDeviceId);+ const { data, loading, error, errorCode, refresh, setData: setReviewData } = useReviewGitState(sessionId, hideWhitespace, deviceLinkDeviceId);const commitsState = useReviewCommits(sessionId, branchBaseRef, deviceLinkDeviceId);const [pendingKey, setPendingKey] = useState<string | null>(null);const [operationError, setOperationError] = useState<string | null>(null);@@ -1112,7 +1112,7 @@ function GitReviewTabBody({ state, ctx, source, setSource, selectedCommitOid, seif (error && !data) {// device-link 远程会话的两类确定性失败给专属占位:老被控端无 remote-op// channel(升级即解决,刷新无用),以及响应超设备互联帧预算。- if (deviceLinkDeviceId && isDeviceTooOldError(error)) {+ if (deviceLinkDeviceId && errorCode === 'DEVICE_LINK_CHANNEL_NOT_ALLOWED') {return (<CenteredStateicon={<AlertTriangle size={24} />}diff --git a/apps/desktop/src/renderer/features/right-sidebar/plugins/review/useReviewGitState.ts b/apps/desktop/src/renderer/features/right-sidebar/plugins/review/useReviewGitState.tsindex 7924d53996..a293e7b3db 100644--- a/apps/desktop/src/renderer/features/right-sidebar/plugins/review/useReviewGitState.ts+++ b/apps/desktop/src/renderer/features/right-sidebar/plugins/review/useReviewGitState.ts@@ -31,14 +31,12 @@ interface LoadState<T> {data: T | null;loading: boolean;error: string | null;+ /** IPC error code (e.g. 'DEVICE_LINK_CHANNEL_NOT_ALLOWED'); null when error is absent or not an IPC error. */+ errorCode: string | null;refresh: () => void;setData: (data: T) => void;}-function messageFromError(err: unknown): string {- return extractIpcError(err)?.message ?? (err instanceof Error ? err.message : String(err));-}-function useDebouncedCallback(cb: () => void, delayMs: number): () => void {const timerRef = useRef<number | null>(null);const cbRef = useRef(cb);@@ -84,6 +82,7 @@ function useGitReviewLoad<T>(});const [loading, setLoading] = useState(false);const [error, setError] = useState<string | null>(null);+ const [errorCode, setErrorCode] = useState<string | null>(null);const requestRef = useRef(0);const setData = useCallback((next: T) => {setDataState(next);@@ -95,6 +94,7 @@ function useGitReviewLoad<T>(requestRef.current += 1;if (!preserveWhenDisabled) setDataState(null);setError(null);+ setErrorCode(null);setLoading(false);return;}@@ -106,12 +106,14 @@ function useGitReviewLoad<T>(if (requestRef.current !== requestId) return;setData(next);setError(null);+ setErrorCode(null);}).catch((err) => {if (requestRef.current !== requestId) return;- const message = messageFromError(err);- setError(message);- log.warn(logLabel, { sessionId, message });+ const ipcErr = extractIpcError(err);+ setError(ipcErr?.message ?? (err instanceof Error ? err.message : String(err)));+ setErrorCode(ipcErr?.code ?? null);+ log.warn(logLabel, { sessionId, message: ipcErr?.message ?? String(err) });}).finally(() => {if (requestRef.current === requestId) setLoading(false);@@ -143,7 +145,7 @@ function useGitReviewLoad<T>(};}, [sessionId, debouncedLoad]);- return { data, loading, error, refresh: load, setData };+ return { data, loading, error, errorCode, refresh: load, setData };}export function useReviewGitState(