Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions apps/server/src/telemetry/ProviderDimensions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,16 @@ it("drops input strings outside the schema's literals, since rejected calls are
handoffSettings("t3_thread_launch", { workspaceStrategy: { type: "/home/me/secret" } }, {}),
).toEqual({ targetChosen: false, workspace: "root" });
});

it("records the binding the saved scheduled task resolved to, and none for failures", () => {
expect(handoffSettings("schedule_task", {}, { boundThreadId: null })).toEqual({
bindToCurrentThread: false,
});
expect(
handoffSettings(
"schedule_task",
{ bindToCurrentThread: true },
{ _tag: "OrchestratorMcpFailure", code: "invalid_request", message: "Different project." },
),
).toEqual({});
});
15 changes: 10 additions & 5 deletions apps/server/src/telemetry/ProviderDimensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ function callerOrigin(input: {
}

/**
* Settings the agent chose for a handoff, read only from closed enums and
* booleans in the tool's arguments and result. Prompts, titles, and ids are
* never read.
* Settings for a handoff, recorded only as closed enums and booleans derived
* from the tool's arguments and result. Prompts, titles, and ids are never
* recorded.
*/
export function handoffSettings(tool: string, args: unknown, result: unknown): Fields {
const input = asFields(args);
Expand Down Expand Up @@ -166,8 +166,13 @@ export function handoffSettings(tool: string, args: unknown, result: unknown): F
return defined({ delivery: stringField(output, "delivery") });
case "t3_thread_send_attachments":
return { delivery: "auto" };
case "schedule_task":
return { bindToCurrentThread: input.bindToCurrentThread !== false };
case "schedule_task": {
// Omitting the input lets the server decide, so read the saved task.
const bound = output.boundThreadId;
return bound === null || typeof bound === "string"
? { bindToCurrentThread: bound !== null }
: {};
}
default:
return {};
}
Expand Down
Loading