@devries-cameron20 / t3code Mirror · read-only / commits / 62dd1a3780
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 22, 03:15 UTC

fix(server): a policy that manages observability endpoints is refused instead of ignored (#30973)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

MarcoDotIO committed Nov 5, 2026 at 23:42 UTC 62dd1a378093a973edff4c843fa944353d1177fb
3 files changed +22 -1
apps/server/src/policy/ManagedPolicy.test.ts
+7 -1
@@ -142,6 +142,11 @@ it.layer(NodeServices.layer)("ManagedPolicy.load", (it) => {
142 },
143 },
144 }),
145 + // Startup reads OTLP endpoints before the policy, and environment variables outrank them.
146 + JSON.stringify({
147 + ...base,
148 + settings: { "observability.otlpTracesUrl": { value: "", locked: true } },
149 + }),
150 ],
151 (contents) =>
152 loadFrom(contents).pipe(
@@ -149,7 +154,7 @@ it.layer(NodeServices.layer)("ManagedPolicy.load", (it) => {
154 Effect.map((error) => error.reason),
155 ),
156 );
152 - assert.lengthOf(reasons, 13);
157 + assert.lengthOf(reasons, 14);
158 assert.include(reasons[3], "storageCleanup.logsAfterDayz");
159 assert.include(reasons[6], "adds entries users could not remove");
160 assert.include(reasons[7], "adds entries users could not remove");
@@ -158,6 +163,7 @@ it.layer(NodeServices.layer)("ManagedPolicy.load", (it) => {
163 assert.include(reasons[10], 'lock "worktreeCleanup" too');
164 assert.include(reasons[11], 'lock "providerInstances.codex" as a whole');
165 assert.include(reasons[12], "holds a credential");
166 + assert.include(reasons[13], "a policy cannot override");
167 }),
168 );
169
apps/server/src/policy/managedSettings.ts
+13
@@ -28,6 +28,13 @@ const UNMANAGEABLE_KEYS: ReadonlySet<string> = new Set([
28 "projectScriptOverrides",
29 ]);
30
31 +/**
32 + * Startup resolves OTLP endpoints from the settings file and desktop bootstrap input before the policy
33 + * loads, and the user's OTLP environment variables outrank them, so a managed value would look
34 + * enforced without being.
35 + */
36 +const ENVIRONMENT_OVERRIDDEN_KEYS: ReadonlySet<string> = new Set(["observability"]);
37 +
38 /** Legacy settings the server derives from another on every write; manage that one instead. */
39 const DERIVED_FROM: ReadonlyMap<string, string> = new Map([
40 ["compactIdleThreads", "idleCompaction"],
@@ -253,6 +260,12 @@ export function makeManagedSettings(
260 if (!(head in ServerSettings.fields) || UNMANAGEABLE_KEYS.has(head)) {
261 return { _tag: "Invalid", reason: `"${path}" is not a setting this version can manage` };
262 }
263 + if (ENVIRONMENT_OVERRIDDEN_KEYS.has(head)) {
264 + return {
265 + _tag: "Invalid",
266 + reason: `"${path}" is resolved at startup from each user's environment, settings file and desktop bootstrap input, which a policy cannot override`,
267 + };
268 + }
269 const source = DERIVED_FROM.get(head);
270 if (source !== undefined) {
271 return {
docs/user/managed-policy.md
+2
@@ -146,6 +146,8 @@ A few settings need care:
146 - `worktreeCleanup`, which projects can also set, overrides the `worktree` rules in
147 `storageCleanup`. Lock it along with those rules; T3 Code refuses a policy that locks only the
148 rules.
149 +- `observability` cannot be managed. Its OTLP endpoints come from each user's environment
150 + variables, settings file and desktop startup input, which a policy cannot override.
151 - Manage `idleCompaction`, not the older `compactIdleThreads`. A Claude instance's own idle
152 compaction choice still wins over `idleCompaction`.
153 - A provider instance's fields override each other, so lock `providerInstances.<id>` as a whole,