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 21, 14:45 UTC
fix(server): analytics record the thread binding a scheduled task actually got (#28761)
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Victor committed
Nov 14, 2026 at 05:55 UTC
ae837398a2548064aac2001b715670c404ee5f30
2 files changed
+23
-5
apps/server/src/telemetry/ProviderDimensions.test.ts
+13
@@ -76,3 +76,16 @@ it("drops input strings outside the schema's literals, since rejected calls are
76
handoffSettings("t3_thread_launch", { workspaceStrategy: { type: "/home/me/secret" } }, {}),
77
).toEqual({ targetChosen: false, workspace: "root" });
78
});
79
+
80
+it("records the binding the saved scheduled task resolved to, and none for failures", () => {
81
+ expect(handoffSettings("schedule_task", {}, { boundThreadId: null })).toEqual({
82
+ bindToCurrentThread: false,
83
+ });
84
+ expect(
85
+ handoffSettings(
86
+ "schedule_task",
87
+ { bindToCurrentThread: true },
88
+ { _tag: "OrchestratorMcpFailure", code: "invalid_request", message: "Different project." },
89
+ ),
90
+ ).toEqual({});
91
+});
apps/server/src/telemetry/ProviderDimensions.ts
+10
-5
@@ -128,9 +128,9 @@ function callerOrigin(input: {
128
}
129
130
/**
131
- * Settings the agent chose for a handoff, read only from closed enums and
132
- * booleans in the tool's arguments and result. Prompts, titles, and ids are
133
- * never read.
131
+ * Settings for a handoff, recorded only as closed enums and booleans derived
132
+ * from the tool's arguments and result. Prompts, titles, and ids are never
133
+ * recorded.
134
*/
135
export function handoffSettings(tool: string, args: unknown, result: unknown): Fields {
136
const input = asFields(args);
@@ -166,8 +166,13 @@ export function handoffSettings(tool: string, args: unknown, result: unknown): F
166
return defined({ delivery: stringField(output, "delivery") });
167
case "t3_thread_send_attachments":
168
return { delivery: "auto" };
169
- case "schedule_task":
170
- return { bindToCurrentThread: input.bindToCurrentThread !== false };
169
+ case "schedule_task": {
170
+ // Omitting the input lets the server decide, so read the saved task.
171
+ const bound = output.boundThreadId;
172
+ return bound === null || typeof bound === "string"
173
+ ? { bindToCurrentThread: bound !== null }
174
+ : {};
175
+ }
176
default:
177
return {};
178
}