openclaw - 💡(How to fix) Fix [@openclaw/codex] Native subagent mirror tasks are silent and not_applicable — operators can't see codex multi-agent activity

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Root Cause

@openclaw/codex/dist/run-attempt-D8Vxo-Jm.js (likely source: extensions/codex/src/app-server/native-subagent-task-mirror.ts) hardcodes both notifyPolicy: "silent" and deliveryStatus: "not_applicable" at the two mirror-task creation sites:

  1. handleThreadStarted — fired when codex notifies thread/started (anchor: progressSummary: "Codex native subagent started.").
  2. createTaskFromCollabSpawnItem — fired when codex emits a collab_agent spawn item (anchor: progressSummary: "Codex native subagent spawned.").

Both call this.runtime.createRunningTaskRun({ … notifyPolicy: "silent", deliveryStatus: "not_applicable", … }).

With deliveryStatus: "not_applicable", shouldAutoDeliverTaskTerminalUpdate (in core task-registry-CU9A1ECz.js:83-87) returns false; with notifyPolicy: "silent", shouldAutoDeliverTaskStateChange (:89-91) also returns false. The mirror tasks exist in openclaw tasks list but never deliver events.

Fix Action

Fix / Workaround

  • Discord-originated parent: native subagent start/active/finished events now flow to the channel. This is the user-visible goal.
  • CLI/MC parent: events flow to whatever the session's delivery destination is. Probably fine — CLI/MC users are engaged and benefit from visibility.
  • No delivery destination: events are emitted but dropped. No-op.
  • Cron parent: cron explicitly sets notifyPolicy: "silent" on its top-level task, but the codex mirror is a SEPARATE task with silent overridden by this patch — events would flow to cron's destination (e.g. Discord channel for the cron job). May surface unexpected codex internals to cron destinations; if so, add a kind check or gate by parent's notifyPolicy.

Companion: #87665 — fixes the core-side done_only default for Discord-origin parent tasks. Both patches together give full Discord visibility: parent visibility (#87665) + child native-subagent visibility (this).

Workaround until merged

Code Example

const parentContext = runtime.getDeliveryContextForCurrentAgent();
const visibleToOperator = parentContext?.channel != null;
this.runtime.createRunningTaskRun({
    // …
    notifyPolicy: visibleToOperator ? "state_changes" : "silent",
    deliveryStatus: visibleToOperator ? "pending" : "not_applicable",
    // …
});

---

this.runtime.createRunningTaskRun({
     sourceId: runId,
     agentId: this.params.agentId,
     runId,
     label,
     task,
-    notifyPolicy: "silent",
-    deliveryStatus: "not_applicable",
+    notifyPolicy: "state_changes",
+    deliveryStatus: "pending",
     preferMetadata: true,
     startedAt: createdAt,
     lastEventAt: this.now(),
     progressSummary: "Codex native subagent started."
 });
RAW_BUFFERClick to expand / collapse

Symptom

When a Codex agent uses native multi-agent threads (codex's own internal subagent feature), the corresponding CodexNativeSubagentTaskMirror creates mirror tasks but they never surface to the operator's delivery channel. The result: the operator sees the parent agent's tool calls, but a long-running native subagent thread runs silently in the background with no indication it exists, what it's doing, or when it finishes.

Root cause

@openclaw/codex/dist/run-attempt-D8Vxo-Jm.js (likely source: extensions/codex/src/app-server/native-subagent-task-mirror.ts) hardcodes both notifyPolicy: "silent" and deliveryStatus: "not_applicable" at the two mirror-task creation sites:

  1. handleThreadStarted — fired when codex notifies thread/started (anchor: progressSummary: "Codex native subagent started.").
  2. createTaskFromCollabSpawnItem — fired when codex emits a collab_agent spawn item (anchor: progressSummary: "Codex native subagent spawned.").

Both call this.runtime.createRunningTaskRun({ … notifyPolicy: "silent", deliveryStatus: "not_applicable", … }).

With deliveryStatus: "not_applicable", shouldAutoDeliverTaskTerminalUpdate (in core task-registry-CU9A1ECz.js:83-87) returns false; with notifyPolicy: "silent", shouldAutoDeliverTaskStateChange (:89-91) also returns false. The mirror tasks exist in openclaw tasks list but never deliver events.

Proposed fix

Either:

A. Pass-through parent visibility (preferred). The codex runtime interface doesn't currently expose the parent task's requesterOrigin to the mirror — adding a getter (runtime.getDeliveryContextForCurrentAgent() or similar) would let the mirror set the policy based on whether the parent is human-facing:

const parentContext = runtime.getDeliveryContextForCurrentAgent();
const visibleToOperator = parentContext?.channel != null;
this.runtime.createRunningTaskRun({
    // …
    notifyPolicy: visibleToOperator ? "state_changes" : "silent",
    deliveryStatus: visibleToOperator ? "pending" : "not_applicable",
    // …
});

B. Unconditional flip. Simpler: codex always emits visible events; the core's delivery routing naturally drops them when there's no destination (no requesterOrigin on the owning flow/session):

 this.runtime.createRunningTaskRun({
     sourceId: runId,
     agentId: this.params.agentId,
     runId,
     label,
     task,
-    notifyPolicy: "silent",
-    deliveryStatus: "not_applicable",
+    notifyPolicy: "state_changes",
+    deliveryStatus: "pending",
     preferMetadata: true,
     startedAt: createdAt,
     lastEventAt: this.now(),
     progressSummary: "Codex native subagent started."
 });

Apply the same to the createTaskFromCollabSpawnItem site (anchor: progressSummary: "Codex native subagent spawned.").

Side-effect surface

  • Discord-originated parent: native subagent start/active/finished events now flow to the channel. This is the user-visible goal.
  • CLI/MC parent: events flow to whatever the session's delivery destination is. Probably fine — CLI/MC users are engaged and benefit from visibility.
  • No delivery destination: events are emitted but dropped. No-op.
  • Cron parent: cron explicitly sets notifyPolicy: "silent" on its top-level task, but the codex mirror is a SEPARATE task with silent overridden by this patch — events would flow to cron's destination (e.g. Discord channel for the cron job). May surface unexpected codex internals to cron destinations; if so, add a kind check or gate by parent's notifyPolicy.

Companion issue

Companion: #87665 — fixes the core-side done_only default for Discord-origin parent tasks. Both patches together give full Discord visibility: parent visibility (#87665) + child native-subagent visibility (this).

Workaround until merged

Local content-anchored patch to run-attempt-D8Vxo-Jm.js applying the diff above (or the equivalent in source).


Environment: macOS, OpenClaw 2026.5.26, @openclaw/codex 2026.5.26, node 22.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING