Skip to content

fix(codex): surface native subagent task updates#96662

Open
outdog-hwh wants to merge 6 commits into
openclaw:mainfrom
outdog-hwh:fix/codex-native-subagent-visibility-87666
Open

fix(codex): surface native subagent task updates#96662
outdog-hwh wants to merge 6 commits into
openclaw:mainfrom
outdog-hwh:fix/codex-native-subagent-visibility-87666

Conversation

@outdog-hwh

@outdog-hwh outdog-hwh commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where operators using channel-backed Codex multi-agent runs could not see native subagent lifecycle updates when a Codex native subagent was spawned. The mirrored task rows could still fall back to silent / not_applicable on direct embedded paths even when the parent run had a real channel target.

Fixes #87666.

Why This Change Was Made

Native Codex subagent mirror rows already derive direct-delivery behavior from requesterOrigin. This follow-up closes the remaining propagation gap by deriving the harness task runtime requesterOrigin from explicit embedded-run delivery fields when callers provide messageChannel / messageTo / agentAccountId / messageThreadId but omit the new field. Explicit requesterOrigin still wins unchanged.

That keeps gateway/user paths stable while covering direct embedded cron-style runs that were still creating quiet mirror rows. I also re-checked the sibling Codex runtime before changing behavior: codex-rs/app-server-protocol/schema/typescript/v2/ThreadItem.ts includes subAgentActivity, and OpenClaw's native subagent mirror still sits on top of app-server thread lifecycle and progress notifications rather than inventing a parallel Codex contract.

User Impact

Operators on channel-backed parent Codex runs can receive native subagent task state changes instead of having mirror tasks hidden by silent / not_applicable when the embedded run already knows the real requester route. Internal or orphan native subagent mirrors remain quiet.

Evidence

  • node scripts/run-vitest.mjs run --config test/vitest/vitest.agents-embedded-agent.config.ts src/agents/embedded-agent-runner/run.before-agent-reply-cron.test.ts --reporter=verbose
  • node scripts/run-vitest.mjs run --config test/vitest/vitest.plugin-sdk.config.ts src/plugin-sdk/agent-harness-task-runtime.test.ts --reporter=verbose
  • node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.test.src.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/test-src-87666.tsbuildinfo
  • git diff --check

Not run: live channel proof. This still needs a configured channel/gateway environment and maintainer confirmation of the chosen delivery behavior.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime agents Agent runtime and tooling extensions: codex size: M triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Jun 25, 2026
@clawsweeper

clawsweeper Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Codex review: stale review; fresh review needed.

Summary
The latest durable ClawSweeper review was for head d7592d045133cf090a3563e2e05dcdc07294c5b8, but the PR head is now 17bbea93b5398c3024ecc29edb0fe8867af08f5c. Its old verdict and PR readiness labels are no longer current.

Next step
Run or wait for a fresh ClawSweeper review on the current PR head.

Review history (1 earlier review cycle)
  • reviewed 2026-06-25T05:17:07.829Z sha d7592d0 :: needs real behavior proof before merge. :: [P2] Propagate requester origins for direct embedded runs

@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Jun 25, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. labels Jun 25, 2026
@outdog-hwh

Copy link
Copy Markdown
Contributor Author

Maintainer note for #87666 channel proof:

I verified the code path with focused tests and tsgo:test:src, and the PR body evidence check is now passing. The remaining stronger proof for this issue is a channel-visible run: a parent Codex run with a real requester channel should spawn a native Codex subagent and surface the mirrored task as state_changes / pending, then deliver completion back to the requester.

I do not have the repository channel secrets or a configured live Telegram/Discord gateway in this fork environment. Please either:

  • trigger the repository Mantis Telegram Desktop Proof workflow for PR fix(codex): surface native subagent task updates #96662, or
  • add the mantis: telegram-visible-proof label if that is the preferred maintained path, or
  • confirm that the existing live Codex harness native-subagent delivery proof is sufficient for this behavior choice.

The relevant local evidence already run:

  • node scripts/run-vitest.mjs extensions/codex/src/app-server/native-subagent-task-mirror.test.ts extensions/codex/src/app-server/native-subagent-monitor.test.ts (51 tests passed)
  • node scripts/run-vitest.mjs src/plugin-sdk/agent-harness-task-runtime.test.ts src/tasks/task-executor-policy.test.ts src/tasks/task-registry.test.ts (95 tests passed)
  • npm run tsgo:test:src
  • git diff --check

@outdog-hwh
outdog-hwh marked this pull request as ready for review June 25, 2026 04:23
@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@clawsweeper clawsweeper Bot added the mantis: telegram-visible-proof Mantis should capture Telegram visible proof. label Jun 25, 2026
@outdog-hwh

Copy link
Copy Markdown
Contributor Author

Addressed the ClawSweeper finding about state_changes requiring event-backed task updates.

Follow-up commit d7592d04 now records eventSummary for native Codex subagent started/spawned/active/idle/not-loaded/running/expected-completed progress updates, and the focused mirror tests assert event-backed updates on both requester-origin creation paths.

Re-run locally after the follow-up:

  • node scripts/run-vitest.mjs extensions/codex/src/app-server/native-subagent-task-mirror.test.ts extensions/codex/src/app-server/native-subagent-monitor.test.ts (51 passed)
  • node scripts/run-vitest.mjs src/plugin-sdk/agent-harness-task-runtime.test.ts src/tasks/task-executor-policy.test.ts src/tasks/task-registry.test.ts (95 passed)
  • npm run tsgo:test:src
  • git diff --check

The previous Mantis run failed because both baseline and candidate were skipped: Mantis could not capture Telegram Desktop proof because this change needs a Codex native subagent run to show the chat-visible task update. After this eventSummary fix, please re-review and rerun the Telegram-visible proof if the live channel proof is still required.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@outdog-hwh

Copy link
Copy Markdown
Contributor Author

CI note: the current Scan changed paths (precise) failure is an OpenGrep setup/download failure, not a rule finding from this PR.

The failed step is Install opengrep:

Error: Failed to fetch available versions from GitHub.

The subsequent SARIF upload failed only because the scan never produced .opengrep-out/precise.sarif. I attempted gh run rerun 28148034946 --failed, but GitHub rejected it because rerunning this workflow requires repository admin rights.

Please rerun the failed OpenGrep job/run when convenient.

@outdog-hwh

Copy link
Copy Markdown
Contributor Author

Addressed ClawSweeper's [P2] propagation gap in follow-up commit 1bc06d51.

This change keeps explicit requesterOrigin precedence, but now derives the harness task runtime origin from direct embedded delivery fields when callers only provide:

  • messageChannel
  • messageTo
  • agentAccountId
  • messageThreadId

That closes the quiet direct-embedded path called out in src/agents/embedded-agent-runner/run.ts without changing the existing gateway/user path.

Re-run locally after the follow-up:

  • node scripts/run-vitest.mjs run --config test/vitest/vitest.agents-embedded-agent.config.ts src/agents/embedded-agent-runner/run.before-agent-reply-cron.test.ts --reporter=verbose
  • node scripts/run-vitest.mjs run --config test/vitest/vitest.plugin-sdk.config.ts src/plugin-sdk/agent-harness-task-runtime.test.ts --reporter=verbose
  • node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.test.src.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/test-src-87666.tsbuildinfo
  • git diff --check

Live channel proof is still pending on maintainer infrastructure.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added status: 🔁 re-review loop A fresh ClawSweeper review was explicitly requested after the latest review. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. mantis: telegram-visible-proof Mantis should capture Telegram visible proof. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. status: 🔁 re-review loop A fresh ClawSweeper review was explicitly requested after the latest review. labels Jul 2, 2026
@barnacle-openclaw

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@barnacle-openclaw barnacle-openclaw Bot added the stale Marked as stale due to inactivity label Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling extensions: codex gateway Gateway runtime P2 Normal backlog priority with limited blast radius. size: M stale Marked as stale due to inactivity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[@openclaw/codex] Native subagent mirror tasks are silent and not_applicable — operators can't see codex multi-agent activity

1 participant