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
2 changes: 1 addition & 1 deletion packages/client-runtime/src/state/threadFeedback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export function beginCodexFeedbackSubmission(
export function codexFeedbackMessage(
submission: CodexFeedbackSubmission,
role: "user" | "assistant" = "user",
): OrchestrationMessage {
): OrchestrationMessage & { readonly role: "user" | "assistant" } {
const text =
role === "user"
? submission.command
Expand Down
18 changes: 18 additions & 0 deletions packages/contracts/src/orchestration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,24 @@ it.effect("decodes thread.created runtime mode for historical events", () =>
}),
);

// Builds that emit thinking traces persist reasoning as message events; the
// union must keep decoding them.
it.effect("decodes message events with a reasoning role", () =>
Effect.gen(function* () {
const parsed = yield* decodeThreadMessageSentPayload({
threadId: "thread-1",
messageId: "reasoning:summary:1",
role: "reasoning",
text: "thinking",
turnId: null,
streaming: false,
createdAt: "2026-01-01T00:00:00.000Z",
updatedAt: "2026-01-01T00:00:00.000Z",
});
assert.strictEqual(parsed.role, "reasoning");
}),
);

it.effect("decodes thread.meta-updated payloads with explicit provider", () =>
Effect.gen(function* () {
const parsed = yield* decodeThreadMetaUpdatedPayload({
Expand Down
10 changes: 9 additions & 1 deletion packages/contracts/src/orchestration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,15 @@ export const OrchestrationProject = Schema.Struct({
});
export type OrchestrationProject = typeof OrchestrationProject.Type;

export const OrchestrationMessageRole = Schema.Literals(["user", "assistant", "system"]);
/** `reasoning` stays in the union so persisted v1 events written by builds that
* emit thinking traces still decode. V2 carries reasoning as turn items and
* never produces new reasoning messages here. */
export const OrchestrationMessageRole = Schema.Literals([
"user",
"assistant",
"system",
"reasoning",
]);
export type OrchestrationMessageRole = typeof OrchestrationMessageRole.Type;

export const OrchestrationMessage = Schema.Struct({
Expand Down
Loading