@devries-cameron20 / t3code-1 / commits / ef515949d0
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(server): native Codex subagents no longer show the parent's reasoning effort (#24467)

Co-authored-by: maria-rcks <maria@kuuro.net>

Koushik_xd committed Oct 29, 2026 at 23:32 UTC ef515949d0c1914a29a279ada1a45002f94601ed
2 files changed +113 -5
apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.test.ts
+105 -1
@@ -16,6 +16,7 @@ import {
16 type OrchestrationV2ProviderThread,
17 type OrchestrationV2ProviderTurn,
18 type OrchestrationV2RuntimeRequest,
19 + type OrchestrationV2Subagent,
20 type OrchestrationV2TurnItem,
21 ProjectId,
22 type ProviderApprovalDecision,
@@ -566,6 +567,7 @@ function codexReplayPreamble(input: {
567 readonly nativeTurnId: string;
568 readonly prompt: string;
569 readonly sentPrompt?: string;
570 + readonly effort?: string;
571 }): Array<CodexReplay.CodexAppServerReplayEntry> {
572 return [
573 {
@@ -664,7 +666,14 @@ function codexReplayPreamble(input: {
666 approvalsReviewer: "user",
667 sandboxPolicy: { type: "dangerFullAccess" },
668 summary: "detailed",
667 - collaborationMode: { mode: "default", settings: { model: "gpt-5.4" } },
669 + ...(input.effort === undefined ? {} : { effort: input.effort }),
670 + collaborationMode: {
671 + mode: "default",
672 + settings: {
673 + model: "gpt-5.4",
674 + ...(input.effort === undefined ? {} : { reasoning_effort: input.effort }),
675 + },
676 + },
677 },
678 },
679 },
@@ -6211,6 +6220,101 @@ describe("CodexAdapterV2 post-settle continuation", () => {
6220 ),
6221 );
6222
6223 + it.effect.each(["activity", "spawn", "activity then spawn"] as const)(
6224 + "creates a child from %s without the parent's effort",
6225 + (source) =>
6226 + Effect.scoped(
6227 + Effect.gen(function* () {
6228 + const created = yield* Deferred.make<OrchestrationV2AppThread>();
6229 + const completed = yield* Deferred.make<OrchestrationV2Subagent>();
6230 + const activity = {
6231 + type: "subAgentActivity",
6232 + id: "call-codex-resume-spawn",
6233 + kind: "started",
6234 + agentThreadId: RESUME_CHILD_THREAD,
6235 + agentPath: "/root/resume_agent",
6236 + };
6237 + const spawn = {
6238 + type: "collabAgentToolCall",
6239 + id: "call-codex-resume-spawn",
6240 + tool: "spawnAgent",
6241 + status: "completed",
6242 + senderThreadId: RESUME_NATIVE_THREAD,
6243 + receiverThreadIds: [RESUME_CHILD_THREAD],
6244 + model: "gpt-5.4",
6245 + reasoningEffort: "high",
6246 + agentsStates: { [RESUME_CHILD_THREAD]: { status: "completed", message: "finished" } },
6247 + };
6248 + const items =
6249 + source === "activity" ? [activity] : source === "spawn" ? [spawn] : [activity, spawn];
6250 + const harness = yield* makeCodexReplayHarness(
6251 + makeCodexReplayTranscript({
6252 + scenario: RESUME_SCENARIO,
6253 + entries: [
6254 + ...codexReplayPreamble({
6255 + nativeThreadId: RESUME_NATIVE_THREAD,
6256 + nativeTurnId: RESUME_NATIVE_TURN,
6257 + prompt: RESUME_PROMPT,
6258 + effort: "low",
6259 + }),
6260 + ...items.map((item) => ({
6261 + type: "emit_inbound" as const,
6262 + frame: {
6263 + method: "item/completed",
6264 + params: {
6265 + item,
6266 + threadId: RESUME_NATIVE_THREAD,
6267 + turnId: RESUME_NATIVE_TURN,
6268 + completedAtMs: 1782622441000,
6269 + },
6270 + },
6271 + })),
6272 + ],
6273 + }),
6274 + (event) =>
6275 + event.type === "app_thread.created"
6276 + ? Deferred.succeed(created, event.appThread)
6277 + : event.type === "subagent.updated" && event.subagent.status === "completed"
6278 + ? Deferred.succeed(completed, event.subagent)
6279 + : Effect.void,
6280 + );
6281 + yield* harness.runtime.startTurn({
6282 + ...makeCodexTestTurnInput({
6283 + threadId: harness.threadId,
6284 + providerThread: harness.providerThread,
6285 + now: yield* DateTime.now,
6286 + attemptId: RunAttemptId.make("attempt-child-effort"),
6287 + text: RESUME_PROMPT,
6288 + }),
6289 + modelSelection: {
6290 + ...CODEX_TEST_MODEL_SELECTION,
6291 + options: [{ id: "reasoningEffort", value: "low" }],
6292 + },
6293 + });
6294 + const child = yield* Deferred.await(created);
6295 + assert.equal(
6296 + child.modelSelection.options?.find(({ id }) => id === "reasoningEffort")?.value,
6297 + source === "spawn" ? "high" : undefined,
6298 + );
6299 + if (source !== "activity") {
6300 + const task = yield* Deferred.await(completed);
6301 + assert.equal(
6302 + task.modelSelection?.options?.find(({ id }) => id === "reasoningEffort")?.value,
6303 + "high",
6304 + );
6305 + assert.lengthOf(
6306 + harness.events.filter((event) => event.type === "app_thread.created"),
6307 + 1,
6308 + );
6309 + }
6310 + }).pipe(
6311 + Effect.provide(
6312 + Layer.mergeAll(IdAllocator.layer, McpProviderSessions.layer, NodeServices.layer),
6313 + ),
6314 + ),
6315 + ),
6316 + );
6317 +
6318 it.effect("preserves a subagent result across a trailing empty final and resume", () =>
6319 Effect.scoped(
6320 Effect.gen(function* () {
apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts
+8 -4
@@ -2717,9 +2717,6 @@ export const makeCodexAdapterV2 = Effect.fn("makeCodexAdapterV2")(function* (
2717 readonly emitInitialPrompt: boolean;
2718 }) {
2719 const registeredSubagents = yield* Ref.get(subagentThreads);
2720 - if (registeredSubagents.has(input.nativeThreadId)) {
2721 - return;
2722 - }
2720 if (input.model && !subagentSelections.has(input.nativeThreadId)) {
2721 yield* updateSubagentSelection(
2722 input.nativeThreadId,
@@ -2727,6 +2724,9 @@ export const makeCodexAdapterV2 = Effect.fn("makeCodexAdapterV2")(function* (
2724 input.reasoningEffort,
2725 );
2726 }
2727 + if (registeredSubagents.has(input.nativeThreadId)) {
2728 + return;
2729 + }
2730
2731 const now = yield* DateTime.now;
2732 const subagentNodeId = idAllocator.derive.nodeFromProviderItem({
@@ -2803,9 +2803,13 @@ export const makeCodexAdapterV2 = Effect.fn("makeCodexAdapterV2")(function* (
2803 parentNodeId: subagentNodeId,
2804 activeProviderThreadId: providerThread.id,
2805 providerInstanceId: input.context.input.modelSelection.instanceId,
2806 - modelSelection: {
2806 + // A child's effort can differ from the parent's. Until Codex reports it, show none.
2807 + modelSelection: task.modelSelection ?? {
2808 ...input.context.input.modelSelection,
2809 model: task.model ?? input.context.input.modelSelection.model,
2810 + options: (input.context.input.modelSelection.options ?? []).filter(
2811 + ({ id }) => id !== "reasoningEffort",
2812 + ),
2813 },
2814 title: subagentThreadTitle({
2815 parentTitle: input.context.projectionAppThread.title,