feat(orchestration-v2): model native subagents

Co-authored-by: codex <[email protected]>
This commit is contained in:
Julius Marmingeandcodex authored and maria-rcks committed 2026-08-03 11:44:59 -04:00
1 parent 556b9464f8
commit 471005ff2f
23 files changed
+1301 -49

No files matched your search

@@ -25,6 +25,7 @@ import {
type OrchestrationV2ProviderThread,
type OrchestrationV2ProviderTurn,
type OrchestrationV2RuntimeRequest,
type OrchestrationV2Subagent,
type OrchestrationV2TurnItem,
type OrchestrationV2WebSearchResult,
type ProviderApprovalDecision,
@@ -1565,10 +1566,17 @@ interface ActiveClaudeTurnContext {
nativeItemId: string;
};
readonly toolCalls: Map<string, ActiveClaudeToolCall>;
readonly subagentsByTaskId: Map<string, ActiveClaudeSubagent>;
readonly subagentNodesByTaskId: Map<string, OrchestrationV2ExecutionNode["id"]>;
readonly subagentNodesByToolUseId: Map<string, OrchestrationV2ExecutionNode["id"]>;
}
interface ActiveClaudeSubagent {
task: OrchestrationV2Subagent;
readonly turnItemId: OrchestrationV2TurnItem["id"];
readonly turnItemOrdinal: number;
}
interface ClaudeLiveQueryContext {
readonly nativeThreadId: string;
readonly query: ClaudeAgentSdkQuerySession;
@@ -1823,6 +1831,9 @@ export function makeClaudeAdapterV2(
readonly context: ActiveClaudeTurnContext;
readonly taskId: string;
readonly toolUseId?: string;
readonly prompt?: string;
readonly title?: string;
readonly result?: string;
readonly status: Extract<
OrchestrationV2ExecutionNode["status"],
"running" | "completed" | "failed" | "cancelled"
@@ -1851,6 +1862,50 @@ export function makeClaudeAdapterV2(
input.context.subagentNodesByToolUseId.set(input.toolUseId, nodeId);
}
}
const existingSubagent = input.context.subagentsByTaskId.get(input.taskId);
const turnItemOrdinal =
existingSubagent?.turnItemOrdinal ??
(yield* resolveItemOrdinal(input.context, `${nativeItemId}:subagent`));
const task = {
...(existingSubagent?.task ?? {
id: nodeId,
threadId: input.context.input.threadId,
runId: input.context.input.runId,
parentNodeId: input.context.input.rootNodeId,
origin: "provider_native" as const,
createdBy: "agent" as const,
provider: CLAUDE_PROVIDER,
providerThreadId: null,
childThreadId: null,
nativeTaskRef: {
provider: CLAUDE_PROVIDER,
nativeId: input.taskId,
strength: "strong" as const,
},
prompt: input.prompt ?? "",
title: input.title ?? null,
model: input.context.input.modelSelection.model,
result: null,
startedAt: now,
}),
status: input.status,
...(input.prompt === undefined ? {} : { prompt: input.prompt }),
...(input.title === undefined ? {} : { title: input.title }),
...(input.result === undefined ? {} : { result: input.result }),
completedAt: input.status === "running" ? null : now,
updatedAt: now,
} satisfies OrchestrationV2Subagent;
const subagent = {
task,
turnItemId:
existingSubagent?.turnItemId ??
idAllocator.derive.turnItemFromProviderItem({
provider: CLAUDE_PROVIDER,
nativeItemId: `${nativeItemId}:subagent`,
}),
turnItemOrdinal,
} satisfies ActiveClaudeSubagent;
input.context.subagentsByTaskId.set(input.taskId, subagent);
yield* emitProviderEvent({
type: "node.updated",
@@ -1873,10 +1928,42 @@ export function makeClaudeAdapterV2(
},
runtimeRequestId: null,
checkpointScopeId: null,
startedAt: now,
startedAt: task.startedAt,
completedAt: input.status === "running" ? null : now,
},
});
yield* emitProviderEvent({
type: "subagent.updated",
provider: CLAUDE_PROVIDER,
subagent: task,
});
yield* emitProviderEvent({
type: "turn_item.updated",
provider: CLAUDE_PROVIDER,
turnItem: {
id: subagent.turnItemId,
threadId: task.threadId,
runId: task.runId,
nodeId: task.id,
providerThreadId: input.context.input.providerThread.id,
providerTurnId: input.context.providerTurnId,
nativeItemRef: task.nativeTaskRef,
parentItemId: null,
ordinal: subagent.turnItemOrdinal,
status: task.status,
title: task.title,
startedAt: task.startedAt,
completedAt: task.completedAt,
updatedAt: task.updatedAt,
type: "subagent",
subagentId: task.id,
origin: task.origin,
provider: task.provider,
childThreadId: task.childThreadId,
prompt: task.prompt,
result: task.result,
},
});
});
const ensureToolCallStarted = Effect.fnUntraced(function* (input: {
@@ -2175,6 +2262,8 @@ export function makeClaudeAdapterV2(
context,
taskId: message.task_id,
...(message.tool_use_id === undefined ? {} : { toolUseId: message.tool_use_id }),
...(message.prompt === undefined ? {} : { prompt: message.prompt }),
title: message.description,
status: "running",
});
}
@@ -2184,6 +2273,7 @@ export function makeClaudeAdapterV2(
context,
taskId: message.task_id,
...(message.tool_use_id === undefined ? {} : { toolUseId: message.tool_use_id }),
result: message.summary,
status:
message.status === "completed"
? "completed"
@@ -2488,6 +2578,7 @@ export function makeClaudeAdapterV2(
nativeItemId: `assistant:${turnInput.runId}`,
},
toolCalls: new Map(),
subagentsByTaskId: new Map(),
subagentNodesByTaskId: new Map(),
subagentNodesByToolUseId: new Map(),
};
@@ -9,6 +9,7 @@ import type {
OrchestrationV2ProviderTurn,
OrchestrationV2PlanStep,
OrchestrationV2RuntimeRequest,
OrchestrationV2Subagent,
OrchestrationV2TurnItem,
ProviderUserInputAnswers,
ProviderApprovalDecision,
@@ -578,6 +579,28 @@ interface ActiveCodexTurnContext {
readonly nativeTurnId: string;
readonly providerTurnId: ProviderTurnId;
readonly providerTurnOrdinal: number;
readonly providerNodeId: OrchestrationV2ExecutionNode["id"];
readonly providerNodeKind: OrchestrationV2ExecutionNode["kind"];
readonly providerNodeStartedAt: DateTime.Utc | null;
readonly itemParentNodeId: OrchestrationV2ExecutionNode["id"];
readonly rootNodeId: OrchestrationV2ExecutionNode["id"];
readonly startedAt: DateTime.Utc;
}
interface CodexSubagentThreadContext {
readonly parentContext: ActiveCodexTurnContext;
readonly providerThread: OrchestrationV2ProviderThread;
readonly subagentNodeId: OrchestrationV2ExecutionNode["id"];
readonly nativeToolCallId: string;
readonly ordinal: number;
readonly startedAt: DateTime.Utc;
readonly turnItemId: OrchestrationV2TurnItem["id"];
readonly turnItemOrdinal: number;
task: OrchestrationV2Subagent;
}
interface PendingCodexSubagentTurnStarted {
readonly nativeTurnId: string;
readonly startedAt: DateTime.Utc;
}
@@ -786,19 +809,223 @@ export const layer: Layer.Layer<
providerSessionId: input.providerSessionId,
runtimePolicy: input.runtimePolicy,
});
const initialized = yield* Ref.make(false);
const ensureInitialized = Effect.gen(function* () {
const alreadyInitialized = yield* Ref.get(initialized);
if (alreadyInitialized) {
yield* client.notify("initialized", undefined);
yield* Ref.set(initialized, true);
});
const now = yield* DateTime.now;
const session = providerSession({
providerSessionId: input.providerSessionId,
cwd: input.runtimePolicy.cwd,
model: input.modelSelection.model,
now,
});
const events = yield* Queue.unbounded<ProviderAdapterV2Event>();
const activeTurns = yield* Ref.make(new Map<string, ActiveCodexTurnContext>());
const turnWaiters = yield* Ref.make(new Map<string, Deferred.Deferred<void, never>>());
const subagentThreads = yield* Ref.make(new Map<string, CodexSubagentThreadContext>());
const pendingSubagentTurns = yield* Ref.make(
new Map<string, ReadonlyArray<PendingCodexSubagentTurnStarted>>(),
);
const itemOrdinals = yield* Ref.make(new Map<string, number>());
const nextItemOrdinalsByTurn = yield* Ref.make(new Map<string, number>());
const agentMessageDeltas = yield* Ref.make(new Map<string, string>());
const planDeltas = yield* Ref.make(new Map<string, string>());
const planIds = yield* Ref.make(new Map<string, OrchestrationV2PlanArtifact["id"]>());
const pendingRuntimeRequests = yield* Ref.make(
new Map<string, PendingCodexRuntimeRequest>(),
);
const emitProviderEvent = (event: ProviderAdapterV2Event) =>
Queue.offer(events, event).pipe(Effect.asVoid);
const findActiveTurnByNativeThreadId = (nativeThreadId: string) =>
Effect.gen(function* () {
const turns = Array.from((yield* Ref.get(activeTurns)).values());
return turns.find(
(context) => context.providerThread.nativeThreadRef?.nativeId === nativeThreadId,
);
});
const resolveItemOrdinal = (context: ActiveCodexTurnContext, nativeItemId: string) =>
Effect.gen(function* () {
const existing = (yield* Ref.get(itemOrdinals)).get(nativeItemId);
if (existing !== undefined) {
return existing;
}
const turnKey = context.nativeTurnId;
const nextWithinTurn = yield* Ref.modify(nextItemOrdinalsByTurn, (current) => {
const next = (current.get(turnKey) ?? 0) + 1;
const updated = new Map(current);
updated.set(turnKey, next);
return [next, updated];
});
const nextOrdinal = context.providerTurnOrdinal * 100 + nextWithinTurn;
yield* Ref.update(itemOrdinals, (current) => {
const updated = new Map(current);
updated.set(nativeItemId, nextOrdinal);
return updated;
});
return nextOrdinal;
});
const emitSubagentTaskUpdate = (input: {
readonly subagent: CodexSubagentThreadContext;
readonly status: OrchestrationV2Subagent["status"];
readonly result?: string | null;
readonly completedAt?: DateTime.Utc | null;
}) =>
Effect.gen(function* () {
const now = yield* DateTime.now;
const terminal =
input.status === "completed" ||
input.status === "failed" ||
input.status === "cancelled" ||
input.status === "interrupted";
const completedAt = terminal ? (input.completedAt ?? now) : null;
const task = {
...input.subagent.task,
status: input.status,
result: input.result === undefined ? input.subagent.task.result : input.result,
completedAt,
updatedAt: now,
} satisfies OrchestrationV2Subagent;
input.subagent.task = task;
yield* emitProviderEvent({
type: "subagent.updated",
provider: CODEX_PROVIDER,
subagent: task,
});
yield* emitProviderEvent({
type: "turn_item.updated",
provider: CODEX_PROVIDER,
turnItem: {
id: input.subagent.turnItemId,
threadId: task.threadId,
runId: task.runId,
nodeId: task.id,
providerThreadId: task.providerThreadId,
providerTurnId: input.subagent.parentContext.providerTurnId,
nativeItemRef: task.nativeTaskRef,
parentItemId: null,
ordinal: input.subagent.turnItemOrdinal,
status: task.status,
title: task.title,
startedAt: task.startedAt,
completedAt: task.completedAt,
updatedAt: task.updatedAt,
type: "subagent",
subagentId: task.id,
origin: task.origin,
provider: task.provider,
childThreadId: task.childThreadId,
prompt: task.prompt,
result: task.result,
},
});
});
const emitSubagentProviderTurnStarted = (
subagent: CodexSubagentThreadContext,
turn: PendingCodexSubagentTurnStarted,
) =>
Effect.gen(function* () {
const providerTurnId = idAllocator.derive.providerTurn({
provider: CODEX_PROVIDER,
nativeTurnId: turn.nativeTurnId,
});
const activeContext: ActiveCodexTurnContext = {
input: subagent.parentContext.input,
nativeTurnId: turn.nativeTurnId,
providerThread: subagent.providerThread,
providerTurnId,
providerTurnOrdinal:
subagent.parentContext.providerTurnOrdinal * 100 + subagent.ordinal,
providerNodeId: subagent.subagentNodeId,
providerNodeKind: "subagent",
providerNodeStartedAt: subagent.startedAt,
itemParentNodeId: subagent.subagentNodeId,
rootNodeId: subagent.parentContext.rootNodeId,
startedAt: turn.startedAt,
};
yield* Ref.update(activeTurns, (current) => {
const updated = new Map(current);
updated.set(turn.nativeTurnId, activeContext);
return updated;
});
const now = yield* DateTime.now;
yield* emitProviderEvent({
type: "provider_thread.updated",
provider: CODEX_PROVIDER,
providerThread: {
...subagent.providerThread,
status: "active",
updatedAt: now,
},
});
yield* emitProviderEvent({
type: "provider_turn.updated",
provider: CODEX_PROVIDER,
providerTurn: {
id: providerTurnId,
providerThreadId: subagent.providerThread.id,
nodeId: subagent.subagentNodeId,
runAttemptId: subagent.parentContext.input.attemptId,
nativeTurnRef: {
provider: CODEX_PROVIDER,
nativeId: turn.nativeTurnId,
strength: "strong",
},
ordinal: activeContext.providerTurnOrdinal,
status: "running",
startedAt: turn.startedAt,
completedAt: null,
},
});
});
const rememberSubagentTurnStarted = (input: {
readonly nativeThreadId: string;
readonly nativeTurnId: string;
readonly startedAt: DateTime.Utc;
}) =>
Effect.gen(function* () {
const subagent = (yield* Ref.get(subagentThreads)).get(input.nativeThreadId);
if (subagent !== undefined) {
yield* emitSubagentProviderTurnStarted(subagent, input);
return;
}
yield* Ref.update(pendingSubagentTurns, (current) => {
const updated = new Map(current);
updated.set(input.nativeThreadId, [
...(updated.get(input.nativeThreadId) ?? []),
{ nativeTurnId: input.nativeTurnId, startedAt: input.startedAt },
]);
return updated;
});
});
const registerSubagentThreads = (input: {
readonly context: ActiveCodexTurnContext;
readonly item: Extract<
CodexSchema.V2ItemCompletedNotification__ThreadItem,
{ type: "collabAgentToolCall" }
>;
}) =>
Effect.gen(function* () {
if (input.item.tool !== "spawnAgent" || input.item.receiverThreadIds.length === 0) {
return;
}
const now = yield* DateTime.now;
for (const [index, nativeThreadId] of input.item.receiverThreadIds.entries()) {
const nativeItemId = `${input.item.id}:${nativeThreadId}`;
const subagentNodeId = idAllocator.derive.nodeFromProviderItem({
provider: CODEX_PROVIDER,
nativeItemId: `${input.item.id}:${nativeThreadId}`,
nativeItemId,
});
const turnItemOrdinal = yield* resolveItemOrdinal(input.context, nativeItemId);
const providerThread = {
id: idAllocator.derive.providerThread({
provider: CODEX_PROVIDER,
@@ -806,7 +1033,7 @@ export const layer: Layer.Layer<
}),
provider: CODEX_PROVIDER,
providerSessionId: input.context.providerThread.providerSessionId,
appThreadId: input.context.input.threadId,
appThreadId: null,
ownerNodeId: subagentNodeId,
nativeThreadRef: {
provider: CODEX_PROVIDER,
@@ -825,6 +1052,29 @@ export const layer: Layer.Layer<
createdAt: now,
updatedAt: now,
} satisfies OrchestrationV2ProviderThread;
const task = {
id: subagentNodeId,
threadId: input.context.input.threadId,
runId: input.context.input.runId,
parentNodeId: input.context.rootNodeId,
origin: "provider_native",
createdBy: "agent",
provider: CODEX_PROVIDER,
providerThreadId: providerThread.id,
childThreadId: null,
nativeTaskRef: codexNativeItemRef(nativeItemId),
prompt: input.item.prompt ?? "",
title: null,
model:
typeof input.item.model === "string" && input.item.model.length > 0
? input.item.model
: null,
status: "running",
result: null,
startedAt: now,
completedAt: null,
updatedAt: now,
} satisfies OrchestrationV2Subagent;
const subagent = {
parentContext: input.context,
providerThread,
@@ -832,6 +1082,12 @@ export const layer: Layer.Layer<
nativeToolCallId: input.item.id,
ordinal: index + 1,
startedAt: now,
turnItemId: idAllocator.derive.turnItemFromProviderItem({
provider: CODEX_PROVIDER,
nativeItemId,
}),
turnItemOrdinal,
task,
} satisfies CodexSubagentThreadContext;
const emitProviderEvent = (event: ProviderAdapterV2Event) =>
@@ -866,8 +1122,36 @@ export const layer: Layer.Layer<
updated.set(nativeItemId, nextOrdinal);
return updated;
});
return nextOrdinal;
});
yield* emitProviderEvent({
type: "node.updated",
provider: CODEX_PROVIDER,
node: {
id: subagentNodeId,
threadId: input.context.input.threadId,
runId: input.context.input.runId,
parentNodeId: input.context.rootNodeId,
rootNodeId: input.context.rootNodeId,
kind: "subagent",
status: "running",
countsForRun: false,
providerThreadId: providerThread.id,
providerTurnId: input.context.providerTurnId,
nativeItemRef: codexNativeItemRef(input.item.id),
runtimeRequestId: null,
checkpointScopeId: null,
startedAt: now,
completedAt: null,
},
});
yield* emitProviderEvent({
type: "provider_thread.updated",
provider: CODEX_PROVIDER,
providerThread,
});
yield* emitSubagentTaskUpdate({
subagent,
status: "running",
});
const resolvePlanId = (context: ActiveCodexTurnContext, planKey: string) =>
Effect.gen(function* () {
@@ -888,26 +1172,46 @@ export const layer: Layer.Layer<
return planId;
});
const resolveCodexAttachment = (attachment: ChatAttachment) =>
Effect.gen(function* () {
const attachmentPath = resolveAttachmentPath({
attachmentsDir: serverConfig.attachmentsDir,
attachment,
});
if (attachmentPath === null) {
return yield* toProtocolError(`Invalid attachment id '${attachment.id}'`);
const updateSubagentStates = (input: {
readonly item: Extract<
CodexSchema.V2ItemCompletedNotification__ThreadItem,
{ type: "collabAgentToolCall" }
>;
}) =>
Effect.gen(function* () {
const subagents = yield* Ref.get(subagentThreads);
for (const [nativeThreadId, state] of Object.entries(input.item.agentsStates)) {
const subagent = subagents.get(nativeThreadId);
if (subagent === undefined) {
continue;
}
const bytes = yield* fileSystem
.readFile(attachmentPath)
.pipe(
Effect.mapError((cause) =>
toProtocolError(`Failed to read attachment '${attachment.id}'.`, cause),
),
);
return {
type: "image" as const,
url: `data:${attachment.mimeType};base64,${Buffer.from(bytes).toString("base64")}`,
} satisfies CodexSchema.V2TurnStartParams__UserInput;
const nativeStatus = String(state.status);
const status: OrchestrationV2Subagent["status"] =
nativeStatus === "completed"
? "completed"
: nativeStatus === "failed" || nativeStatus === "errored"
? "failed"
: nativeStatus === "cancelled" || nativeStatus === "closed"
? "cancelled"
: "running";
yield* emitSubagentTaskUpdate({
subagent,
status,
...(state.message === null ? {} : { result: state.message }),
});
}
});
const resolvePlanId = (context: ActiveCodexTurnContext, planKey: string) =>
Effect.gen(function* () {
const existing = (yield* Ref.get(planIds)).get(planKey);
if (existing !== undefined) {
return existing;
}
const planId = yield* idAllocator.allocate.plan({
threadId: context.input.threadId,
runId: context.input.runId,
provider: CODEX_PROVIDER,
});
const toCodexInput = (
@@ -2368,6 +2672,429 @@ export const layer: Layer.Layer<
...(explanation === undefined ? {} : { explanation }),
steps,
});
yield* updateSubagentStates({
item: payload.item,
});
return;
}
if (payload.item.type !== "agentMessage") {
return;
}
const deltas = yield* Ref.get(agentMessageDeltas);
const text =
payload.item.text.length > 0
? payload.item.text
: (deltas.get(payload.item.id) ?? "");
const artifacts = yield* buildAgentMessageArtifacts(context, {
...payload.item,
text,
});
yield* emitProviderEvent({
type: "node.updated",
provider: CODEX_PROVIDER,
node: artifacts.node,
});
yield* emitProviderEvent({
type: "message.updated",
provider: CODEX_PROVIDER,
message: artifacts.message,
});
yield* emitProviderEvent({
type: "turn_item.updated",
provider: CODEX_PROVIDER,
turnItem: artifacts.turnItem,
});
}).pipe(Effect.orDie),
);
yield* client.handleServerRequest("item/commandExecution/requestApproval", (payload) =>
Effect.gen(function* () {
const context = (yield* Ref.get(activeTurns)).get(payload.turnId);
if (context === undefined) {
return yield* toProtocolError(
`No active Codex turn context for approval turn ${payload.turnId}.`,
payload,
);
}
const nativeRequestId = payload.approvalId ?? payload.itemId;
const artifacts = yield* buildApprovalRequestArtifacts({
context,
nativeItemId: payload.itemId,
nativeRequestId,
requestKind: "command",
...((payload.reason ?? payload.command) === undefined
? {}
: { prompt: payload.reason ?? payload.command }),
});
const decision = yield* Deferred.make<ProviderApprovalDecision, never>();
yield* Ref.update(pendingRuntimeRequests, (current) => {
const updated = new Map(current);
updated.set(String(artifacts.request.id), {
type: "approval",
requestId: artifacts.request.id,
requestKind: "command",
decision,
});
return updated;
});
yield* emitProviderEvent({
type: "node.updated",
provider: CODEX_PROVIDER,
node: artifacts.node,
});
yield* emitProviderEvent({
type: "runtime_request.updated",
provider: CODEX_PROVIDER,
runtimeRequest: artifacts.request,
});
yield* emitProviderEvent({
type: "turn_item.updated",
provider: CODEX_PROVIDER,
turnItem: artifacts.turnItem,
});
const resolved = yield* Deferred.await(decision).pipe(
Effect.ensuring(
Ref.update(pendingRuntimeRequests, (current) => {
const updated = new Map(current);
updated.delete(String(artifacts.request.id));
return updated;
}),
),
);
return {
decision: resolved,
} satisfies CodexSchema.CommandExecutionRequestApprovalResponse;
}).pipe(Effect.orDie),
);
yield* client.handleServerRequest("item/fileChange/requestApproval", (payload) =>
Effect.gen(function* () {
const context = (yield* Ref.get(activeTurns)).get(payload.turnId);
if (context === undefined) {
return yield* toProtocolError(
`No active Codex turn context for file change approval turn ${payload.turnId}.`,
payload,
);
}
const artifacts = yield* buildApprovalRequestArtifacts({
context,
nativeItemId: payload.itemId,
nativeRequestId: payload.itemId,
requestKind: "file-change",
...(payload.reason === undefined ? {} : { prompt: payload.reason }),
});
const decision = yield* Deferred.make<ProviderApprovalDecision, never>();
yield* Ref.update(pendingRuntimeRequests, (current) => {
const updated = new Map(current);
updated.set(String(artifacts.request.id), {
type: "approval",
requestId: artifacts.request.id,
requestKind: "file-change",
decision,
});
return updated;
});
yield* emitProviderEvent({
type: "node.updated",
provider: CODEX_PROVIDER,
node: artifacts.node,
});
yield* emitProviderEvent({
type: "runtime_request.updated",
provider: CODEX_PROVIDER,
runtimeRequest: artifacts.request,
});
yield* emitProviderEvent({
type: "turn_item.updated",
provider: CODEX_PROVIDER,
turnItem: artifacts.turnItem,
});
const resolved = yield* Deferred.await(decision).pipe(
Effect.ensuring(
Ref.update(pendingRuntimeRequests, (current) => {
const updated = new Map(current);
updated.delete(String(artifacts.request.id));
return updated;
}),
),
);
return {
decision: resolved,
} satisfies CodexSchema.FileChangeRequestApprovalResponse;
}).pipe(Effect.orDie),
);
yield* client.handleServerRequest("item/permissions/requestApproval", (payload) =>
Effect.gen(function* () {
const context = (yield* Ref.get(activeTurns)).get(payload.turnId);
if (context === undefined) {
return yield* toProtocolError(
`No active Codex turn context for permissions approval turn ${payload.turnId}.`,
payload,
);
}
const requestKind = providerRequestKindFromPermissions(payload.permissions);
const artifacts = yield* buildApprovalRequestArtifacts({
context,
nativeItemId: payload.itemId,
nativeRequestId: payload.itemId,
requestKind,
...(payload.reason === undefined ? {} : { prompt: payload.reason }),
});
const decision = yield* Deferred.make<ProviderApprovalDecision, never>();
yield* Ref.update(pendingRuntimeRequests, (current) => {
const updated = new Map(current);
updated.set(String(artifacts.request.id), {
type: "approval",
requestId: artifacts.request.id,
requestKind,
decision,
});
return updated;
});
yield* emitProviderEvent({
type: "node.updated",
provider: CODEX_PROVIDER,
node: artifacts.node,
});
yield* emitProviderEvent({
type: "runtime_request.updated",
provider: CODEX_PROVIDER,
runtimeRequest: artifacts.request,
});
yield* emitProviderEvent({
type: "turn_item.updated",
provider: CODEX_PROVIDER,
turnItem: artifacts.turnItem,
});
const resolved = yield* Deferred.await(decision).pipe(
Effect.ensuring(
Ref.update(pendingRuntimeRequests, (current) => {
const updated = new Map(current);
updated.delete(String(artifacts.request.id));
return updated;
}),
),
);
return permissionsResponseFromDecision({
decision: resolved,
permissions: payload.permissions,
});
}).pipe(Effect.orDie),
);
yield* client.handleServerRequest("execCommandApproval", (payload) =>
Effect.gen(function* () {
const context = yield* findActiveTurnByNativeThreadId(payload.conversationId);
if (context === undefined) {
return yield* toProtocolError(
`No active Codex turn context for exec approval thread ${payload.conversationId}.`,
payload,
);
}
const nativeRequestId = payload.approvalId ?? payload.callId;
const artifacts = yield* buildApprovalRequestArtifacts({
context,
nativeItemId: payload.callId,
nativeRequestId,
requestKind: "command",
prompt: payload.reason ?? payload.command.join(" "),
});
const decision = yield* Deferred.make<ProviderApprovalDecision, never>();
yield* Ref.update(pendingRuntimeRequests, (current) => {
const updated = new Map(current);
updated.set(String(artifacts.request.id), {
type: "approval",
requestId: artifacts.request.id,
requestKind: "command",
decision,
});
return updated;
});
yield* emitProviderEvent({
type: "node.updated",
provider: CODEX_PROVIDER,
node: artifacts.node,
});
yield* emitProviderEvent({
type: "runtime_request.updated",
provider: CODEX_PROVIDER,
runtimeRequest: artifacts.request,
});
yield* emitProviderEvent({
type: "turn_item.updated",
provider: CODEX_PROVIDER,
turnItem: artifacts.turnItem,
});
const resolved = yield* Deferred.await(decision).pipe(
Effect.ensuring(
Ref.update(pendingRuntimeRequests, (current) => {
const updated = new Map(current);
updated.delete(String(artifacts.request.id));
return updated;
}),
),
);
return {
decision: approvalDecisionToLegacyReviewDecision(resolved),
} satisfies CodexSchema.ExecCommandApprovalResponse;
}).pipe(Effect.orDie),
);
yield* client.handleServerRequest("applyPatchApproval", (payload) =>
Effect.gen(function* () {
const context = yield* findActiveTurnByNativeThreadId(payload.conversationId);
if (context === undefined) {
return yield* toProtocolError(
`No active Codex turn context for apply patch approval thread ${payload.conversationId}.`,
payload,
);
}
const artifacts = yield* buildApprovalRequestArtifacts({
context,
nativeItemId: payload.callId,
nativeRequestId: payload.callId,
requestKind: "file-change",
prompt: payload.reason ?? Object.keys(payload.fileChanges).join(", "),
});
const decision = yield* Deferred.make<ProviderApprovalDecision, never>();
yield* Ref.update(pendingRuntimeRequests, (current) => {
const updated = new Map(current);
updated.set(String(artifacts.request.id), {
type: "approval",
requestId: artifacts.request.id,
requestKind: "file-change",
decision,
});
return updated;
});
yield* emitProviderEvent({
type: "node.updated",
provider: CODEX_PROVIDER,
node: artifacts.node,
});
yield* emitProviderEvent({
type: "runtime_request.updated",
provider: CODEX_PROVIDER,
runtimeRequest: artifacts.request,
});
yield* emitProviderEvent({
type: "turn_item.updated",
provider: CODEX_PROVIDER,
turnItem: artifacts.turnItem,
});
const resolved = yield* Deferred.await(decision).pipe(
Effect.ensuring(
Ref.update(pendingRuntimeRequests, (current) => {
const updated = new Map(current);
updated.delete(String(artifacts.request.id));
return updated;
}),
),
);
return {
decision: approvalDecisionToLegacyReviewDecision(resolved),
} satisfies CodexSchema.ApplyPatchApprovalResponse;
}).pipe(Effect.orDie),
);
yield* client.handleServerRequest("item/tool/requestUserInput", (payload) =>
Effect.gen(function* () {
const context = (yield* Ref.get(activeTurns)).get(payload.turnId);
if (context === undefined) {
return yield* toProtocolError(
`No active Codex turn context for user input request turn ${payload.turnId}.`,
payload,
);
}
const artifacts = yield* buildUserInputRequestArtifacts({
context,
nativeItemId: payload.itemId,
nativeRequestId: payload.itemId,
questions: payload.questions,
});
const answers = yield* Deferred.make<ProviderUserInputAnswers, never>();
yield* Ref.update(pendingRuntimeRequests, (current) => {
const updated = new Map(current);
updated.set(String(artifacts.request.id), {
type: "user_input",
requestId: artifacts.request.id,
answers,
});
return updated;
});
yield* emitProviderEvent({
type: "node.updated",
provider: CODEX_PROVIDER,
node: artifacts.node,
});
yield* emitProviderEvent({
type: "runtime_request.updated",
provider: CODEX_PROVIDER,
runtimeRequest: artifacts.request,
});
yield* emitProviderEvent({
type: "turn_item.updated",
provider: CODEX_PROVIDER,
turnItem: artifacts.turnItem,
});
const resolved = yield* Deferred.await(answers).pipe(
Effect.ensuring(
Ref.update(pendingRuntimeRequests, (current) => {
const updated = new Map(current);
updated.delete(String(artifacts.request.id));
return updated;
}),
),
);
return {
answers: toCodexUserInputAnswers(resolved),
} satisfies CodexSchema.ToolRequestUserInputResponse;
}).pipe(Effect.orDie),
);
yield* client.handleServerNotification("turn/completed", (payload) =>
Effect.gen(function* () {
const context = (yield* Ref.get(activeTurns)).get(payload.turn.id);
if (context === undefined) {
return;
}
const completedAt = codexTimestamp(payload.turn.completedAt);
const status = mapCodexTurnStatus(payload.turn.status);
yield* emitProviderEvent({
type: "provider_turn.updated",
provider: CODEX_PROVIDER,
providerTurn: {
id: context.providerTurnId,
providerThreadId: context.providerThread.id,
nodeId: context.providerNodeId,
runAttemptId: context.input.attemptId,
nativeTurnRef: {
provider: CODEX_PROVIDER,
nativeId: payload.turn.id,
strength: "strong",
},
ordinal: context.providerTurnOrdinal,
status,
startedAt: context.startedAt,
completedAt,
},
});
if (context.providerNodeKind === "subagent") {
yield* emitProviderEvent({
type: "node.updated",
provider: CODEX_PROVIDER,
@@ -2378,13 +3105,37 @@ export const layer: Layer.Layer<
provider: CODEX_PROVIDER,
plan: artifacts.plan,
});
const nativeThreadId = context.providerThread.nativeThreadRef?.nativeId;
if (nativeThreadId !== null && nativeThreadId !== undefined) {
const subagent = (yield* Ref.get(subagentThreads)).get(nativeThreadId);
if (subagent !== undefined) {
yield* emitSubagentTaskUpdate({
subagent,
status,
completedAt,
});
}
}
}
if (context.providerNodeKind === "root_turn") {
yield* emitProviderEvent({
type: "turn_item.updated",
type: "turn.terminal",
provider: CODEX_PROVIDER,
turnItem: artifacts.turnItem,
providerTurnId: context.providerTurnId,
status: providerTurnStatusToTerminal(status),
});
}).pipe(Effect.orDie),
);
}
const waiter = (yield* Ref.get(turnWaiters)).get(payload.turn.id);
if (waiter !== undefined) {
yield* Deferred.succeed(waiter, undefined);
}
yield* Ref.update(activeTurns, (current) => {
const updated = new Map(current);
updated.delete(payload.turn.id);
return updated;
});
}),
);
const runtime: ProviderAdapterV2SessionRuntime = {
instanceId: CODEX_DEFAULT_INSTANCE_ID,
@@ -23,6 +23,7 @@ import {
OrchestrationV2RunAttemptJson as OrchestrationV2RunAttemptJsonSchema,
OrchestrationV2RunJson as OrchestrationV2RunJsonSchema,
OrchestrationV2RuntimeRequestJson as OrchestrationV2RuntimeRequestJsonSchema,
OrchestrationV2SubagentJson as OrchestrationV2SubagentJsonSchema,
OrchestrationV2TurnItemJson as OrchestrationV2TurnItemJsonSchema,
RunId,
ThreadId,
@@ -126,6 +127,7 @@ export function emptyProjection(
runs: [],
attempts: [],
nodes: [],
subagents: [],
providerSessions: [],
providerThreads: [],
providerTurns: [],
@@ -174,6 +176,11 @@ export function applyToProjection(
...base,
nodes: upsertById(base.nodes, event.payload),
};
case "subagent.updated":
return {
...base,
subagents: upsertById(base.subagents, event.payload),
};
case "provider-session.updated":
return {
...base,
@@ -267,6 +274,9 @@ const encodeRunAttemptPayload = Schema.encodeEffect(
const encodeNodePayload = Schema.encodeEffect(
Schema.fromJsonString(OrchestrationV2ExecutionNodeJsonSchema),
);
const encodeSubagentPayload = Schema.encodeEffect(
Schema.fromJsonString(OrchestrationV2SubagentJsonSchema),
);
const encodeProviderSessionPayload = Schema.encodeEffect(
Schema.fromJsonString(OrchestrationV2ProviderSessionJsonSchema),
);
@@ -309,6 +319,8 @@ const decodeRunAttemptPayload = (json: string) =>
Schema.decodeUnknownEffect(Schema.fromJsonString(OrchestrationV2RunAttemptJsonSchema))(json);
const decodeNodePayload = (json: string) =>
Schema.decodeUnknownEffect(Schema.fromJsonString(OrchestrationV2ExecutionNodeJsonSchema))(json);
const decodeSubagentPayload = (json: string) =>
Schema.decodeUnknownEffect(Schema.fromJsonString(OrchestrationV2SubagentJsonSchema))(json);
const decodeProviderSessionPayload = (json: string) =>
Schema.decodeUnknownEffect(Schema.fromJsonString(OrchestrationV2ProviderSessionJsonSchema))(json);
const decodeProviderThreadPayload = (json: string) =>
@@ -891,6 +903,57 @@ export const layer: Layer.Layer<ProjectionStoreV2, never, SqlClient.SqlClient> =
`;
break;
}
case "subagent.updated": {
const payloadJson = yield* encodeSubagentPayload(event.payload);
const payload = parseEncodedPayload(payloadJson);
yield* sql`
INSERT INTO orchestration_v2_projection_subagents (
subagent_id,
thread_id,
run_id,
parent_node_id,
provider,
provider_thread_id,
child_thread_id,
origin,
status,
started_at,
completed_at,
updated_at,
payload_json
)
VALUES (
${event.payload.id},
${event.payload.threadId},
${event.payload.runId},
${event.payload.parentNodeId},
${event.payload.provider},
${event.payload.providerThreadId},
${event.payload.childThreadId},
${event.payload.origin},
${event.payload.status},
${nullableStringField(payload, "startedAt")},
${nullableStringField(payload, "completedAt")},
${stringField(payload, "updatedAt")},
${payloadJson}
)
ON CONFLICT(subagent_id)
DO UPDATE SET
thread_id = excluded.thread_id,
run_id = excluded.run_id,
parent_node_id = excluded.parent_node_id,
provider = excluded.provider,
provider_thread_id = excluded.provider_thread_id,
child_thread_id = excluded.child_thread_id,
origin = excluded.origin,
status = excluded.status,
started_at = excluded.started_at,
completed_at = excluded.completed_at,
updated_at = excluded.updated_at,
payload_json = excluded.payload_json
`;
break;
}
case "provider-session.updated": {
const payloadJson = yield* encodeProviderSessionPayload(event.payload);
const payload = parseEncodedPayload(payloadJson);
@@ -1390,6 +1453,7 @@ export const layer: Layer.Layer<ProjectionStoreV2, never, SqlClient.SqlClient> =
runRows,
attemptRows,
nodeRows,
subagentRows,
providerSessionRows,
providerThreadRows,
providerTurnRows,
@@ -1421,6 +1485,12 @@ export const layer: Layer.Layer<ProjectionStoreV2, never, SqlClient.SqlClient> =
WHERE thread_id = ${threadId}
ORDER BY COALESCE(started_at, ''), node_id ASC
`,
sql<PayloadRow>`
SELECT payload_json
FROM orchestration_v2_projection_subagents
WHERE thread_id = ${threadId}
ORDER BY COALESCE(started_at, ''), subagent_id ASC
`,
sql<PayloadRow>`
SELECT payload_json
FROM orchestration_v2_projection_provider_sessions
@@ -1431,6 +1501,11 @@ export const layer: Layer.Layer<ProjectionStoreV2, never, SqlClient.SqlClient> =
SELECT payload_json
FROM orchestration_v2_projection_provider_threads
WHERE thread_id = ${threadId}
OR owner_node_id IN (
SELECT node_id
FROM orchestration_v2_projection_nodes
WHERE thread_id = ${threadId}
)
ORDER BY COALESCE(first_run_ordinal, 0), provider_thread_id ASC
`,
sql<PayloadRow>`
@@ -1493,6 +1568,7 @@ export const layer: Layer.Layer<ProjectionStoreV2, never, SqlClient.SqlClient> =
runs,
attempts,
nodes,
subagents,
providerSessions,
providerThreads,
providerTurns,
@@ -1508,6 +1584,7 @@ export const layer: Layer.Layer<ProjectionStoreV2, never, SqlClient.SqlClient> =
decodeRows(decodeRunPayload, threadId)(runRows),
decodeRows(decodeRunAttemptPayload, threadId)(attemptRows),
decodeRows(decodeNodePayload, threadId)(nodeRows),
decodeRows(decodeSubagentPayload, threadId)(subagentRows),
decodeRows(decodeProviderSessionPayload, threadId)(providerSessionRows),
decodeRows(decodeProviderThreadPayload, threadId)(providerThreadRows),
decodeRows(decodeProviderTurnPayload, threadId)(providerTurnRows),
@@ -1526,6 +1603,7 @@ export const layer: Layer.Layer<ProjectionStoreV2, never, SqlClient.SqlClient> =
runs,
attempts,
nodes,
subagents,
providerSessions,
providerThreads,
providerTurns,
@@ -13,6 +13,7 @@ import {
OrchestrationV2ProviderTurn,
OrchestrationV2RawProviderEvent,
OrchestrationV2RuntimeRequest,
OrchestrationV2Subagent,
OrchestrationV2TurnItem,
ProviderApprovalDecision,
ProviderInteractionMode,
@@ -81,6 +82,11 @@ export const ProviderAdapterV2Event = Schema.Union([
provider: ProviderKind,
node: OrchestrationV2ExecutionNode,
}),
Schema.Struct({
type: Schema.Literal("subagent.updated"),
provider: ProviderKind,
subagent: OrchestrationV2Subagent,
}),
Schema.Struct({
type: Schema.Literal("message.updated"),
provider: ProviderKind,
@@ -160,6 +160,15 @@ export const layer: Layer.Layer<ProviderEventIngestorV2, never, EventSinkV2 | Id
nodeId: input.event.node.id,
}),
];
case "subagent.updated":
return [
yield* makeDomainEvent(input, {
type: "subagent.updated",
payload: input.event.subagent,
runId: input.event.subagent.runId,
nodeId: input.event.subagent.id,
}),
];
case "message.updated":
return [
yield* makeDomainEvent(input, {
@@ -300,7 +300,9 @@ export const layer: Layer.Layer<
event,
});
if (event.type === "provider_thread.updated") {
yield* Ref.set(latestProviderThread, event.providerThread);
if (event.providerThread.id === input.providerThread.id) {
yield* Ref.set(latestProviderThread, event.providerThread);
}
}
if (event.type === "turn.terminal") {
yield* Ref.set(terminalStatus, event.status);
@@ -4,7 +4,7 @@
{"type":"expect_outbound","label":"initialized","frame":{"method":"initialized"}}
{"type":"expect_outbound","label":"thread/start","frame":{"id":2,"method":"thread/start","params":{}}}
{"type":"emit_inbound","label":"thread/start","frame":{"id":2,"result":{"thread":{"id":"019db22a-e824-7ac3-bbf7-994a4aa087e5","forkedFromId":null,"preview":"","ephemeral":false,"modelProvider":"openai","createdAt":1776810649,"updatedAt":1776810649,"status":{"type":"idle"},"path":"/Users/julius/.codex/sessions/2026/04/21/rollout-2026-04-21T15-30-49-019db22a-e824-7ac3-bbf7-994a4aa087e5.jsonl","cwd":"/Users/julius/.t3/worktrees/codething-mvp/t3code-c1e5e1d1/packages/effect-codex-app-server","cliVersion":"0.120.0","source":"vscode","agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"turns":[]},"model":"gpt-5.3-codex","modelProvider":"openai","serviceTier":"fast","cwd":"/Users/julius/.t3/worktrees/codething-mvp/t3code-c1e5e1d1/packages/effect-codex-app-server","approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":["/Users/julius/.codex/memories"],"readOnlyAccess":{"type":"fullAccess"},"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"reasoningEffort":"xhigh"}}}
{"type":"expect_outbound","label":"turn/start","frame":{"id":3,"method":"turn/start","params":{"approvalPolicy":"never","input":[{"text":"Use request_user_input to ask one multiple-choice clarifying question about whether this fixture should prefer strict schemas or UI flexibility. After receiving the answer, respond exactly: plan questions fixture complete","type":"text"}],"sandboxPolicy":{"access":{"type":"fullAccess"},"networkAccess":false,"type":"readOnly"},"threadId":"019db22a-e824-7ac3-bbf7-994a4aa087e5","collaborationMode":{"mode":"plan","settings":{"developer_instructions":"<collaboration_mode># Plan Mode (Conversational)\n\nYou work in 3 phases, and you should *chat your way* to a great plan before finalizing it. A great plan is very detailed-intent- and implementation-wise-so that it can be handed to another engineer or agent to be implemented right away. It must be **decision complete**, where the implementer does not need to make any decisions.\n\n## Mode rules (strict)\n\nYou are in **Plan Mode** until a developer message explicitly ends it.\n\nPlan Mode is not changed by user intent, tone, or imperative language. If a user asks for execution while still in Plan Mode, treat it as a request to **plan the execution**, not perform it.\n\n## Plan Mode vs update_plan tool\n\nPlan Mode is a collaboration mode that can involve requesting user input and eventually issuing a `<proposed_plan>` block.\n\nSeparately, `update_plan` is a checklist/progress/TODOs tool; it does not enter or exit Plan Mode. Do not confuse it with Plan mode or try to use it while in Plan mode. If you try to use `update_plan` in Plan mode, it will return an error.\n\n## Execution vs. mutation in Plan Mode\n\nYou may explore and execute **non-mutating** actions that improve the plan. You must not perform **mutating** actions.\n\n### Allowed (non-mutating, plan-improving)\n\nActions that gather truth, reduce ambiguity, or validate feasibility without changing repo-tracked state. Examples:\n\n* Reading or searching files, configs, schemas, types, manifests, and docs\n* Static analysis, inspection, and repo exploration\n* Dry-run style commands when they do not edit repo-tracked files\n* Tests, builds, or checks that may write to caches or build artifacts (for example, `target/`, `.cache/`, or snapshots) so long as they do not edit repo-tracked files\n\n### Not allowed (mutating, plan-executing)\n\nActions that implement the plan or change repo-tracked state. Examples:\n\n* Editing or writing files\n* Running formatters or linters that rewrite files\n* Applying patches, migrations, or codegen that updates repo-tracked files\n* Side-effectful commands whose purpose is to carry out the plan rather than refine it\n\nWhen in doubt: if the action would reasonably be described as \"doing the work\" rather than \"planning the work,\" do not do it.\n\n## PHASE 1 - Ground in the environment (explore first, ask second)\n\nBegin by grounding yourself in the actual environment. Eliminate unknowns in the prompt by discovering facts, not by asking the user. Resolve all questions that can be answered through exploration or inspection. Identify missing or ambiguous details only if they cannot be derived from the environment. Silent exploration between turns is allowed and encouraged.\n\nBefore asking the user any question, perform at least one targeted non-mutating exploration pass (for example: search relevant files, inspect likely entrypoints/configs, confirm current implementation shape), unless no local environment/repo is available.\n\nException: you may ask clarifying questions about the user's prompt before exploring, ONLY if there are obvious ambiguities or contradictions in the prompt itself. However, if ambiguity might be resolved by exploring, always prefer exploring first.\n\nDo not ask questions that can be answered from the repo or system (for example, \"where is this struct?\" or \"which UI component should we use?\" when exploration can make it clear). Only ask once you have exhausted reasonable non-mutating exploration.\n\n## PHASE 2 - Intent chat (what they actually want)\n\n* Keep asking until you can clearly state: goal + success criteria, audience, in/out of scope, constraints, current state, and the key preferences/tradeoffs.\n* Bias toward questions over guessing: if any high-impact ambiguity remains, do NOT plan yet-ask.\n\n## PHASE 3 - Implementation chat (what/how we'll build)\n\n* Once intent is stable, keep asking until the spec is decision complete: approach, interfaces (APIs/schemas/I/O), data flow, edge cases/failure modes, testing + acceptance criteria, rollout/monitoring, and any migrations/compat constraints.\n\n## Asking questions\n\nCritical rules:\n\n* Strongly prefer using the `request_user_input` tool to ask any questions.\n* Offer only meaningful multiple-choice options; don't include filler choices that are obviously wrong or irrelevant.\n* In rare cases where an unavoidable, important question can't be exprLine truncated
{"type":"expect_outbound","label":"turn/start","frame":{"id":3,"method":"turn/start","params":{"approvalPolicy":"never","input":[{"text":"Use request_user_input to ask one multiple-choice clarifying question about whether this fixture should prefer strict schemas or UI flexibility. After receiving the answer, respond exactly: plan questions fixture complete","type":"text"}],"sandboxPolicy":{"networkAccess":false,"type":"readOnly"},"threadId":"019db22a-e824-7ac3-bbf7-994a4aa087e5","collaborationMode":{"mode":"plan","settings":{"developer_instructions":"<collaboration_mode># Plan Mode (Conversational)\n\nYou work in 3 phases, and you should *chat your way* to a great plan before finalizing it. A great plan is very detailed-intent- and implementation-wise-so that it can be handed to another engineer or agent to be implemented right away. It must be **decision complete**, where the implementer does not need to make any decisions.\n\n## Mode rules (strict)\n\nYou are in **Plan Mode** until a developer message explicitly ends it.\n\nPlan Mode is not changed by user intent, tone, or imperative language. If a user asks for execution while still in Plan Mode, treat it as a request to **plan the execution**, not perform it.\n\n## Plan Mode vs update_plan tool\n\nPlan Mode is a collaboration mode that can involve requesting user input and eventually issuing a `<proposed_plan>` block.\n\nSeparately, `update_plan` is a checklist/progress/TODOs tool; it does not enter or exit Plan Mode. Do not confuse it with Plan mode or try to use it while in Plan mode. If you try to use `update_plan` in Plan mode, it will return an error.\n\n## Execution vs. mutation in Plan Mode\n\nYou may explore and execute **non-mutating** actions that improve the plan. You must not perform **mutating** actions.\n\n### Allowed (non-mutating, plan-improving)\n\nActions that gather truth, reduce ambiguity, or validate feasibility without changing repo-tracked state. Examples:\n\n* Reading or searching files, configs, schemas, types, manifests, and docs\n* Static analysis, inspection, and repo exploration\n* Dry-run style commands when they do not edit repo-tracked files\n* Tests, builds, or checks that may write to caches or build artifacts (for example, `target/`, `.cache/`, or snapshots) so long as they do not edit repo-tracked files\n\n### Not allowed (mutating, plan-executing)\n\nActions that implement the plan or change repo-tracked state. Examples:\n\n* Editing or writing files\n* Running formatters or linters that rewrite files\n* Applying patches, migrations, or codegen that updates repo-tracked files\n* Side-effectful commands whose purpose is to carry out the plan rather than refine it\n\nWhen in doubt: if the action would reasonably be described as \"doing the work\" rather than \"planning the work,\" do not do it.\n\n## PHASE 1 - Ground in the environment (explore first, ask second)\n\nBegin by grounding yourself in the actual environment. Eliminate unknowns in the prompt by discovering facts, not by asking the user. Resolve all questions that can be answered through exploration or inspection. Identify missing or ambiguous details only if they cannot be derived from the environment. Silent exploration between turns is allowed and encouraged.\n\nBefore asking the user any question, perform at least one targeted non-mutating exploration pass (for example: search relevant files, inspect likely entrypoints/configs, confirm current implementation shape), unless no local environment/repo is available.\n\nException: you may ask clarifying questions about the user's prompt before exploring, ONLY if there are obvious ambiguities or contradictions in the prompt itself. However, if ambiguity might be resolved by exploring, always prefer exploring first.\n\nDo not ask questions that can be answered from the repo or system (for example, \"where is this struct?\" or \"which UI component should we use?\" when exploration can make it clear). Only ask once you have exhausted reasonable non-mutating exploration.\n\n## PHASE 2 - Intent chat (what they actually want)\n\n* Keep asking until you can clearly state: goal + success criteria, audience, in/out of scope, constraints, current state, and the key preferences/tradeoffs.\n* Bias toward questions over guessing: if any high-impact ambiguity remains, do NOT plan yet-ask.\n\n## PHASE 3 - Implementation chat (what/how we'll build)\n\n* Once intent is stable, keep asking until the spec is decision complete: approach, interfaces (APIs/schemas/I/O), data flow, edge cases/failure modes, testing + acceptance criteria, rollout/monitoring, and any migrations/compat constraints.\n\n## Asking questions\n\nCritical rules:\n\n* Strongly prefer using the `request_user_input` tool to ask any questions.\n* Offer only meaningful multiple-choice options; don't include filler choices that are obviously wrong or irrelevant.\n* In rare cases where an unavoidable, important question can't be expressed with reasonable multiple-Line truncated
{"type":"emit_inbound","label":"thread/started","frame":{"method":"thread/started","params":{"thread":{"id":"019db22a-e824-7ac3-bbf7-994a4aa087e5","forkedFromId":null,"preview":"","ephemeral":false,"modelProvider":"openai","createdAt":1776810649,"updatedAt":1776810649,"status":{"type":"idle"},"path":"/Users/julius/.codex/sessions/2026/04/21/rollout-2026-04-21T15-30-49-019db22a-e824-7ac3-bbf7-994a4aa087e5.jsonl","cwd":"/Users/julius/.t3/worktrees/codething-mvp/t3code-c1e5e1d1/packages/effect-codex-app-server","cliVersion":"0.120.0","source":"vscode","agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"turns":[]}}}}
{"type":"emit_inbound","label":"deprecationNotice","frame":{"method":"deprecationNotice","params":{"summary":"`[features].collab` is deprecated. Use `[features].multi_agent` instead.","details":"Enable it with `--enable multi_agent` or `[features].multi_agent` in config.toml. See https://developers.openai.com/codex/config-basic#feature-flags for details."}}}
{"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"name":"codex_apps","status":"starting","error":null}}}
@@ -4,7 +4,7 @@
{"type":"expect_outbound","label":"initialized","frame":{"method":"initialized"}}
{"type":"expect_outbound","label":"thread/start","frame":{"id":2,"method":"thread/start","params":{}}}
{"type":"emit_inbound","label":"thread/start","frame":{"id":2,"result":{"thread":{"id":"019db22b-08cd-7e12-b967-cf6ab32dd408","forkedFromId":null,"preview":"","ephemeral":false,"modelProvider":"openai","createdAt":1776810658,"updatedAt":1776810658,"status":{"type":"idle"},"path":"/Users/julius/.codex/sessions/2026/04/21/rollout-2026-04-21T15-30-58-019db22b-08cd-7e12-b967-cf6ab32dd408.jsonl","cwd":"/Users/julius/.t3/worktrees/codething-mvp/t3code-c1e5e1d1/packages/effect-codex-app-server","cliVersion":"0.120.0","source":"vscode","agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"turns":[]},"model":"gpt-5.3-codex","modelProvider":"openai","serviceTier":"fast","cwd":"/Users/julius/.t3/worktrees/codething-mvp/t3code-c1e5e1d1/packages/effect-codex-app-server","approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":["/Users/julius/.codex/memories"],"readOnlyAccess":{"type":"fullAccess"},"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"reasoningEffort":"xhigh"}}}
{"type":"expect_outbound","label":"turn/start","frame":{"id":3,"method":"turn/start","params":{"approvalPolicy":"never","input":[{"text":"Create a short implementation plan for adding deterministic replay fixtures. Do not ask questions. Present the final plan in a proposed plan block.","type":"text"}],"sandboxPolicy":{"access":{"type":"fullAccess"},"networkAccess":false,"type":"readOnly"},"threadId":"019db22b-08cd-7e12-b967-cf6ab32dd408","collaborationMode":{"mode":"plan","settings":{"developer_instructions":"<collaboration_mode># Plan Mode (Conversational)\n\nYou work in 3 phases, and you should *chat your way* to a great plan before finalizing it. A great plan is very detailed-intent- and implementation-wise-so that it can be handed to another engineer or agent to be implemented right away. It must be **decision complete**, where the implementer does not need to make any decisions.\n\n## Mode rules (strict)\n\nYou are in **Plan Mode** until a developer message explicitly ends it.\n\nPlan Mode is not changed by user intent, tone, or imperative language. If a user asks for execution while still in Plan Mode, treat it as a request to **plan the execution**, not perform it.\n\n## Plan Mode vs update_plan tool\n\nPlan Mode is a collaboration mode that can involve requesting user input and eventually issuing a `<proposed_plan>` block.\n\nSeparately, `update_plan` is a checklist/progress/TODOs tool; it does not enter or exit Plan Mode. Do not confuse it with Plan mode or try to use it while in Plan mode. If you try to use `update_plan` in Plan mode, it will return an error.\n\n## Execution vs. mutation in Plan Mode\n\nYou may explore and execute **non-mutating** actions that improve the plan. You must not perform **mutating** actions.\n\n### Allowed (non-mutating, plan-improving)\n\nActions that gather truth, reduce ambiguity, or validate feasibility without changing repo-tracked state. Examples:\n\n* Reading or searching files, configs, schemas, types, manifests, and docs\n* Static analysis, inspection, and repo exploration\n* Dry-run style commands when they do not edit repo-tracked files\n* Tests, builds, or checks that may write to caches or build artifacts (for example, `target/`, `.cache/`, or snapshots) so long as they do not edit repo-tracked files\n\n### Not allowed (mutating, plan-executing)\n\nActions that implement the plan or change repo-tracked state. Examples:\n\n* Editing or writing files\n* Running formatters or linters that rewrite files\n* Applying patches, migrations, or codegen that updates repo-tracked files\n* Side-effectful commands whose purpose is to carry out the plan rather than refine it\n\nWhen in doubt: if the action would reasonably be described as \"doing the work\" rather than \"planning the work,\" do not do it.\n\n## PHASE 1 - Ground in the environment (explore first, ask second)\n\nBegin by grounding yourself in the actual environment. Eliminate unknowns in the prompt by discovering facts, not by asking the user. Resolve all questions that can be answered through exploration or inspection. Identify missing or ambiguous details only if they cannot be derived from the environment. Silent exploration between turns is allowed and encouraged.\n\nBefore asking the user any question, perform at least one targeted non-mutating exploration pass (for example: search relevant files, inspect likely entrypoints/configs, confirm current implementation shape), unless no local environment/repo is available.\n\nException: you may ask clarifying questions about the user's prompt before exploring, ONLY if there are obvious ambiguities or contradictions in the prompt itself. However, if ambiguity might be resolved by exploring, always prefer exploring first.\n\nDo not ask questions that can be answered from the repo or system (for example, \"where is this struct?\" or \"which UI component should we use?\" when exploration can make it clear). Only ask once you have exhausted reasonable non-mutating exploration.\n\n## PHASE 2 - Intent chat (what they actually want)\n\n* Keep asking until you can clearly state: goal + success criteria, audience, in/out of scope, constraints, current state, and the key preferences/tradeoffs.\n* Bias toward questions over guessing: if any high-impact ambiguity remains, do NOT plan yet-ask.\n\n## PHASE 3 - Implementation chat (what/how we'll build)\n\n* Once intent is stable, keep asking until the spec is decision complete: approach, interfaces (APIs/schemas/I/O), data flow, edge cases/failure modes, testing + acceptance criteria, rollout/monitoring, and any migrations/compat constraints.\n\n## Asking questions\n\nCritical rules:\n\n* Strongly prefer using the `request_user_input` tool to ask any questions.\n* Offer only meaningful multiple-choice options; don't include filler choices that are obviously wrong or irrelevant.\n* In rare cases where an unavoidable, important question can't be expressed with reasonable multiple-choice options (due to extreme ambiguity), Line truncated
{"type":"expect_outbound","label":"turn/start","frame":{"id":3,"method":"turn/start","params":{"approvalPolicy":"never","input":[{"text":"Create a short implementation plan for adding deterministic replay fixtures. Do not ask questions. Present the final plan in a proposed plan block.","type":"text"}],"sandboxPolicy":{"networkAccess":false,"type":"readOnly"},"threadId":"019db22b-08cd-7e12-b967-cf6ab32dd408","collaborationMode":{"mode":"plan","settings":{"developer_instructions":"<collaboration_mode># Plan Mode (Conversational)\n\nYou work in 3 phases, and you should *chat your way* to a great plan before finalizing it. A great plan is very detailed-intent- and implementation-wise-so that it can be handed to another engineer or agent to be implemented right away. It must be **decision complete**, where the implementer does not need to make any decisions.\n\n## Mode rules (strict)\n\nYou are in **Plan Mode** until a developer message explicitly ends it.\n\nPlan Mode is not changed by user intent, tone, or imperative language. If a user asks for execution while still in Plan Mode, treat it as a request to **plan the execution**, not perform it.\n\n## Plan Mode vs update_plan tool\n\nPlan Mode is a collaboration mode that can involve requesting user input and eventually issuing a `<proposed_plan>` block.\n\nSeparately, `update_plan` is a checklist/progress/TODOs tool; it does not enter or exit Plan Mode. Do not confuse it with Plan mode or try to use it while in Plan mode. If you try to use `update_plan` in Plan mode, it will return an error.\n\n## Execution vs. mutation in Plan Mode\n\nYou may explore and execute **non-mutating** actions that improve the plan. You must not perform **mutating** actions.\n\n### Allowed (non-mutating, plan-improving)\n\nActions that gather truth, reduce ambiguity, or validate feasibility without changing repo-tracked state. Examples:\n\n* Reading or searching files, configs, schemas, types, manifests, and docs\n* Static analysis, inspection, and repo exploration\n* Dry-run style commands when they do not edit repo-tracked files\n* Tests, builds, or checks that may write to caches or build artifacts (for example, `target/`, `.cache/`, or snapshots) so long as they do not edit repo-tracked files\n\n### Not allowed (mutating, plan-executing)\n\nActions that implement the plan or change repo-tracked state. Examples:\n\n* Editing or writing files\n* Running formatters or linters that rewrite files\n* Applying patches, migrations, or codegen that updates repo-tracked files\n* Side-effectful commands whose purpose is to carry out the plan rather than refine it\n\nWhen in doubt: if the action would reasonably be described as \"doing the work\" rather than \"planning the work,\" do not do it.\n\n## PHASE 1 - Ground in the environment (explore first, ask second)\n\nBegin by grounding yourself in the actual environment. Eliminate unknowns in the prompt by discovering facts, not by asking the user. Resolve all questions that can be answered through exploration or inspection. Identify missing or ambiguous details only if they cannot be derived from the environment. Silent exploration between turns is allowed and encouraged.\n\nBefore asking the user any question, perform at least one targeted non-mutating exploration pass (for example: search relevant files, inspect likely entrypoints/configs, confirm current implementation shape), unless no local environment/repo is available.\n\nException: you may ask clarifying questions about the user's prompt before exploring, ONLY if there are obvious ambiguities or contradictions in the prompt itself. However, if ambiguity might be resolved by exploring, always prefer exploring first.\n\nDo not ask questions that can be answered from the repo or system (for example, \"where is this struct?\" or \"which UI component should we use?\" when exploration can make it clear). Only ask once you have exhausted reasonable non-mutating exploration.\n\n## PHASE 2 - Intent chat (what they actually want)\n\n* Keep asking until you can clearly state: goal + success criteria, audience, in/out of scope, constraints, current state, and the key preferences/tradeoffs.\n* Bias toward questions over guessing: if any high-impact ambiguity remains, do NOT plan yet-ask.\n\n## PHASE 3 - Implementation chat (what/how we'll build)\n\n* Once intent is stable, keep asking until the spec is decision complete: approach, interfaces (APIs/schemas/I/O), data flow, edge cases/failure modes, testing + acceptance criteria, rollout/monitoring, and any migrations/compat constraints.\n\n## Asking questions\n\nCritical rules:\n\n* Strongly prefer using the `request_user_input` tool to ask any questions.\n* Offer only meaningful multiple-choice options; don't include filler choices that are obviously wrong or irrelevant.\n* In rare cases where an unavoidable, important question can't be expressed with reasonable multiple-choice options (due to extreme ambiguity), you may ask it directly withoutLine truncated
{"type":"emit_inbound","label":"thread/started","frame":{"method":"thread/started","params":{"thread":{"id":"019db22b-08cd-7e12-b967-cf6ab32dd408","forkedFromId":null,"preview":"","ephemeral":false,"modelProvider":"openai","createdAt":1776810658,"updatedAt":1776810658,"status":{"type":"idle"},"path":"/Users/julius/.codex/sessions/2026/04/21/rollout-2026-04-21T15-30-58-019db22b-08cd-7e12-b967-cf6ab32dd408.jsonl","cwd":"/Users/julius/.t3/worktrees/codething-mvp/t3code-c1e5e1d1/packages/effect-codex-app-server","cliVersion":"0.120.0","source":"vscode","agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"turns":[]}}}}
{"type":"emit_inbound","label":"deprecationNotice","frame":{"method":"deprecationNotice","params":{"summary":"`[features].collab` is deprecated. Use `[features].multi_agent` instead.","details":"Enable it with `--enable multi_agent` or `[features].multi_agent` in config.toml. See https://developers.openai.com/codex/config-basic#feature-flags for details."}}}
{"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"name":"uidotsh","status":"starting","error":null}}}
@@ -29,7 +29,12 @@ export function assertClaudeSubagentOutput(
const projection = projectionFor(result, transcript.scenario);
assertSemanticProjectionIntegrity(projection);
assertExecutionNodeKinds(projection, ["root_turn", "subagent", "tool_call"]);
assertTurnItemTypes(projection, ["user_message", "dynamic_tool", "assistant_message"]);
assertTurnItemTypes(projection, [
"user_message",
"subagent",
"dynamic_tool",
"assistant_message",
]);
assertRunProviderTurnCardinality({ projection, rootRunCount: 1 });
assertNoExtraAppRunsForProviderChildren({ projection, expectedAppRuns: 1 });
assertUserMessagesInclude(projection, [SUBAGENT_PROMPT]);
@@ -43,6 +48,34 @@ export function assertClaudeSubagentOutput(
["completed", "completed"],
);
assert.lengthOf(projection.subagents, 2);
assert.isTrue(
projection.subagents.some(
(subagent) =>
subagent.prompt ===
"Read the file `package.json` in the current working directory and return its full contents." &&
subagent.result === "Read package.json",
),
);
assert.isTrue(
projection.subagents.some(
(subagent) =>
subagent.prompt ===
"Read the file `tsconfig.json` in the current working directory and return its full contents." &&
subagent.result === "Read tsconfig.json",
),
);
for (const subagent of projection.subagents) {
assert.equal(subagent.origin, "provider_native");
assert.equal(subagent.createdBy, "agent");
assert.equal(subagent.provider, "claudeAgent");
assert.equal(subagent.status, "completed");
assert.isNull(subagent.providerThreadId);
assert.isNull(subagent.childThreadId);
assert.isNotNull(subagent.nativeTaskRef);
assert.isNotNull(subagent.completedAt);
}
const subagentNodeIds = new Set(subagentNodes.map((node) => node.id));
const nestedToolNodes = projection.nodes.filter(
(node) =>
@@ -28,10 +28,54 @@ export function assertSubagentOutput(
const projection = projectionFor(result, transcript.scenario);
assertSemanticProjectionIntegrity(projection);
assertTurnItemTypes(projection, ["user_message", "assistant_message"]);
assertTurnItemTypes(projection, ["user_message", "subagent", "assistant_message"]);
assertExecutionNodeKinds(projection, ["root_turn", "subagent"]);
assertRunProviderTurnCardinality({ projection, rootRunCount: 1, providerTurnCountAtLeast: 3 });
assertNoExtraAppRunsForProviderChildren({ projection, expectedAppRuns: 1 });
assertUserMessagesInclude(projection, [SUBAGENT_PROMPT]);
assert.equal(projection.runs.length, 1, "subagent provider turns must not become app runs");
assert.lengthOf(projection.subagents, 2);
assert.deepEqual(
projection.subagents.map((subagent) => subagent.status),
["completed", "completed"],
);
assert.isTrue(
projection.subagents.some(
(subagent) =>
subagent.prompt.includes("Read package.json only") &&
subagent.result?.includes("Package name: `effect-codex-app-server`"),
),
);
assert.isTrue(
projection.subagents.some(
(subagent) =>
subagent.prompt.includes("Read tsconfig.json only") &&
subagent.result?.includes("`extends`: `../../tsconfig.base.json`"),
),
);
for (const subagent of projection.subagents) {
assert.equal(subagent.origin, "provider_native");
assert.equal(subagent.createdBy, "agent");
assert.equal(subagent.provider, "codex");
assert.isNull(subagent.childThreadId);
assert.isNotNull(subagent.providerThreadId);
assert.isNotNull(subagent.nativeTaskRef);
assert.isNotNull(subagent.completedAt);
const providerThread = projection.providerThreads.find(
(thread) => thread.id === subagent.providerThreadId,
);
assert.isDefined(providerThread);
assert.isNull(providerThread.appThreadId);
assert.equal(providerThread.ownerNodeId, subagent.id);
}
const rootProviderThread = projection.providerThreads.find(
(thread) => thread.ownerNodeId === null,
);
assert.isDefined(rootProviderThread);
assert.equal(rootProviderThread.appThreadId, projection.thread.id);
assert.equal(projection.thread.activeProviderThreadId, rootProviderThread.id);
}
@@ -4,7 +4,7 @@
{"type":"expect_outbound","label":"initialized","frame":{"method":"initialized"}}
{"type":"expect_outbound","label":"thread/start","frame":{"id":2,"method":"thread/start","params":{}}}
{"type":"emit_inbound","label":"thread/start","frame":{"id":2,"result":{"thread":{"id":"019dadec-4bed-7991-a1b7-1ed4fc1038b8","forkedFromId":null,"preview":"","ephemeral":false,"modelProvider":"openai","createdAt":1776739437,"updatedAt":1776739437,"status":{"type":"idle"},"path":"/Users/julius/.codex/sessions/2026/04/20/rollout-2026-04-20T19-43-57-019dadec-4bed-7991-a1b7-1ed4fc1038b8.jsonl","cwd":"/Users/julius/.t3/worktrees/codething-mvp/t3code-c1e5e1d1/packages/effect-codex-app-server","cliVersion":"0.120.0","source":"vscode","agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"turns":[]},"model":"gpt-5.4","modelProvider":"openai","serviceTier":"fast","cwd":"/Users/julius/.t3/worktrees/codething-mvp/t3code-c1e5e1d1/packages/effect-codex-app-server","approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":["/Users/julius/.codex/memories"],"readOnlyAccess":{"type":"fullAccess"},"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"reasoningEffort":"xhigh"}}}
{"type":"expect_outbound","label":"turn/start","frame":{"id":3,"method":"turn/start","params":{"approvalPolicy":"on-request","input":[{"text":"Spawn 2 subagents, one to read package.json and one to read tsconfig.json","type":"text"}],"sandboxPolicy":{"access":{"type":"fullAccess"},"networkAccess":false,"type":"readOnly"},"threadId":"019dadec-4bed-7991-a1b7-1ed4fc1038b8"}}}
{"type":"expect_outbound","label":"turn/start","frame":{"id":3,"method":"turn/start","params":{"approvalPolicy":"on-request","input":[{"text":"Spawn 2 subagents, one to read package.json and one to read tsconfig.json","type":"text"}],"sandboxPolicy":{"networkAccess":false,"type":"readOnly"},"threadId":"019dadec-4bed-7991-a1b7-1ed4fc1038b8"}}}
{"type":"emit_inbound","label":"thread/started","frame":{"method":"thread/started","params":{"thread":{"id":"019dadec-4bed-7991-a1b7-1ed4fc1038b8","forkedFromId":null,"preview":"","ephemeral":false,"modelProvider":"openai","createdAt":1776739437,"updatedAt":1776739437,"status":{"type":"idle"},"path":"/Users/julius/.codex/sessions/2026/04/20/rollout-2026-04-20T19-43-57-019dadec-4bed-7991-a1b7-1ed4fc1038b8.jsonl","cwd":"/Users/julius/.t3/worktrees/codething-mvp/t3code-c1e5e1d1/packages/effect-codex-app-server","cliVersion":"0.120.0","source":"vscode","agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"turns":[]}}}}
{"type":"emit_inbound","label":"deprecationNotice","frame":{"method":"deprecationNotice","params":{"summary":"`[features].collab` is deprecated. Use `[features].multi_agent` instead.","details":"Enable it with `--enable multi_agent` or `[features].multi_agent` in config.toml. See https://developers.openai.com/codex/config-basic#feature-flags for details."}}}
{"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"name":"uidotsh","status":"starting","error":null}}}
@@ -5,7 +5,7 @@
{"type":"expect_outbound","label":"thread/start","frame":{"id":2,"method":"thread/start","params":{}}}
{"type":"emit_inbound","label":"thread/start","frame":{"id":2,"result":{"thread":{"id":"019dd6ba-2681-7bf0-b051-141b0cbcbb27","forkedFromId":null,"preview":"","ephemeral":false,"modelProvider":"openai","createdAt":1777424017,"updatedAt":1777424017,"status":{"type":"idle"},"path":"/Users/julius/.codex/sessions/2026/04/28/rollout-2026-04-28T17-53-37-019dd6ba-2681-7bf0-b051-141b0cbcbb27.jsonl","cwd":"/Users/julius/.t3/worktrees/codething-mvp/t3code-c1e5e1d1","cliVersion":"0.124.0-alpha.3","source":"vscode","agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"turns":[]},"model":"gpt-5.5","modelProvider":"openai","serviceTier":"fast","cwd":"/Users/julius/.t3/worktrees/codething-mvp/t3code-c1e5e1d1","instructionSources":["/Users/julius/.codex/AGENTS.md","/Users/julius/.t3/worktrees/codething-mvp/t3code-c1e5e1d1/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":["/Users/julius/.codex/memories"],"readOnlyAccess":{"type":"fullAccess"},"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"permissionProfile":{"network":{"enabled":false},"fileSystem":{"entries":[{"path":{"type":"special","value":{"kind":"root"}},"access":"read"},{"path":{"type":"special","value":{"kind":"current_working_directory"}},"access":"write"},{"path":{"type":"special","value":{"kind":"slash_tmp"}},"access":"write"},{"path":{"type":"special","value":{"kind":"tmpdir"}},"access":"write"},{"path":{"type":"path","path":"/Users/julius/.codex/memories"},"access":"write"},{"path":{"type":"path","path":"/Users/julius/Development/Work/codething-mvp/.git/worktrees/t3code-c1e5e1d1"},"access":"read"},{"path":{"type":"path","path":"/Users/julius/.t3/worktrees/codething-mvp/t3code-c1e5e1d1/.git"},"access":"read"},{"path":{"type":"path","path":"/Users/julius/.t3/worktrees/codething-mvp/t3code-c1e5e1d1/.codex"},"access":"read"}]}},"reasoningEffort":"medium"}}}
{"type":"emit_inbound","label":"thread/started","frame":{"method":"thread/started","params":{"thread":{"id":"019dd6ba-2681-7bf0-b051-141b0cbcbb27","forkedFromId":null,"preview":"","ephemeral":false,"modelProvider":"openai","createdAt":1777424017,"updatedAt":1777424017,"status":{"type":"idle"},"path":"/Users/julius/.codex/sessions/2026/04/28/rollout-2026-04-28T17-53-37-019dd6ba-2681-7bf0-b051-141b0cbcbb27.jsonl","cwd":"/Users/julius/.t3/worktrees/codething-mvp/t3code-c1e5e1d1","cliVersion":"0.124.0-alpha.3","source":"vscode","agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"turns":[]}}}}
{"type":"expect_outbound","label":"turn/start","frame":{"id":3,"method":"turn/start","params":{"threadId":"019dd6ba-2681-7bf0-b051-141b0cbcbb27","input":[{"type":"text","text":"For this fork-boundary fixture, respond with exactly: fork boundary alpha"}],"approvalPolicy":"never","sandboxPolicy":{"type":"readOnly","access":{"type":"fullAccess"},"networkAccess":false}}}}
{"type":"expect_outbound","label":"turn/start","frame":{"id":3,"method":"turn/start","params":{"threadId":"019dd6ba-2681-7bf0-b051-141b0cbcbb27","input":[{"type":"text","text":"For this fork-boundary fixture, respond with exactly: fork boundary alpha"}],"approvalPolicy":"never","sandboxPolicy":{"type":"readOnly","networkAccess":false}}}}
{"type":"emit_inbound","label":"deprecationNotice","frame":{"method":"deprecationNotice","params":{"summary":"`[features].collab` is deprecated. Use `[features].multi_agent` instead.","details":"Enable it with `--enable multi_agent` or `[features].multi_agent` in config.toml. See https://developers.openai.com/codex/config-basic#feature-flags for details."}}}
{"type":"emit_inbound","label":"warning","frame":{"method":"warning","params":{"threadId":"019dd6ba-2681-7bf0-b051-141b0cbcbb27","message":"Under-development features enabled: apply_patch_freeform. Under-development features are incomplete and may behave unpredictably. To suppress this warning, set `suppress_unstable_features_warning = true` in /Users/julius/.codex/config.toml."}}}
{"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"name":"codex_apps","status":"starting","error":null}}}
@@ -31,7 +31,7 @@
{"type":"emit_inbound","label":"account/rateLimits/updated","frame":{"method":"account/rateLimits/updated","params":{"rateLimits":{"limitId":"codex","limitName":null,"primary":{"usedPercent":61,"windowDurationMins":300,"resetsAt":1777429830},"secondary":{"usedPercent":23,"windowDurationMins":10080,"resetsAt":1777959590},"credits":null,"planType":"pro","rateLimitReachedType":null}}}}
{"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"019dd6ba-2681-7bf0-b051-141b0cbcbb27","status":{"type":"idle"}}}}
{"type":"emit_inbound","label":"turn/completed","frame":{"method":"turn/completed","params":{"threadId":"019dd6ba-2681-7bf0-b051-141b0cbcbb27","turn":{"id":"019dd6ba-268b-7f82-8f4c-9fde0edcfd55","items":[],"status":"completed","error":null,"startedAt":1777424017,"completedAt":1777424023,"durationMs":6880}}}}
{"type":"expect_outbound","label":"turn/start","frame":{"id":4,"method":"turn/start","params":{"threadId":"019dd6ba-2681-7bf0-b051-141b0cbcbb27","input":[{"type":"text","text":"For this fork-boundary fixture, respond with exactly: fork boundary beta"}],"approvalPolicy":"never","sandboxPolicy":{"type":"readOnly","access":{"type":"fullAccess"},"networkAccess":false}}}}
{"type":"expect_outbound","label":"turn/start","frame":{"id":4,"method":"turn/start","params":{"threadId":"019dd6ba-2681-7bf0-b051-141b0cbcbb27","input":[{"type":"text","text":"For this fork-boundary fixture, respond with exactly: fork boundary beta"}],"approvalPolicy":"never","sandboxPolicy":{"type":"readOnly","networkAccess":false}}}}
{"type":"emit_inbound","label":"turn/start","frame":{"id":4,"result":{"turn":{"id":"019dd6ba-416d-7902-95cf-d4179c3f4738","items":[],"status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}}
{"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"019dd6ba-2681-7bf0-b051-141b0cbcbb27","status":{"type":"active","activeFlags":[]}}}}
{"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"019dd6ba-2681-7bf0-b051-141b0cbcbb27","turn":{"id":"019dd6ba-416d-7902-95cf-d4179c3f4738","items":[],"status":"inProgress","error":null,"startedAt":1777424023,"completedAt":null,"durationMs":null}}}}
@@ -64,7 +64,7 @@
{"type":"emit_inbound","label":"thread/started","frame":{"method":"thread/started","params":{"thread":{"id":"019dd6ba-47b7-7092-8688-9cf7fe5f6498","forkedFromId":"019dd6ba-2681-7bf0-b051-141b0cbcbb27","preview":"For this fork-boundary fixture, respond with exactly: fork boundary alpha","ephemeral":false,"modelProvider":"openai","createdAt":1777424025,"updatedAt":1777424025,"status":{"type":"idle"},"path":"/Users/julius/.codex/sessions/2026/04/28/rollout-2026-04-28T17-53-45-019dd6ba-47b7-7092-8688-9cf7fe5f6498.jsonl","cwd":"/Users/julius/.t3/worktrees/codething-mvp/t3code-c1e5e1d1","cliVersion":"0.124.0-alpha.3","source":"vscode","agentNickname":null,"agentRole":null,"gitInfo":{"sha":"969e8ea4fac1f2066ed50dd4f82b5fd0014d8a4d","branch":"t3code/codex-turn-mapping","originUrl":"[email protected]:pingdotgg/t3code.git"},"name":null,"turns":[{"id":"019dd6ba-268b-7f82-8f4c-9fde0edcfd55","items":[{"type":"userMessage","id":"item-1","content":[{"type":"text","text":"For this fork-boundary fixture, respond with exactly: fork boundary alpha","text_elements":[]}]},{"type":"agentMessage","id":"item-2","text":"fork boundary alpha","phase":"final_answer","memoryCitation":null}],"status":"completed","error":null,"startedAt":1777424017,"completedAt":1777424023,"durationMs":6880},{"id":"019dd6ba-416d-7902-95cf-d4179c3f4738","items":[{"type":"userMessage","id":"item-3","content":[{"type":"text","text":"For this fork-boundary fixture, respond with exactly: fork boundary beta","text_elements":[]}]},{"type":"agentMessage","id":"item-4","text":"fork boundary beta","phase":"final_answer","memoryCitation":null}],"status":"completed","error":null,"startedAt":1777424023,"completedAt":1777424025,"durationMs":1596}]}}}}
{"type":"emit_inbound","label":"thread/tokenUsage/updated","frame":{"method":"thread/tokenUsage/updated","params":{"threadId":"019dd6ba-47b7-7092-8688-9cf7fe5f6498","turnId":"019dd6ba-47e9-7ed2-ba44-374e8b74cf27","tokenUsage":{"total":{"totalTokens":53852,"inputTokens":53827,"cachedInputTokens":29952,"outputTokens":25,"reasoningOutputTokens":9},"last":{"totalTokens":10877,"inputTokens":0,"cachedInputTokens":0,"outputTokens":0,"reasoningOutputTokens":0},"modelContextWindow":258400}}}}
{"type":"emit_inbound","label":"thread/rollback","frame":{"id":7,"result":{"thread":{"id":"019dd6ba-47b7-7092-8688-9cf7fe5f6498","forkedFromId":null,"preview":"For this fork-boundary fixture, respond with exactly: fork boundary alpha","ephemeral":false,"modelProvider":"openai","createdAt":1777424025,"updatedAt":1777424025,"status":{"type":"idle"},"path":"/Users/julius/.codex/sessions/2026/04/28/rollout-2026-04-28T17-53-45-019dd6ba-47b7-7092-8688-9cf7fe5f6498.jsonl","cwd":"/Users/julius/.t3/worktrees/codething-mvp/t3code-c1e5e1d1","cliVersion":"0.124.0-alpha.3","source":"vscode","agentNickname":null,"agentRole":null,"gitInfo":{"sha":"969e8ea4fac1f2066ed50dd4f82b5fd0014d8a4d","branch":"t3code/codex-turn-mapping","originUrl":"[email protected]:pingdotgg/t3code.git"},"name":null,"turns":[{"id":"019dd6ba-268b-7f82-8f4c-9fde0edcfd55","items":[{"type":"userMessage","id":"item-1","content":[{"type":"text","text":"For this fork-boundary fixture, respond with exactly: fork boundary alpha","text_elements":[]}]},{"type":"agentMessage","id":"item-2","text":"fork boundary alpha","phase":"final_answer","memoryCitation":null}],"status":"completed","error":null,"startedAt":1777424017,"completedAt":1777424023,"durationMs":6880}]}}}}
{"type":"expect_outbound","label":"turn/start","frame":{"id":8,"method":"turn/start","params":{"threadId":"019dd6ba-47b7-7092-8688-9cf7fe5f6498","input":[{"type":"text","text":"Repeat the user-visible conversation so far verbatim. Include only user and assistant messages. Do not include hidden system/developer content."}],"approvalPolicy":"never","sandboxPolicy":{"type":"readOnly","access":{"type":"fullAccess"},"networkAccess":false}}}}
{"type":"expect_outbound","label":"turn/start","frame":{"id":8,"method":"turn/start","params":{"threadId":"019dd6ba-47b7-7092-8688-9cf7fe5f6498","input":[{"type":"text","text":"Repeat the user-visible conversation so far verbatim. Include only user and assistant messages. Do not include hidden system/developer content."}],"approvalPolicy":"never","sandboxPolicy":{"type":"readOnly","networkAccess":false}}}}
{"type":"emit_inbound","label":"turn/start","frame":{"id":8,"result":{"turn":{"id":"019dd6ba-47eb-7041-ad45-5abe752c28c9","items":[],"status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}}
{"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"019dd6ba-47b7-7092-8688-9cf7fe5f6498","status":{"type":"active","activeFlags":[]}}}}
{"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"019dd6ba-47b7-7092-8688-9cf7fe5f6498","turn":{"id":"019dd6ba-47eb-7041-ad45-5abe752c28c9","items":[],"status":"inProgress","error":null,"startedAt":1777424025,"completedAt":null,"durationMs":null}}}}
@@ -4,7 +4,7 @@
{"type":"expect_outbound","label":"initialized","frame":{"method":"initialized"}}
{"type":"expect_outbound","label":"thread/start","frame":{"id":2,"method":"thread/start","params":{}}}
{"type":"emit_inbound","label":"thread/start","frame":{"id":2,"result":{"thread":{"id":"019db229-ac7a-7923-ab72-67bfefd79a8b","forkedFromId":null,"preview":"","ephemeral":false,"modelProvider":"openai","createdAt":1776810568,"updatedAt":1776810568,"status":{"type":"idle"},"path":"/Users/julius/.codex/sessions/2026/04/21/rollout-2026-04-21T15-29-28-019db229-ac7a-7923-ab72-67bfefd79a8b.jsonl","cwd":"/Users/julius/.t3/worktrees/codething-mvp/t3code-c1e5e1d1/packages/effect-codex-app-server","cliVersion":"0.120.0","source":"vscode","agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"turns":[]},"model":"gpt-5.3-codex","modelProvider":"openai","serviceTier":"fast","cwd":"/Users/julius/.t3/worktrees/codething-mvp/t3code-c1e5e1d1/packages/effect-codex-app-server","approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":["/Users/julius/.codex/memories"],"readOnlyAccess":{"type":"fullAccess"},"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"reasoningEffort":"xhigh"}}}
{"type":"expect_outbound","label":"turn/start","frame":{"id":3,"method":"turn/start","params":{"approvalPolicy":"never","input":[{"text":"Use the update_plan tool to track exactly three steps: inspect package.json, inspect tsconfig.json, report completion. Then read package.json and tsconfig.json, and answer exactly: todo list fixture complete","type":"text"}],"sandboxPolicy":{"access":{"type":"fullAccess"},"networkAccess":false,"type":"readOnly"},"threadId":"019db229-ac7a-7923-ab72-67bfefd79a8b"}}}
{"type":"expect_outbound","label":"turn/start","frame":{"id":3,"method":"turn/start","params":{"approvalPolicy":"never","input":[{"text":"Use the update_plan tool to track exactly three steps: inspect package.json, inspect tsconfig.json, report completion. Then read package.json and tsconfig.json, and answer exactly: todo list fixture complete","type":"text"}],"sandboxPolicy":{"networkAccess":false,"type":"readOnly"},"threadId":"019db229-ac7a-7923-ab72-67bfefd79a8b"}}}
{"type":"emit_inbound","label":"thread/started","frame":{"method":"thread/started","params":{"thread":{"id":"019db229-ac7a-7923-ab72-67bfefd79a8b","forkedFromId":null,"preview":"","ephemeral":false,"modelProvider":"openai","createdAt":1776810568,"updatedAt":1776810568,"status":{"type":"idle"},"path":"/Users/julius/.codex/sessions/2026/04/21/rollout-2026-04-21T15-29-28-019db229-ac7a-7923-ab72-67bfefd79a8b.jsonl","cwd":"/Users/julius/.t3/worktrees/codething-mvp/t3code-c1e5e1d1/packages/effect-codex-app-server","cliVersion":"0.120.0","source":"vscode","agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"turns":[]}}}}
{"type":"emit_inbound","label":"deprecationNotice","frame":{"method":"deprecationNotice","params":{"summary":"`[features].collab` is deprecated. Use `[features].multi_agent` instead.","details":"Enable it with `--enable multi_agent` or `[features].multi_agent` in config.toml. See https://developers.openai.com/codex/config-basic#feature-flags for details."}}}
{"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"name":"uidotsh","status":"starting","error":null}}}
@@ -4,7 +4,7 @@
{"type":"expect_outbound","label":"initialized","frame":{"method":"initialized"}}
{"type":"expect_outbound","label":"thread/start","frame":{"id":2,"method":"thread/start","params":{}}}
{"type":"emit_inbound","label":"thread/start","frame":{"id":2,"result":{"thread":{"id":"019dadeb-5cd0-76e1-910c-3effc0cc5e67","forkedFromId":null,"preview":"","ephemeral":false,"modelProvider":"openai","createdAt":1776739376,"updatedAt":1776739376,"status":{"type":"idle"},"path":"/Users/julius/.codex/sessions/2026/04/20/rollout-2026-04-20T19-42-56-019dadeb-5cd0-76e1-910c-3effc0cc5e67.jsonl","cwd":"/Users/julius/.t3/worktrees/codething-mvp/t3code-c1e5e1d1/packages/effect-codex-app-server","cliVersion":"0.120.0","source":"vscode","agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"turns":[]},"model":"gpt-5.4","modelProvider":"openai","serviceTier":"fast","cwd":"/Users/julius/.t3/worktrees/codething-mvp/t3code-c1e5e1d1/packages/effect-codex-app-server","approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":["/Users/julius/.codex/memories"],"readOnlyAccess":{"type":"fullAccess"},"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"reasoningEffort":"xhigh"}}}
{"type":"expect_outbound","label":"turn/start","frame":{"id":3,"method":"turn/start","params":{"approvalPolicy":"on-request","input":[{"text":"Create or overwrite .codex-probe-write-action.txt with exactly this text: codex app-server approval fixture. Use a local shell command or file edit only, then briefly report what happened. Do not read package metadata, use GitHub, use web, or use MCP.","type":"text"}],"sandboxPolicy":{"access":{"type":"fullAccess"},"networkAccess":false,"type":"readOnly"},"threadId":"019dadeb-5cd0-76e1-910c-3effc0cc5e67"}}}
{"type":"expect_outbound","label":"turn/start","frame":{"id":3,"method":"turn/start","params":{"approvalPolicy":"on-request","input":[{"text":"Create or overwrite .codex-probe-write-action.txt with exactly this text: codex app-server approval fixture. Use a local shell command or file edit only, then briefly report what happened. Do not read package metadata, use GitHub, use web, or use MCP.","type":"text"}],"sandboxPolicy":{"networkAccess":false,"type":"readOnly"},"threadId":"019dadeb-5cd0-76e1-910c-3effc0cc5e67"}}}
{"type":"emit_inbound","label":"thread/started","frame":{"method":"thread/started","params":{"thread":{"id":"019dadeb-5cd0-76e1-910c-3effc0cc5e67","forkedFromId":null,"preview":"","ephemeral":false,"modelProvider":"openai","createdAt":1776739376,"updatedAt":1776739376,"status":{"type":"idle"},"path":"/Users/julius/.codex/sessions/2026/04/20/rollout-2026-04-20T19-42-56-019dadeb-5cd0-76e1-910c-3effc0cc5e67.jsonl","cwd":"/Users/julius/.t3/worktrees/codething-mvp/t3code-c1e5e1d1/packages/effect-codex-app-server","cliVersion":"0.120.0","source":"vscode","agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"turns":[]}}}}
{"type":"emit_inbound","label":"deprecationNotice","frame":{"method":"deprecationNotice","params":{"summary":"`[features].collab` is deprecated. Use `[features].multi_agent` instead.","details":"Enable it with `--enable multi_agent` or `[features].multi_agent` in config.toml. See https://developers.openai.com/codex/config-basic#feature-flags for details."}}}
{"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"name":"uidotsh","status":"starting","error":null}}}
@@ -4,7 +4,7 @@
{"type":"expect_outbound","label":"initialized","frame":{"method":"initialized"}}
{"type":"expect_outbound","label":"thread/start","frame":{"id":2,"method":"thread/start","params":{}}}
{"type":"emit_inbound","label":"thread/start","frame":{"id":2,"result":{"thread":{"id":"019dadeb-c0d3-7331-8353-a710f2912df3","forkedFromId":null,"preview":"","ephemeral":false,"modelProvider":"openai","createdAt":1776739401,"updatedAt":1776739401,"status":{"type":"idle"},"path":"/Users/julius/.codex/sessions/2026/04/20/rollout-2026-04-20T19-43-21-019dadeb-c0d3-7331-8353-a710f2912df3.jsonl","cwd":"/Users/julius/.t3/worktrees/codething-mvp/t3code-c1e5e1d1/packages/effect-codex-app-server","cliVersion":"0.120.0","source":"vscode","agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"turns":[]},"model":"gpt-5.4","modelProvider":"openai","serviceTier":"fast","cwd":"/Users/julius/.t3/worktrees/codething-mvp/t3code-c1e5e1d1/packages/effect-codex-app-server","approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":["/Users/julius/.codex/memories"],"readOnlyAccess":{"type":"fullAccess"},"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"reasoningEffort":"xhigh"}}}
{"type":"expect_outbound","label":"turn/start","frame":{"id":3,"method":"turn/start","params":{"approvalPolicy":{"granular":{"mcp_elicitations":true,"request_permissions":true,"rules":true,"sandbox_approval":true,"skill_approval":true}},"input":[{"text":"Create or overwrite .codex-probe-write-action.txt with exactly this text: codex app-server approval fixture. Use a local shell command or file edit only, then briefly report what happened. Do not read package metadata, use GitHub, use web, or use MCP.","type":"text"}],"sandboxPolicy":{"access":{"includePlatformDefaults":false,"readableRoots":[],"type":"restricted"},"networkAccess":false,"type":"readOnly"},"threadId":"019dadeb-c0d3-7331-8353-a710f2912df3"}}}
{"type":"expect_outbound","label":"turn/start","frame":{"id":3,"method":"turn/start","params":{"approvalPolicy":{"granular":{"mcp_elicitations":true,"request_permissions":true,"rules":true,"sandbox_approval":true,"skill_approval":true}},"input":[{"text":"Create or overwrite .codex-probe-write-action.txt with exactly this text: codex app-server approval fixture. Use a local shell command or file edit only, then briefly report what happened. Do not read package metadata, use GitHub, use web, or use MCP.","type":"text"}],"sandboxPolicy":{"networkAccess":false,"type":"readOnly"},"threadId":"019dadeb-c0d3-7331-8353-a710f2912df3"}}}
{"type":"emit_inbound","label":"thread/started","frame":{"method":"thread/started","params":{"thread":{"id":"019dadeb-c0d3-7331-8353-a710f2912df3","forkedFromId":null,"preview":"","ephemeral":false,"modelProvider":"openai","createdAt":1776739401,"updatedAt":1776739401,"status":{"type":"idle"},"path":"/Users/julius/.codex/sessions/2026/04/20/rollout-2026-04-20T19-43-21-019dadeb-c0d3-7331-8353-a710f2912df3.jsonl","cwd":"/Users/julius/.t3/worktrees/codething-mvp/t3code-c1e5e1d1/packages/effect-codex-app-server","cliVersion":"0.120.0","source":"vscode","agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"turns":[]}}}}
{"type":"emit_inbound","label":"deprecationNotice","frame":{"method":"deprecationNotice","params":{"summary":"`[features].collab` is deprecated. Use `[features].multi_agent` instead.","details":"Enable it with `--enable multi_agent` or `[features].multi_agent` in config.toml. See https://developers.openai.com/codex/config-basic#feature-flags for details."}}}
{"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"name":"uidotsh","status":"starting","error":null}}}
@@ -4,7 +4,7 @@
{"type":"expect_outbound","label":"initialized","frame":{"method":"initialized"}}
{"type":"expect_outbound","label":"thread/start","frame":{"id":2,"method":"thread/start","params":{}}}
{"type":"emit_inbound","label":"thread/start","frame":{"id":2,"result":{"thread":{"id":"019dadeb-9a1f-7d61-8e4b-92d487d180b4","forkedFromId":null,"preview":"","ephemeral":false,"modelProvider":"openai","createdAt":1776739392,"updatedAt":1776739392,"status":{"type":"idle"},"path":"/Users/julius/.codex/sessions/2026/04/20/rollout-2026-04-20T19-43-12-019dadeb-9a1f-7d61-8e4b-92d487d180b4.jsonl","cwd":"/Users/julius/.t3/worktrees/codething-mvp/t3code-c1e5e1d1/packages/effect-codex-app-server","cliVersion":"0.120.0","source":"vscode","agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"turns":[]},"model":"gpt-5.4","modelProvider":"openai","serviceTier":"fast","cwd":"/Users/julius/.t3/worktrees/codething-mvp/t3code-c1e5e1d1/packages/effect-codex-app-server","approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":["/Users/julius/.codex/memories"],"readOnlyAccess":{"type":"fullAccess"},"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"reasoningEffort":"xhigh"}}}
{"type":"expect_outbound","label":"turn/start","frame":{"id":3,"method":"turn/start","params":{"approvalPolicy":"never","input":[{"text":"Create or overwrite .codex-probe-write-action.txt with exactly this text: codex app-server approval fixture. Use a local shell command or file edit only, then briefly report what happened. Do not read package metadata, use GitHub, use web, or use MCP.","type":"text"}],"sandboxPolicy":{"networkAccess":false,"readOnlyAccess":{"type":"fullAccess"},"type":"workspaceWrite","writableRoots":[]},"threadId":"019dadeb-9a1f-7d61-8e4b-92d487d180b4"}}}
{"type":"expect_outbound","label":"turn/start","frame":{"id":3,"method":"turn/start","params":{"approvalPolicy":"never","input":[{"text":"Create or overwrite .codex-probe-write-action.txt with exactly this text: codex app-server approval fixture. Use a local shell command or file edit only, then briefly report what happened. Do not read package metadata, use GitHub, use web, or use MCP.","type":"text"}],"sandboxPolicy":{"networkAccess":false,"type":"workspaceWrite","writableRoots":[]},"threadId":"019dadeb-9a1f-7d61-8e4b-92d487d180b4"}}}
{"type":"emit_inbound","label":"thread/started","frame":{"method":"thread/started","params":{"thread":{"id":"019dadeb-9a1f-7d61-8e4b-92d487d180b4","forkedFromId":null,"preview":"","ephemeral":false,"modelProvider":"openai","createdAt":1776739392,"updatedAt":1776739392,"status":{"type":"idle"},"path":"/Users/julius/.codex/sessions/2026/04/20/rollout-2026-04-20T19-43-12-019dadeb-9a1f-7d61-8e4b-92d487d180b4.jsonl","cwd":"/Users/julius/.t3/worktrees/codething-mvp/t3code-c1e5e1d1/packages/effect-codex-app-server","cliVersion":"0.120.0","source":"vscode","agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"turns":[]}}}}
{"type":"emit_inbound","label":"deprecationNotice","frame":{"method":"deprecationNotice","params":{"summary":"`[features].collab` is deprecated. Use `[features].multi_agent` instead.","details":"Enable it with `--enable multi_agent` or `[features].multi_agent` in config.toml. See https://developers.openai.com/codex/config-basic#feature-flags for details."}}}
{"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"name":"uidotsh","status":"starting","error":null}}}
@@ -4,7 +4,7 @@
{"type":"expect_outbound","label":"initialized","frame":{"method":"initialized"}}
{"type":"expect_outbound","label":"thread/start","frame":{"id":2,"method":"thread/start","params":{}}}
{"type":"emit_inbound","label":"thread/start","frame":{"id":2,"result":{"thread":{"id":"019daded-1d25-7df0-abf3-9ed9d31c346c","forkedFromId":null,"preview":"","ephemeral":false,"modelProvider":"openai","createdAt":1776739491,"updatedAt":1776739491,"status":{"type":"idle"},"path":"/Users/julius/.codex/sessions/2026/04/20/rollout-2026-04-20T19-44-51-019daded-1d25-7df0-abf3-9ed9d31c346c.jsonl","cwd":"/Users/julius/.t3/worktrees/codething-mvp/t3code-c1e5e1d1/packages/effect-codex-app-server","cliVersion":"0.120.0","source":"vscode","agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"turns":[]},"model":"gpt-5.4","modelProvider":"openai","serviceTier":"fast","cwd":"/Users/julius/.t3/worktrees/codething-mvp/t3code-c1e5e1d1/packages/effect-codex-app-server","approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":["/Users/julius/.codex/memories"],"readOnlyAccess":{"type":"fullAccess"},"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"reasoningEffort":"xhigh"}}}
{"type":"expect_outbound","label":"turn/start","frame":{"id":3,"method":"turn/start","params":{"approvalPolicy":"never","input":[{"text":"Do not answer immediately. First run the local shell command `sleep 30`, then respond with exactly: interrupt fixture should not finish naturally.","type":"text"}],"sandboxPolicy":{"networkAccess":false,"readOnlyAccess":{"type":"fullAccess"},"type":"workspaceWrite","writableRoots":[]},"threadId":"019daded-1d25-7df0-abf3-9ed9d31c346c"}}}
{"type":"expect_outbound","label":"turn/start","frame":{"id":3,"method":"turn/start","params":{"approvalPolicy":"never","input":[{"text":"Do not answer immediately. First run the local shell command `sleep 30`, then respond with exactly: interrupt fixture should not finish naturally.","type":"text"}],"sandboxPolicy":{"networkAccess":false,"type":"workspaceWrite","writableRoots":[]},"threadId":"019daded-1d25-7df0-abf3-9ed9d31c346c"}}}
{"type":"emit_inbound","label":"thread/started","frame":{"method":"thread/started","params":{"thread":{"id":"019daded-1d25-7df0-abf3-9ed9d31c346c","forkedFromId":null,"preview":"","ephemeral":false,"modelProvider":"openai","createdAt":1776739491,"updatedAt":1776739491,"status":{"type":"idle"},"path":"/Users/julius/.codex/sessions/2026/04/20/rollout-2026-04-20T19-44-51-019daded-1d25-7df0-abf3-9ed9d31c346c.jsonl","cwd":"/Users/julius/.t3/worktrees/codething-mvp/t3code-c1e5e1d1/packages/effect-codex-app-server","cliVersion":"0.120.0","source":"vscode","agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"turns":[]}}}}
{"type":"emit_inbound","label":"deprecationNotice","frame":{"method":"deprecationNotice","params":{"summary":"`[features].collab` is deprecated. Use `[features].multi_agent` instead.","details":"Enable it with `--enable multi_agent` or `[features].multi_agent` in config.toml. See https://developers.openai.com/codex/config-basic#feature-flags for details."}}}
{"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"name":"uidotsh","status":"starting","error":null}}}
@@ -5,7 +5,7 @@
{"type":"expect_outbound","label":"thread/start","frame":{"id":2,"method":"thread/start","params":{}}}
{"type":"emit_inbound","label":"remoteControl/status/changed","frame":{"method":"remoteControl/status/changed","params":{"status":"disabled","environmentId":null}}}
{"type":"emit_inbound","label":"thread/start","frame":{"id":2,"result":{"thread":{"id":"019e03b8-9e5c-7b32-88ab-f742a29b75b8","forkedFromId":null,"preview":"","ephemeral":false,"modelProvider":"openai","createdAt":1778178891,"updatedAt":1778178891,"status":{"type":"idle"},"path":"/Users/julius/.codex_p/sessions/2026/05/07/rollout-2026-05-07T11-34-51-019e03b8-9e5c-7b32-88ab-f742a29b75b8.jsonl","cwd":"/Users/julius/.t3/worktrees/codething-mvp/t3code-c1e5e1d1/apps/server","cliVersion":"0.128.0","source":"vscode","agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"turns":[]},"model":"gpt-5.5","modelProvider":"openai","serviceTier":"fast","cwd":"/Users/julius/.t3/worktrees/codething-mvp/t3code-c1e5e1d1/apps/server","instructionSources":["/Users/julius/.codex_p/AGENTS.md","/Users/julius/.t3/worktrees/codething-mvp/t3code-c1e5e1d1/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":["/Users/julius/.codex_p/memories"],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"permissionProfile":{"type":"managed","network":{"enabled":false},"fileSystem":{"type":"restricted","entries":[{"path":{"type":"special","value":{"kind":"root"}},"access":"read"},{"path":{"type":"special","value":{"kind":"project_roots","subpath":null}},"access":"write"},{"path":{"type":"special","value":{"kind":"slash_tmp"}},"access":"write"},{"path":{"type":"special","value":{"kind":"tmpdir"}},"access":"write"},{"path":{"type":"special","value":{"kind":"project_roots","subpath":".git"}},"access":"read"},{"path":{"type":"special","value":{"kind":"project_roots","subpath":".agents"}},"access":"read"},{"path":{"type":"special","value":{"kind":"project_roots","subpath":".codex"}},"access":"read"},{"path":{"type":"path","path":"/Users/julius/.codex_p/memories"},"access":"write"}]}},"activePermissionProfile":{"id":":workspace","extends":null,"modifications":[]},"reasoningEffort":"medium"}}}
{"type":"expect_outbound","label":"turn/start","frame":{"id":3,"method":"turn/start","params":{"approvalPolicy":"never","input":[{"text":"Run this exact local command: `node -e \"console.log('interrupt fixture tool started'); setTimeout(() => {}, 30000)\"`. Do not answer until it completes, then respond exactly: interrupt fixture should not finish naturally.","type":"text"}],"sandboxPolicy":{"networkAccess":false,"readOnlyAccess":{"type":"fullAccess"},"type":"workspaceWrite","writableRoots":[]},"threadId":"019e03b8-9e5c-7b32-88ab-f742a29b75b8"}}}
{"type":"expect_outbound","label":"turn/start","frame":{"id":3,"method":"turn/start","params":{"approvalPolicy":"never","input":[{"text":"Run this exact local command: `node -e \"console.log('interrupt fixture tool started'); setTimeout(() => {}, 30000)\"`. Do not answer until it completes, then respond exactly: interrupt fixture should not finish naturally.","type":"text"}],"sandboxPolicy":{"networkAccess":false,"type":"workspaceWrite","writableRoots":[]},"threadId":"019e03b8-9e5c-7b32-88ab-f742a29b75b8"}}}
{"type":"emit_inbound","label":"thread/started","frame":{"method":"thread/started","params":{"thread":{"id":"019e03b8-9e5c-7b32-88ab-f742a29b75b8","forkedFromId":null,"preview":"","ephemeral":false,"modelProvider":"openai","createdAt":1778178891,"updatedAt":1778178891,"status":{"type":"idle"},"path":"/Users/julius/.codex_p/sessions/2026/05/07/rollout-2026-05-07T11-34-51-019e03b8-9e5c-7b32-88ab-f742a29b75b8.jsonl","cwd":"/Users/julius/.t3/worktrees/codething-mvp/t3code-c1e5e1d1/apps/server","cliVersion":"0.128.0","source":"vscode","agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"turns":[]}}}}
{"type":"emit_inbound","label":"deprecationNotice","frame":{"method":"deprecationNotice","params":{"summary":"`[features].collab` is deprecated. Use `[features].multi_agent` instead.","details":"Enable it with `--enable multi_agent` or `[features].multi_agent` in config.toml. See https://developers.openai.com/codex/config-basic#feature-flags for details."}}}
{"type":"emit_inbound","label":"warning","frame":{"method":"warning","params":{"threadId":"019e03b8-9e5c-7b32-88ab-f742a29b75b8","message":"Under-development features enabled: apply_patch_freeform. Under-development features are incomplete and may behave unpredictably. To suppress this warning, set `suppress_unstable_features_warning = true` in /Users/julius/.codex_p/config.toml."}}}
+18 -2
View File
@@ -38,7 +38,15 @@ import Migration0022 from "./Migrations/022_AuthSessionLastConnectedAt.ts";
import Migration0023 from "./Migrations/023_ProjectionThreadShellSummary.ts";
import Migration0024 from "./Migrations/024_BackfillProjectionThreadShellSummary.ts";
import Migration0025 from "./Migrations/025_CleanupInvalidProjectionPendingApprovals.ts";
import Migration0026 from "./Migrations/026_OrchestrationV2.ts";
import Migration0026 from "./Migrations/026_CanonicalizeModelSelectionOptions.ts";
import Migration0027 from "./Migrations/027_ProviderSessionRuntimeInstanceId.ts";
import Migration0028 from "./Migrations/028_ProjectionThreadSessionInstanceId.ts";
import Migration0029 from "./Migrations/029_ProjectionThreadDetailOrderingIndexes.ts";
import Migration0030 from "./Migrations/030_ProjectionThreadShellArchiveIndexes.ts";
import Migration0031 from "./Migrations/031_AuthAuthorizationScopes.ts";
import Migration0032 from "./Migrations/032_AuthPairingProofKeyThumbprint.ts";
import Migration0033 from "./Migrations/033_OrchestrationV2.ts";
import Migration0034 from "./Migrations/034_OrchestrationV2Subagents.ts";
/**
* Migration loader with all migrations defined inline.
@@ -76,7 +84,15 @@ export const migrationEntries = [
[23, "ProjectionThreadShellSummary", Migration0023],
[24, "BackfillProjectionThreadShellSummary", Migration0024],
[25, "CleanupInvalidProjectionPendingApprovals", Migration0025],
[26, "OrchestrationV2", Migration0026],
[26, "CanonicalizeModelSelectionOptions", Migration0026],
[27, "ProviderSessionRuntimeInstanceId", Migration0027],
[28, "ProjectionThreadSessionInstanceId", Migration0028],
[29, "ProjectionThreadDetailOrderingIndexes", Migration0029],
[30, "ProjectionThreadShellArchiveIndexes", Migration0030],
[31, "AuthAuthorizationScopes", Migration0031],
[32, "AuthPairingProofKeyThumbprint", Migration0032],
[33, "OrchestrationV2", Migration0033],
[34, "OrchestrationV2Subagents", Migration0034],
] as const;
export const migrationManifest = migrationEntries.map(([id, name]) => [id, name] as const);
@@ -0,0 +1,28 @@
import * as Effect from "effect/Effect";
import * as SqlClient from "effect/unstable/sql/SqlClient";
export default Effect.gen(function* () {
const sql = yield* SqlClient.SqlClient;
yield* sql`
CREATE TABLE orchestration_v2_projection_subagents (
subagent_id TEXT PRIMARY KEY,
thread_id TEXT NOT NULL,
run_id TEXT,
parent_node_id TEXT NOT NULL,
provider TEXT NOT NULL,
provider_thread_id TEXT,
child_thread_id TEXT,
origin TEXT NOT NULL,
status TEXT NOT NULL,
started_at TEXT,
completed_at TEXT,
updated_at TEXT NOT NULL,
payload_json TEXT NOT NULL
)
`;
yield* sql`CREATE INDEX orchestration_v2_projection_subagents_thread_idx ON orchestration_v2_projection_subagents(thread_id, started_at, subagent_id)`;
yield* sql`CREATE INDEX orchestration_v2_projection_subagents_parent_node_idx ON orchestration_v2_projection_subagents(parent_node_id)`;
yield* sql`CREATE INDEX orchestration_v2_projection_subagents_provider_thread_idx ON orchestration_v2_projection_subagents(provider_thread_id)`;
yield* sql`CREATE INDEX orchestration_v2_projection_subagents_child_thread_idx ON orchestration_v2_projection_subagents(child_thread_id)`;
});
@@ -561,6 +561,11 @@ function applyStreamEventToProjection(
...base,
nodes: upsertProjectionEntity(base.nodes, event.payload),
};
case "subagent.updated":
return {
...base,
subagents: upsertProjectionEntity(base.subagents, event.payload),
};
case "provider-session.updated":
return {
...base,
@@ -745,6 +750,8 @@ function turnItemBody(item: OrchestrationV2TurnItem): string | undefined {
return item.summary;
case "fork":
return `Target thread: ${compactId(item.targetThreadId) ?? item.targetThreadId}`;
case "subagent":
return [item.prompt, item.result].filter(Boolean).join("\n\n");
case "dynamic_tool":
return [item.toolName, stringifyShort(item.output) ?? stringifyShort(item.input)]
.filter(Boolean)
@@ -2699,6 +2706,7 @@ const STANDALONE_CHAT_TYPES = new Set<OrchestrationV2TurnItem["type"]>([
"user_message",
"assistant_message",
"fork",
"subagent",
"run_interrupt_request",
"run_interrupt_result",
"user_input_request",
@@ -3246,6 +3254,13 @@ function workLogRowContent(item: OrchestrationV2TurnItem): WorkLogRowContent {
preview: `→ ${compactId(item.targetThreadId) ?? item.targetThreadId}`,
tone: "muted",
};
case "subagent":
return {
glyph: "↳",
label: item.title ?? "Subagent",
preview: clipOneLine(item.result ?? item.prompt, 120),
tone: item.status === "completed" ? "emerald" : "sky",
};
case "user_message":
case "assistant_message":
case "user_input_request":
@@ -3624,6 +3639,16 @@ function ChatItem(props: {
/>
);
case "subagent":
return (
<ChatSubagentItem
item={item}
timestamp={timestamp}
nowMs={nowMs}
onOpenThread={props.onOpenThread}
/>
);
case "checkpoint":
return (
<ChatSystemDivider
@@ -3683,6 +3708,50 @@ function ChatItem(props: {
}
}
function ChatSubagentItem(props: {
readonly item: Extract<OrchestrationV2TurnItem, { readonly type: "subagent" }>;
readonly timestamp: string | undefined;
readonly nowMs: number;
readonly onOpenThread: (threadId: ThreadId) => void;
}) {
const label = props.item.title ?? "Subagent";
const detail = props.item.result ?? props.item.prompt;
const content = (
<>
<ToolKindPill kind="AGENT" />
<span className="min-w-0 truncate font-medium text-foreground">{label}</span>
<span className="min-w-0 truncate text-muted-foreground">· {clipOneLine(detail, 120)}</span>
</>
);
return (
<ChatBubbleRow side="left">
{props.item.childThreadId === null ? (
<div className="flex min-w-0 max-w-full items-center gap-2 rounded-md border border-border bg-background px-2 py-1 text-xs">
{content}
</div>
) : (
<button
type="button"
onClick={() => {
if (props.item.childThreadId !== null) {
props.onOpenThread(props.item.childThreadId);
}
}}
className="flex min-w-0 max-w-full items-center gap-2 rounded-md border border-border bg-background px-2 py-1 text-left text-xs hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500"
title="Open subagent thread"
>
{content}
</button>
)}
<ChatMeta side="left">
<ChatStatusPill status={props.item.status} />
<ChatClock iso={props.timestamp} nowMs={props.nowMs} />
</ChatMeta>
</ChatBubbleRow>
);
}
function ChatBubbleRow(props: { readonly side: "left" | "right"; readonly children: ReactNode }) {
return (
<div
@@ -23,6 +23,7 @@ import {
OrchestrationV2CheckpointScope,
OrchestrationV2Command,
OrchestrationV2DomainEvent,
OrchestrationV2Subagent,
OrchestrationV2ThreadProjection,
OrchestrationV2TurnItem,
} from "./orchestrationV2.ts";
@@ -210,6 +211,60 @@ describe("orchestration V2 contracts", () => {
expect(dynamicTool.id).toBe(TurnItemId.make("turn-item-dynamic-1"));
});
it("decodes provider-native subagent lifecycle records and timeline items", () => {
const subagent = Schema.decodeUnknownSync(OrchestrationV2Subagent)({
id: "node-subagent-1",
threadId: "thread-1",
runId: "run-1",
parentNodeId: "node-root-1",
origin: "provider_native",
createdBy: "agent",
provider: "codex",
providerThreadId: "provider-thread-subagent-1",
childThreadId: null,
nativeTaskRef: {
provider: "codex",
nativeId: "native-task-1",
strength: "strong",
},
prompt: "Inspect package.json",
title: "Package audit",
model: "gpt-5.4",
status: "completed",
result: "Package is private.",
startedAt: now,
completedAt: now,
updatedAt: now,
});
const turnItem = Schema.decodeUnknownSync(OrchestrationV2TurnItem)({
id: "turn-item-subagent-1",
type: "subagent",
threadId: "thread-1",
runId: "run-1",
nodeId: subagent.id,
providerThreadId: subagent.providerThreadId,
providerTurnId: "provider-turn-1",
nativeItemRef: subagent.nativeTaskRef,
parentItemId: null,
ordinal: 2,
status: "completed",
title: subagent.title,
subagentId: subagent.id,
origin: subagent.origin,
provider: subagent.provider,
childThreadId: subagent.childThreadId,
prompt: subagent.prompt,
result: subagent.result,
startedAt: now,
completedAt: now,
updatedAt: now,
});
expect(subagent.origin).toBe("provider_native");
expect(subagent.childThreadId).toBeNull();
expect(turnItem.type).toBe("subagent");
});
it("decodes thread projections with an ordered turn item rendering stream", () => {
const projection = Schema.decodeUnknownSync(OrchestrationV2ThreadProjection)({
thread: {
@@ -237,6 +292,7 @@ describe("orchestration V2 contracts", () => {
runs: [],
attempts: [],
nodes: [],
subagents: [],
providerSessions: [],
providerThreads: [],
providerTurns: [],
+69
View File
@@ -391,6 +391,36 @@ export const OrchestrationV2ExecutionNode = Schema.Struct({
});
export type OrchestrationV2ExecutionNode = typeof OrchestrationV2ExecutionNode.Type;
export const OrchestrationV2Subagent = Schema.Struct({
id: NodeId,
threadId: ThreadId,
runId: Schema.NullOr(RunId),
parentNodeId: NodeId,
origin: Schema.Literals(["provider_native", "app_owned"]),
createdBy: Schema.Literals(["agent", "user", "system"]),
provider: ProviderKind,
providerThreadId: Schema.NullOr(ProviderThreadId),
childThreadId: Schema.NullOr(ThreadId),
nativeTaskRef: Schema.NullOr(OrchestrationV2ProviderRef),
prompt: Schema.String,
title: Schema.NullOr(Schema.String),
model: Schema.NullOr(Schema.String),
status: Schema.Literals([
"pending",
"running",
"waiting",
"completed",
"failed",
"cancelled",
"interrupted",
]),
result: Schema.NullOr(Schema.String),
startedAt: Schema.NullOr(Schema.DateTimeUtc),
completedAt: Schema.NullOr(Schema.DateTimeUtc),
updatedAt: Schema.DateTimeUtc,
});
export type OrchestrationV2Subagent = typeof OrchestrationV2Subagent.Type;
export const OrchestrationV2CheckpointScope = Schema.Struct({
id: CheckpointScopeId,
threadId: ThreadId,
@@ -777,6 +807,16 @@ export const OrchestrationV2TurnItem = Schema.Union([
targetThreadId: ThreadId,
providerThreadId: Schema.optional(ProviderThreadId),
}),
Schema.Struct({
...OrchestrationV2TurnItemBaseFields,
type: Schema.Literal("subagent"),
subagentId: NodeId,
origin: Schema.Literals(["provider_native", "app_owned"]),
provider: ProviderKind,
childThreadId: Schema.NullOr(ThreadId),
prompt: Schema.String,
result: Schema.NullOr(Schema.String),
}),
Schema.Struct({
...OrchestrationV2TurnItemBaseFields,
type: Schema.Literal("dynamic_tool"),
@@ -851,6 +891,11 @@ export const OrchestrationV2DomainEvent = Schema.Union([
type: Schema.Literal("node.updated"),
payload: OrchestrationV2ExecutionNode,
}),
Schema.Struct({
...OrchestrationV2EventBase.fields,
type: Schema.Literal("subagent.updated"),
payload: OrchestrationV2Subagent,
}),
Schema.Struct({
...OrchestrationV2EventBase.fields,
type: Schema.Literal("provider-session.updated"),
@@ -919,6 +964,7 @@ export const OrchestrationV2ThreadProjection = Schema.Struct({
runs: Schema.Array(OrchestrationV2Run),
attempts: Schema.Array(OrchestrationV2RunAttempt),
nodes: Schema.Array(OrchestrationV2ExecutionNode),
subagents: Schema.Array(OrchestrationV2Subagent),
providerSessions: Schema.Array(OrchestrationV2ProviderSession),
providerThreads: Schema.Array(OrchestrationV2ProviderThread),
providerTurns: Schema.Array(OrchestrationV2ProviderTurn),
@@ -1018,6 +1064,14 @@ export const OrchestrationV2ExecutionNodeJson = OrchestrationV2ExecutionNode.map
);
export type OrchestrationV2ExecutionNodeJson = typeof OrchestrationV2ExecutionNodeJson.Type;
export const OrchestrationV2SubagentJson = OrchestrationV2Subagent.mapFields((fields) => ({
...fields,
startedAt: Schema.NullOr(Schema.DateTimeUtcFromString),
completedAt: Schema.NullOr(Schema.DateTimeUtcFromString),
updatedAt: Schema.DateTimeUtcFromString,
}));
export type OrchestrationV2SubagentJson = typeof OrchestrationV2SubagentJson.Type;
export const OrchestrationV2CheckpointScopeJson = OrchestrationV2CheckpointScope.mapFields(
(fields) => ({
...fields,
@@ -1237,6 +1291,16 @@ export const OrchestrationV2TurnItemJson = Schema.Union([
targetThreadId: ThreadId,
providerThreadId: Schema.optional(ProviderThreadId),
}),
Schema.Struct({
...OrchestrationV2TurnItemJsonBaseFields,
type: Schema.Literal("subagent"),
subagentId: NodeId,
origin: Schema.Literals(["provider_native", "app_owned"]),
provider: ProviderKind,
childThreadId: Schema.NullOr(ThreadId),
prompt: Schema.String,
result: Schema.NullOr(Schema.String),
}),
Schema.Struct({
...OrchestrationV2TurnItemJsonBaseFields,
type: Schema.Literal("dynamic_tool"),
@@ -1291,6 +1355,11 @@ export const OrchestrationV2DomainEventJson = Schema.Union([
type: Schema.Literal("node.updated"),
payload: OrchestrationV2ExecutionNodeJson,
}),
Schema.Struct({
...OrchestrationV2JsonEventBaseFields,
type: Schema.Literal("subagent.updated"),
payload: OrchestrationV2SubagentJson,
}),
Schema.Struct({
...OrchestrationV2JsonEventBaseFields,
type: Schema.Literal("provider-session.updated"),