Skip to content

Mirror Codex native subagents into task registry#79512

Merged
mbelinky merged 12 commits into
mainfrom
codex-native-subagent-task-registry
May 11, 2026
Merged

Mirror Codex native subagents into task registry#79512
mbelinky merged 12 commits into
mainfrom
codex-native-subagent-task-registry

Conversation

@mbelinky

@mbelinky mbelinky commented May 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Mirror Codex app-server native subagent lifecycle events into Task Registry as silent subagent / codex-native tasks.
  • Capture both structured thread/started / thread/status/changed events and live collabAgentToolCall state from native spawnAgent / wait items.
  • Keep Codex thread identity in runId / sourceId (codex-thread:<threadId>) and deliberately leave childSessionKey unset so OpenClaw task maintenance/cancellation does not treat native Codex threads as OpenClaw-managed child sessions.
  • Keep the detached task mutation helpers off the public agent-harness-runtime SDK surface by routing the bundled Codex plugin through a private local-only openclaw/plugin-sdk/codex-native-task-runtime subpath, include that private helper in the build output, and allow that specific non-QA private helper only for bundled Codex alias resolution.

Current-head proof

Current PR head: 75bc96ad74ba6c082e933aae0f372fd1cb76f19c.

  • Rebased onto current origin/main at validation time: d0edacad5be774d6f26963148a34a7f05ac71cf8.
  • Wrapper prep gates: changelog validation passed; pnpm build passed; pnpm check passed.
  • Wrapper broad pnpm test did not pass on local maintainer hardware. The failures were in files outside this PR's diff, including src/agents/*, extensions/telegram/*, extensions/nvidia/*, extensions/openrouter/*, and extensions/mattermost/*. The Codex app-server failures emitted in the broad run passed when rerun directly, so this is being treated as broad-suite/baseline noise rather than a PR blocker.
  • Local focused regression tests on current head: pnpm --config.verify-deps-before-run=false test src/plugins/sdk-alias.test.ts src/plugins/contracts/plugin-sdk-root-alias.test.ts extensions/codex/src/app-server/native-subagent-task-mirror.test.ts extensions/codex/src/app-server/event-projector.test.ts extensions/codex/src/app-server/run-attempt.test.ts extensions/codex/src/app-server/run-attempt.context-engine.test.ts extensions/codex/src/app-server/auth-profile-runtime-contract.test.ts src/tasks/detached-task-runtime.test.ts - passed, 232 tests.
  • Local formatting and SDK checks on current head: pnpm --config.verify-deps-before-run=false exec oxfmt --check --threads=1 ..., node scripts/check-plugin-sdk-subpath-exports.mjs, node scripts/check-extension-plugin-sdk-boundary.mjs src-outside-plugin-sdk, node scripts/check-extension-plugin-sdk-boundary.mjs plugin-sdk-internal, pnpm --config.verify-deps-before-run=false plugin-sdk:api:check, and git diff --check origin/main...HEAD - passed.
  • Scope check on current head: PR diff contains no .github/workflows/*, live Docker harness, Testbox, or validation-tooling changes. Tooling stays private to maintainer validation.

Real behavior proof

  • Behavior addressed: Codex app-server native subagents appear in Task Registry as silent subagent / codex-native rows instead of only existing in Codex session/transcript surfaces.
  • Real environment tested: real jpclawhq main OpenClaw gateway checkout at /srv/openclaw/main. No Testbox/workflow/tooling changes are part of this PR.
  • Exact steps or command run after this patch: deployed this branch's runtime patch to /srv/openclaw/main, ran pnpm build, restarted with sudo systemctl restart openclaw-gateway, checked sudo openclaw-runtime-status, checked /usr/local/bin/openclaw-main nodes status --json, then inspected Task Registry rows for Codex-native subagent records after a live Codex app-server native subagent run. The final current head only narrows the private helper alias to bundled Codex and refreshes generated SDK baseline hash; the Task Registry mirror behavior covered by this gateway proof is unchanged from that live run.
  • Evidence after fix: terminal output from the real gateway run plus current-head local focused test output covering the alias-scope tightening.
$ sudo -u openclaw -H bash -c 'cd /srv/openclaw/main && pnpm build'
...
OK: All 4 required plugin-sdk exports verified.

$ sudo systemctl restart openclaw-gateway
$ sudo openclaw-runtime-status
gateway_service=active
gateway_exec={ path=/usr/local/bin/openclaw-main ; argv[]=/usr/local/bin/openclaw-main gateway run --bind loopback --port 18789 --force ; ... ; status=0/0 }
main_version=OpenClaw 2026.5.6 (ea45b72)

$ /usr/local/bin/openclaw-main nodes status --json
{ "ts": "2026-05-08T...", "nodes": [ ... ] }

$ openclaw-main tasks list --runtime subagent --json | jq -c '.tasks[]? | select(.taskKind=="codex-native") | {runtime,taskKind,status,runId,label,terminalSummary,deliveryStatus,notifyPolicy}'
{"runtime":"subagent","taskKind":"codex-native","status":"succeeded","runId":"codex-thread:019e0940-178d-7442-bdee-7081e799996c","label":"Codex subagent","terminalSummary":"Implemented scripts/find-madrid-wine-restaurants.py ... sample output Wine Bar La Fisna scored 85 ...","deliveryStatus":"not_applicable","notifyPolicy":"silent"}
  • Observed result after fix: the live gateway stayed active after restart, node status returned JSON from the running main service, and the live Codex app-server run produced silent Task Registry rows with runtime=subagent, taskKind=codex-native, and terminal succeeded status for native subagent spawns.
  • What was not tested: local broad pnpm test remains red in unrelated/baseline areas. A fresh final-head Testbox packaging/import proof was queued for about ten minutes and stopped because capacity did not clear; no active Testboxes remain.

Maintainer flow checks

  • Latest release branch observed: release/2026.5.10.
  • Release relevance: likely release-line relevant if maintainers want native Codex subagent visibility before switching back to releasing from main.
  • Review attention: this touches a Plugin SDK-adjacent private local-only route for bundled Codex. The current patch avoids a public SDK export and scopes the private alias to bundled Codex.
  • Plugin ecosystem proof: focused SDK subpath/export checks, package contract guardrails, resolver tests, and Codex mirror tests passed; broader plugin-inspector/kitchen-sink/crabbot proof was not run because this is a private local-only bundled-plugin route, not a new public plugin API.

@clawsweeper

clawsweeper Bot commented May 8, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

Summary
The PR mirrors Codex app-server native subagent lifecycle events into silent subagent/codex-native Task Registry rows and adds a private bundled-Codex SDK helper plus focused tests.

Reproducibility: not applicable. as an end-user bug report; this is a feature PR. The behavior is source-reviewable in the mirror and alias code, and the PR body includes terminal proof from a real gateway producing a codex-native Task Registry row.

Real behavior proof
Sufficient (terminal): The PR body includes terminal output from a real gateway run showing a silent runtime=subagent, taskKind=codex-native Task Registry row after a native Codex subagent run.

Next step before merge
Maintainers should explicitly approve or reject the private bundled-Codex task-runtime seam; there is no narrow automated repair to queue from this review.

Security
Cleared: No concrete security or supply-chain regression was found; the diff adds no workflows, dependencies, lockfile changes, or external downloads, and the sensitive helper is scoped to bundled Codex.

Review details

Best possible solution:

Land a maintainer-approved version that keeps task mutation private to bundled Codex, preserves the no-childSessionKey contract, and validates the focused SDK/task/Codex checks plus release-line proof if maintainers need it.

Do we have a high-confidence way to reproduce the issue?

Not applicable as an end-user bug report; this is a feature PR. The behavior is source-reviewable in the mirror and alias code, and the PR body includes terminal proof from a real gateway producing a codex-native Task Registry row.

Is this the best way to solve the issue?

Mostly yes, subject to maintainer approval. The branch keeps task mutation helpers out of the public SDK and scopes the private alias to bundled Codex, which is narrower than a public SDK seam unless external plugins need this capability.

What I checked:

  • Live PR state: GitHub API shows the PR is open, ready for review, labeled maintainer and proof: sufficient, with head 75bc96ad74ba6c082e933aae0f372fd1cb76f19c. (75bc96ad74ba)
  • Current main does not already implement the mirror: Current main has no CodexNativeSubagentTaskMirror, codex-native, or codex-native-task-runtime matches in the Codex event projector or SDK alias path, and the private helper file returns 404 at the current-main SHA. (7ee8e0b64188)
  • Protocol contract checked: The generated Codex app-server schema on current main defines subagent thread sources with subAgent.thread_spawn.parent_thread_id and states that thread createdAt is a Unix timestamp in seconds, matching the PR parser and timestamp conversion. (extensions/codex/src/app-server/protocol-generated/json/v2/ThreadStartResponse.json:1299, 7ee8e0b64188)
  • Mirror implementation: The PR creates silent subagent tasks with taskKind: "codex-native", Codex-thread run/source ids, session ownership, deliveryStatus: "not_applicable", and no OpenClaw child session key. (extensions/codex/src/app-server/native-subagent-task-mirror.ts:97, 75bc96ad74ba)
  • Event-projector wiring: The PR instantiates the native subagent mirror for each Codex app-server projector and invokes it before current-turn filtering, so child-thread notifications can be mirrored. (extensions/codex/src/app-server/event-projector.ts:147, 75bc96ad74ba)
  • Private helper scoping: The PR limits the new private local-only SDK subpath to bundled Codex module paths or the existing private-QA mode, instead of exposing it through the root alias for all plugins. (src/plugins/sdk-alias.ts:457, 75bc96ad74ba)

Likely related people:

  • steipete: Recent main history touches the Codex app-server event projector and SDK/plugin loading surfaces that this PR changes. (role: recent Codex/plugin loading area contributor; confidence: high; commits: a28bf10ce2eb, 4ff28a77356f, b85b1c68d175; files: extensions/codex/src/app-server/event-projector.ts, src/plugins/sdk-alias.ts)
  • mbelinky: Current-main history shows prior merged work extracting and registering the detached task lifecycle runtime that this PR reuses through the private Codex helper. (role: detached task runtime feature owner; confidence: high; commits: 0787266637fd, bd3ad3436efd, c8086b731a35; files: src/tasks/detached-task-runtime.ts, src/tasks/detached-task-runtime-contract.ts)
  • vincentkoc: Recent main history includes bundled public-surface and package test API alias gating in the same plugin loader alias area touched by the private Codex subpath change. (role: plugin alias adjacent contributor; confidence: medium; commits: 19f948af2efd, dadf0005ec3a; files: src/plugins/sdk-alias.ts)
  • tmimmanuel: Recent main history added the Gateway task ledger RPC surface that makes these Task Registry rows user-visible through task/status APIs. (role: task ledger feature contributor; confidence: medium; commits: 2945948a5ee4; files: src/tasks/task-registry.ts, src/gateway/server-methods/tasks.ts)

Remaining risk / open question:

  • The maintainer label protects this PR from cleanup closure and signals that the private bundled-Codex SDK-adjacent seam needs explicit human approval.
  • The PR body reports broad pnpm test was still red in unrelated/baseline areas and final-head Testbox packaging/import proof did not complete.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 7ee8e0b64188.

@openclaw-barnacle openclaw-barnacle Bot added the agents Agent runtime and tooling label May 8, 2026
@mbelinky mbelinky force-pushed the codex-native-subagent-task-registry branch from f746f2c to cf32569 Compare May 8, 2026 20:19
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation and removed agents Agent runtime and tooling labels May 8, 2026
@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label May 9, 2026
@mbelinky mbelinky force-pushed the codex-native-subagent-task-registry branch from e09264d to 0bbb950 Compare May 11, 2026 07:26
@openclaw-barnacle openclaw-barnacle Bot removed the docs Improvements or additions to documentation label May 11, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 11, 2026
@openclaw-barnacle openclaw-barnacle Bot added the docker Docker and sandbox tooling label May 11, 2026
@mbelinky mbelinky force-pushed the codex-native-subagent-task-registry branch from 539c639 to 0bbb950 Compare May 11, 2026 12:14
@openclaw-barnacle openclaw-barnacle Bot removed the docker Docker and sandbox tooling label May 11, 2026
@clawsweeper clawsweeper Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 11, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 11, 2026
@mbelinky mbelinky force-pushed the codex-native-subagent-task-registry branch from 8614d71 to 82f960d Compare May 11, 2026 17:36
@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label May 11, 2026
@mbelinky mbelinky force-pushed the codex-native-subagent-task-registry branch from 82f960d to 75bc96a Compare May 11, 2026 18:13
@mbelinky mbelinky marked this pull request as ready for review May 11, 2026 18:14
@mbelinky mbelinky merged commit 8c75ed3 into main May 11, 2026
136 checks passed
@mbelinky mbelinky deleted the codex-native-subagent-task-registry branch May 11, 2026 18:52
@mbelinky

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Thanks @mbelinky!

steipete added a commit that referenced this pull request May 12, 2026
Merged via squash.

Prepared head SHA: 75bc96a
Co-authored-by: mbelinky <mbelinky@users.noreply.github.com>
Co-authored-by: marianobelinky <63976030+marianobelinky@users.noreply.github.com>
Reviewed-by: @pashpashpash
# Conflicts:
#	extensions/codex/src/app-server/event-projector.ts
steipete added a commit that referenced this pull request May 12, 2026
Merged via squash.

Prepared head SHA: 75bc96a
Co-authored-by: mbelinky <mbelinky@users.noreply.github.com>
Co-authored-by: marianobelinky <63976030+marianobelinky@users.noreply.github.com>
Reviewed-by: @pashpashpash
# Conflicts:
#	extensions/codex/src/app-server/event-projector.ts
steipete added a commit that referenced this pull request May 13, 2026
Merged via squash.

Prepared head SHA: 75bc96a
Co-authored-by: mbelinky <mbelinky@users.noreply.github.com>
Co-authored-by: marianobelinky <63976030+marianobelinky@users.noreply.github.com>
Reviewed-by: @pashpashpash
steipete added a commit that referenced this pull request May 13, 2026
Merged via squash.

Prepared head SHA: 75bc96a
Co-authored-by: mbelinky <mbelinky@users.noreply.github.com>
Co-authored-by: marianobelinky <63976030+marianobelinky@users.noreply.github.com>
Reviewed-by: @pashpashpash
steipete added a commit that referenced this pull request May 13, 2026
Merged via squash.

Prepared head SHA: 75bc96a
Co-authored-by: mbelinky <mbelinky@users.noreply.github.com>
Co-authored-by: marianobelinky <63976030+marianobelinky@users.noreply.github.com>
Reviewed-by: @pashpashpash
steipete added a commit that referenced this pull request May 13, 2026
Merged via squash.

Prepared head SHA: 75bc96a
Co-authored-by: mbelinky <mbelinky@users.noreply.github.com>
Co-authored-by: marianobelinky <63976030+marianobelinky@users.noreply.github.com>
Reviewed-by: @pashpashpash
steipete added a commit that referenced this pull request May 13, 2026
Merged via squash.

Prepared head SHA: 75bc96a
Co-authored-by: mbelinky <mbelinky@users.noreply.github.com>
Co-authored-by: marianobelinky <63976030+marianobelinky@users.noreply.github.com>
Reviewed-by: @pashpashpash
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
Merged via squash.

Prepared head SHA: 75bc96a
Co-authored-by: mbelinky <mbelinky@users.noreply.github.com>
Co-authored-by: marianobelinky <63976030+marianobelinky@users.noreply.github.com>
Reviewed-by: @pashpashpash
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
Merged via squash.

Prepared head SHA: 75bc96a
Co-authored-by: mbelinky <mbelinky@users.noreply.github.com>
Co-authored-by: marianobelinky <63976030+marianobelinky@users.noreply.github.com>
Reviewed-by: @pashpashpash
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
Merged via squash.

Prepared head SHA: 75bc96a
Co-authored-by: mbelinky <mbelinky@users.noreply.github.com>
Co-authored-by: marianobelinky <63976030+marianobelinky@users.noreply.github.com>
Reviewed-by: @pashpashpash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation extensions: codex maintainer Maintainer-authored PR proof: sufficient ClawSweeper judged the real behavior proof convincing. scripts Repository scripts size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants