fix(clients): missing file links no longer trigger automatic project-wide searches #45515
Openjamesx0416(GitHub profile, opens in a new tab)wants to merge 4 commits into
main fromrefs/pull/45515/headopened View on GitHubPushed0d88fbe
- @@ -1161,20 +1161 @@1161- cwd={cwd}1162- environmentId={environmentId}1163- previewUri={previewUri}1164- previewFailure={assetPreview._tag === "Failure" ? assetPreview.reason : null}1165- onRetryPreview={handleRetryPreview}1166- videoSource={videoSource}1167- mediaSource={mediaSource}1168- resolveVideoUri={assetPreview.refresh}1169- fileContents={fileContents}1170- fileError={decodedTextPending ? null : fileQuery.error}1171- initialLine={targetLine}1172- relativePath={relativePath}1173- threadId={threadId}1174- truncated={fileTruncated}1175- selectable={selectingText}1176- onRefresh={() => {1177- setFileRefreshCount((count) => count + 1);1178- return fileQuery.refresh();1179- }}1180- />1161+ {metadata.isSuccess && metadata.data === null && cwd !== null && environmentId !== null ? (@@ -5898,4 +5898,7 @@58985898 "7385ca17ce898a69": "Работающие субагенты",58995899 "f1fe5ff1f4c8bef4": "Нажмите и удерживайте элемент, чтобы перетащить его на другую строку или в «Скрытые», чтобы скрыть. Нажмите на заголовок, ветку или окружение, чтобы изменить их вид.",59005900 "0d42104c6921fb4a": "Одна строка",5901- "c799f2ecb8c6429a": "Переносить на две строки"5901+ "c799f2ecb8c6429a": "Переносить на две строки",5902+ "ebac85f732654f10": "Найти файл в проектах",5903+ "bade902a1eedec95": "Не удалось найти единственный подходящий файл.",5904+ "67daede9aa8707e7": "Не удалось найти файл. Повторите попытку."@@ -1643,0 +1670,21 @@1670+ {!isHostFile ? (1671+ <p className="text-muted-foreground">1672+ <T>1673+ Workspace folder:{" "}1674+ <code className="break-all font-mono select-all">1675+ <Var>{file.readError?.cwd ?? cwd}</Var>1676+ </code>1677+ . Check the link's path or locate the file in Files.1678+ </T>1679+ </p>1680+ ) : null}1681+ {canReadFiles &&1682+ openInShortcutEnabled &&1683+ file.readError?.failure === "operation_failed" &&1684+ file.readError.operation !== "realpath-workspace-root" ? (1685+ <MissingFileSearch1686+ key={JSON.stringify([environmentId, cwd, relativePath])}1687+ environmentId={environmentId}1688+ cwd={cwd}1689+ path={relativePath}1690+ onOpen={(path) => onOpenFile(path, revealLine ?? undefined)}@@ -0,0 +2,21 @@2+import { useGT } from "gt-react";3+import type { EnvironmentId } from "@t3tools/contracts";4+import {5+ broaderWorkspaceLinkQuery,6+ findBroaderWorkspaceLink,7+ WORKSPACE_BASENAME_LOOKUP_LIMIT,8+} from "@t3tools/client-runtime/workspace-basename-lookup";9+import { Button } from "~/components/ui/button";10+import { useProjects } from "~/state/entities";11+import { projectEnvironment } from "~/state/projects";12+import { useAtomQueryRunner } from "~/state/use-atom-query-runner";13+14+export function MissingFileSearch(props: {15+ readonly environmentId: EnvironmentId;16+ readonly cwd: string;17+ readonly path: string;18+ readonly onOpen: (path: string) => void;19+}) {20+ const gt = useGT();21+ const projects = useProjects();22+ const run = useAtomQueryRunner(projectEnvironment.searchEntries, { reportFailure: false });@@ -13230,4 +13230,7 @@1323013230 "9a0d4e2bbb72187d": "Чтобы взять блок, нажмите Пробел или Enter. Перемещайте его стрелками, отпустите Пробелом или Enter, отмените клавишей Escape.",1323113231 "e4ed2fe1630d8098": "{item} над {target}.",1323213232 "b0fd34adb523d69c": "{item} перемещён на место {target}.",13233- "f8dbc1bf18416476": "{item} снова на своём месте."13233+ "f8dbc1bf18416476": "{item} снова на своём месте.",13234+ "ebac85f732654f10": "Найти файл в проектах",13235+ "bade902a1eedec95": "Не удалось найти единственный подходящий файл.",13236+ "67daede9aa8707e7": "Не удалось найти файл. Повторите попытку."
Pushede91cc79
- @@ -1801,3 +1853,4 @@18011853 htmlRender={attachment.htmlRender === true}18021854 threadRef={threadRef}18031855 />1856+ ) : recoverableFileFailure ? (
Pushedfc85a88
- @@ -1163,18 +1161,3 @@1163- previewUri={previewUri}1164- previewFailure={assetPreview._tag === "Failure" ? assetPreview.reason : null}1165- onRetryPreview={handleRetryPreview}1166- videoSource={videoSource}1167- mediaSource={mediaSource}1168- resolveVideoUri={assetPreview.refresh}1169- fileContents={fileContents}1170- fileError={decodedTextPending ? null : fileQuery.error}1171- initialLine={targetLine}1172- relativePath={relativePath}1173- threadId={threadId}1174- truncated={fileTruncated}1175- selectable={selectingText}1176- onRefresh={() => {1177- setFileRefreshCount((count) => count + 1);1178- return fileQuery.refresh();1179- }}1180- />1161+ {fileContents === null &&1162+ metadata.isSuccess &&1163+ metadata.data === null &&@@ -0,0 +41,21 @@41+ environmentId: props.environmentId,42+ roots: projects43+ .filter((project) => project.environmentId === props.environmentId)44+ .map((project) => project.workspaceRoot),45+ isCurrent: () => !controller.signal.aborted,46+ search: async (cwd, query) => {47+ const result = await run(48+ {49+ environmentId: props.environmentId,50+ input: { cwd, query, kind: "file", limit: WORKSPACE_BASENAME_LOOKUP_LIMIT },51+ },52+ { signal: controller.signal },53+ );54+ if (result._tag !== "Success") throw new Error("File search failed");55+ return result.value.entries;56+ },57+ });58+ if (controller.signal.aborted) return;59+ if (match !== null) {60+ setStatus("idle");61+ props.onOpen(match);
Sign in to join this conversation.
Codex Review Summary: ❌ Failed
This comment shows the latest Codex review activity on this pull request.
We couldn’t complete this review. Comment
@codex reviewto try again.0d88fbeℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.