Skip to content

Commit 85028f1

Browse files
committed
fix(contracts): accept thread results from linked environments without pinned
1 parent 34d635a commit 85028f1

3 files changed

Lines changed: 54 additions & 5 deletions

File tree

‎apps/server/src/mcp/OrchestratorMcpService.test.ts‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3552,12 +3552,16 @@ describe("OrchestratorMcpService thread list", () => {
35523552
});
35533553
assert.equal(listed.projectId, null);
35543554
assert.deepStrictEqual(
3555-
listed.threads.map((thread) => [thread.threadId, thread.projectId, thread.pinned]),
3555+
listed.threads.map((thread) => [thread.threadId, thread.projectId]),
35563556
[
3557-
["thread:a-snoozed", "project:a", false],
3558-
["thread:b-snoozed", "project:b", true],
3557+
["thread:a-snoozed", "project:a"],
3558+
["thread:b-snoozed", "project:b"],
35593559
],
35603560
);
3561+
assert.deepStrictEqual(
3562+
listed.threads.map((thread) => thread.pinned),
3563+
[false, true],
3564+
);
35613565
}).pipe(Effect.provide(service)),
35623566
);
35633567
});

‎packages/contracts/src/orchestratorMcp.test.ts‎

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,55 @@ import * as Schema from "effect/Schema";
44
import {
55
OrchestratorMcpDelegateTaskInput,
66
OrchestratorMcpDelegateTaskResult,
7+
OrchestratorMcpThreadDetail,
8+
OrchestratorMcpThreadListItem,
79
} from "./orchestratorMcp.ts";
810

911
const decodeDelegateTaskInput = Schema.decodeUnknownSync(OrchestratorMcpDelegateTaskInput);
1012
const decodeDelegateTaskResult = Schema.decodeUnknownSync(OrchestratorMcpDelegateTaskResult);
13+
const decodeThreadListItem = Schema.decodeUnknownSync(OrchestratorMcpThreadListItem);
14+
const decodeThreadDetail = Schema.decodeUnknownSync(OrchestratorMcpThreadDetail);
1115

1216
describe("orchestrator MCP contracts", () => {
17+
it("decodes thread results from a linked environment that predates pinned", () => {
18+
const listItem = {
19+
threadId: "thread-1",
20+
projectId: "project-1",
21+
title: "Fix the build",
22+
createdBy: "user",
23+
creationSource: "web",
24+
status: "completed",
25+
latestRunId: null,
26+
providerInstanceId: "codex",
27+
model: "gpt-5.4",
28+
runtimeMode: "full-access",
29+
interactionMode: "default",
30+
linkedPullRequest: null,
31+
settled: false,
32+
settledAt: null,
33+
snoozed: false,
34+
snoozedUntil: null,
35+
parentThreadId: null,
36+
relationshipToParent: null,
37+
itemCount: 0,
38+
createdAt: "2026-01-01T00:00:00.000Z",
39+
updatedAt: "2026-01-01T00:00:00.000Z",
40+
};
41+
const detail = {
42+
...listItem,
43+
activeRunId: null,
44+
titleRegeneration: null,
45+
branch: null,
46+
worktreePath: null,
47+
runCount: 0,
48+
pendingRequestCount: 0,
49+
archived: false,
50+
};
51+
52+
expect(decodeThreadListItem(listItem).pinned).toBeUndefined();
53+
expect(decodeThreadDetail(detail).pinned).toBeUndefined();
54+
});
55+
1356
it("decodes cross-provider delegated task requests and durable results", () => {
1457
const request = decodeDelegateTaskInput({
1558
task: "Inspect the workspace and report the result.",

‎packages/contracts/src/orchestratorMcp.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,8 @@ export const OrchestratorMcpThreadListItem = Schema.Struct({
371371
settledAt: Schema.NullOr(IsoDateTime),
372372
snoozed: Schema.Boolean,
373373
snoozedUntil: Schema.NullOr(IsoDateTime),
374-
pinned: Schema.Boolean,
374+
/** Absent from linked environments that predate it. */
375+
pinned: Schema.optional(Schema.Boolean),
375376
parentThreadId: Schema.NullOr(ThreadId),
376377
relationshipToParent: Schema.NullOr(Schema.Literals(["fork", "subagent"])),
377378
itemCount: NonNegativeInt,
@@ -452,7 +453,8 @@ export const OrchestratorMcpThreadDetail = Schema.Struct({
452453
settledAt: Schema.NullOr(IsoDateTime),
453454
snoozed: Schema.Boolean,
454455
snoozedUntil: Schema.NullOr(IsoDateTime),
455-
pinned: Schema.Boolean,
456+
/** Absent from linked environments that predate it. */
457+
pinned: Schema.optional(Schema.Boolean),
456458
createdAt: IsoDateTime,
457459
updatedAt: IsoDateTime,
458460
});

0 commit comments

Comments
 (0)