Skip to content

Commit d66df74

Browse files
saphidclaude
authored andcommitted
fix(server): OTLP export settings survive a saved token streaming mode
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent d8a829e commit d66df74

2 files changed

Lines changed: 17 additions & 3 deletions

File tree

‎packages/shared/src/serverSettings.test.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,15 @@ describe("serverSettings helpers", () => {
253253
otlpMetricsUrl: "http://localhost:4318/v1/metrics",
254254
otlpLogsUrl: "http://localhost:4318/v1/logs",
255255
});
256+
// The server still loads a file holding the retired token streaming mode.
257+
expect(
258+
parsePersistedServerObservabilitySettings(
259+
JSON.stringify({
260+
responseStreamingMode: "token",
261+
observability: { otlpTracesUrl: "http://localhost:4318/v1/traces" },
262+
}),
263+
).otlpTracesUrl,
264+
).toBe("http://localhost:4318/v1/traces");
256265
});
257266

258267
it("falls back cleanly when persisted settings are invalid", () => {

‎packages/shared/src/serverSettings.ts‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,13 @@ import {
3434
resolveBackgroundActivitySettings,
3535
} from "./backgroundActivitySettings.ts";
3636

37-
const ServerSettingsJson = fromLenientJson(ServerSettings);
38-
const decodeServerSettingsJson = Schema.decodeUnknownOption(ServerSettingsJson);
37+
// Only observability: a value the server migrates on load elsewhere in the file must not drop it.
38+
const ServerObservabilitySettingsJson = fromLenientJson(
39+
Schema.Struct({ observability: ServerSettings.fields.observability }),
40+
);
41+
const decodeServerObservabilitySettingsJson = Schema.decodeUnknownOption(
42+
ServerObservabilitySettingsJson,
43+
);
3944

4045
export function isModelSelectionProviderEnabled(
4146
settings: ServerSettings,
@@ -180,7 +185,7 @@ function extractPersistedServerObservabilitySettings(input: {
180185
export function parsePersistedServerObservabilitySettings(
181186
raw: string,
182187
): PersistedServerObservabilitySettings {
183-
const decoded = decodeServerSettingsJson(raw);
188+
const decoded = decodeServerObservabilitySettingsJson(raw);
184189
if (Option.isSome(decoded)) {
185190
return extractPersistedServerObservabilitySettings(decoded.value);
186191
}

0 commit comments

Comments
 (0)