Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

[codex] fix: guard trace ID clipboard copy (#3505)

Wout Stiensea52bb1dbda1
diff --git a/apps/web/src/components/settings/ConnectionsSettings.tsx b/apps/web/src/components/settings/ConnectionsSettings.tsx
index 96d9dd451..e693c7b15 100644
--- a/apps/web/src/components/settings/ConnectionsSettings.tsx
+++ b/apps/web/src/components/settings/ConnectionsSettings.tsx
@@ -1423,6 +1423,31 @@ function SavedBackendListRow({
: "bg-muted-foreground/40";
const statusTooltip = connectionStatusText(environment.connection);
const errorTraceId = environment.connection.traceId;
+ const { copyToClipboard: copyTraceIdToClipboard } = useCopyToClipboard<{ traceId: string }>({
+ target: "trace ID",
+ onCopy: ({ traceId }) => {
+ toastManager.add({
+ type: "success",
+ title: "Trace ID copied",
+ description: traceId,
+ });
+ },
+ onError: (error) => {
+ toastManager.add(
+ stackedThreadToast({
+ type: "error",
+ title: "Could not copy trace ID",
+ description: error.message,
+ }),
+ );
+ },
+ });
+ const copyTraceId = useCallback(
+ (traceId: string) => {
+ copyTraceIdToClipboard(traceId, { traceId });
+ },
+ [copyTraceIdToClipboard],
+ );
const versionMismatch = resolveServerConfigVersionMismatch(environment.serverConfig);
const sshTarget =
environment.entry.target._tag === "SshConnectionTarget" &&
@@ -1468,7 +1493,7 @@ function SavedBackendListRow({
<button
type="button"
className="shrink-0 underline underline-offset-2"
- onClick={() => void navigator.clipboard.writeText(errorTraceId)}
+ onClick={() => copyTraceId(errorTraceId)}
>
Copy trace ID
</button>