The best way to control Claude Code, Codex and more from any computer or phone
perf(web): ACP session management compile with the React Compiler (#20510)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Oct 16, 2026 at 18:53 UTC
d23ac516c4372ddb1e01c0e6f3b98c715c023b29
2 files changed
+36
-21
apps/web/reactCompiledFiles.ts
+1
@@ -85,4 +85,5 @@ export const REACT_COMPILED_FILES = [
85
"apps/web/src/components/settings/DiagnosticsSettings.tsx",
86
"apps/web/src/components/settings/DeviceHostsSettings.tsx",
87
"apps/web/src/components/settings/ProjectSettingsPanel.tsx",
88
+ "apps/web/src/components/settings/AcpSessionManagementSection.tsx",
89
] as const;
apps/web/src/components/settings/AcpSessionManagementSection.tsx
+35
-21
@@ -44,6 +44,32 @@ function reportFailure(title: string, result: AtomCommandResult<unknown, unknown
44
});
45
}
46
47
+function parseProviderHeaders(
48
+ text: string,
49
+):
50
+ | { readonly ok: true; readonly headers: Record<string, string> | undefined }
51
+ | { readonly ok: false; readonly error: string } {
52
+ if (text.trim().length === 0) return { ok: true, headers: undefined };
53
+ let parsed: unknown;
54
+ try {
55
+ parsed = JSON.parse(text);
56
+ } catch (error) {
57
+ return {
58
+ ok: false,
59
+ error: error instanceof Error ? error.message : "Headers must be valid JSON.",
60
+ };
61
+ }
62
+ if (
63
+ typeof parsed !== "object" ||
64
+ parsed === null ||
65
+ Array.isArray(parsed) ||
66
+ !Object.values(parsed).every((value) => typeof value === "string")
67
+ ) {
68
+ return { ok: false, error: "Headers must be a JSON object with string values." };
69
+ }
70
+ return { ok: true, headers: parsed as Record<string, string> };
71
+}
72
+
73
export function AcpSessionManagementSection(props: {
74
readonly environmentId: EnvironmentId;
75
readonly instanceId: ProviderInstanceId;
@@ -221,28 +247,16 @@ export function AcpSessionManagementSection(props: {
247
return;
248
const draft = providerDrafts[provider.providerId];
249
if (draft === undefined || draft.apiType.length === 0 || draft.baseUrl.length === 0) return;
224
- let headers: Record<string, string> | undefined;
225
- if (draft.headers.trim().length > 0) {
226
- try {
227
- const parsed: unknown = JSON.parse(draft.headers);
228
- if (
229
- typeof parsed !== "object" ||
230
- parsed === null ||
231
- Array.isArray(parsed) ||
232
- !Object.values(parsed).every((value) => typeof value === "string")
233
- ) {
234
- throw new Error("Headers must be a JSON object with string values.");
235
- }
236
- headers = parsed as Record<string, string>;
237
- } catch (error) {
238
- toastManager.add({
239
- type: "error",
240
- title: "Invalid provider headers",
241
- description: error instanceof Error ? error.message : "Headers must be valid JSON.",
242
- });
243
- return;
244
- }
250
+ const parsedHeaders = parseProviderHeaders(draft.headers);
251
+ if (!parsedHeaders.ok) {
252
+ toastManager.add({
253
+ type: "error",
254
+ title: "Invalid provider headers",
255
+ description: parsedHeaders.error,
256
+ });
257
+ return;
258
}
259
+ const headers = parsedHeaders.headers;
260
setSavingProviderId(provider.providerId);
261
const result = await setProvider({
262
environmentId: props.environmentId,