Skip to content

feat: add codex supervisor plugin#87849

Merged
steipete merged 8 commits into
mainfrom
codex-supervisor-extension
May 29, 2026
Merged

feat: add codex supervisor plugin#87849
steipete merged 8 commits into
mainfrom
codex-supervisor-extension

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Summary

  • Adds bundled codex-supervisor plugin with OpenClaw tools for Codex app-server endpoint probing, session listing, transcript reads, send, and interrupt controls.
  • Adds MCP serve entrypoint, supervisor spec, plugin reference docs, labeler mapping, and focused tests.
  • Gates raw transcript and write controls behind explicit config, redacts default session output, and keeps loaded-session reads on thread/read instead of stored thread/list.

Behavior addressed:
Codex sessions can be supervised through OpenClaw plugin tools or the standalone MCP server while preserving explicit transcript and write-control policy gates.

Real environment tested:
Local macOS checkout plus Blacksmith Testbox tbx_01ksrpfzbm5dx436nftran264m.

Exact steps or command run after this patch:

  • node scripts/run-vitest.mjs run extensions/codex-supervisor/src/supervisor.test.ts extensions/codex-supervisor/src/mcp-tools.test.ts extensions/codex-supervisor/src/plugin-tools.test.ts extensions/codex-supervisor/index.test.ts src/plugins/contracts/plugin-tool-contracts.test.ts
  • pnpm exec tsc -p extensions/codex-supervisor/tsconfig.json --noEmit
  • pnpm run lint:plugins:no-extension-test-core-imports
  • node scripts/run-oxlint-shards.mjs
  • node scripts/generate-plugin-inventory-doc.mjs --check
  • pnpm check:no-conflict-markers
  • git diff --check and git diff --cached --check
  • autoreview --mode local
  • pnpm check:changed

Evidence after fix:

  • Focused Vitest slice passed: 5 files, 36 tests.
  • Plugin tsconfig passed.
  • Extension test core-import guard passed.
  • Oxlint shards passed.
  • Generated plugin inventory check passed.
  • Final autoreview passed clean with no accepted or actionable findings.
  • GitHub label extensions: codex-supervisor exists.

Observed result after fix:
The codex-supervisor plugin registers its five tools, supports loaded-only session listing and endpoint inference, uses thread/read for target reads, and keeps stored-history enumeration behind includeStored.

What was not tested:
pnpm check:changed did not complete green because typecheck all failed outside this patch in src/cron/schedule-identity.test.ts and extensions/memory-wiki/src/apply.ts. The Testbox run id was tbx_01ksrpfzbm5dx436nftran264m.

@steipete
steipete requested a review from a team as a code owner May 29, 2026 01:48
@steipete steipete added the extensions: codex-supervisor Extension: codex-supervisor label May 29, 2026
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: XL maintainer Maintainer-authored PR labels May 29, 2026
@github-actions github-actions Bot added the dependencies-changed PR changes dependency-related files label May 29, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Dependency Changes Detected

This PR changes dependency-related files. Maintainers should confirm these changes are intentional.

Changed files:

  • extensions/codex-supervisor/package.json
  • pnpm-lock.yaml

Maintainer follow-up:

  • Review whether the dependency changes are intentional.
  • Inspect resolved package deltas when lockfile, shrinkwrap, or workspace dependency policy changes are present.
  • Treat package-lock.json and npm-shrinkwrap.json diffs as security-review surfaces.
  • Run pnpm deps:changes:report -- --base-ref origin/main --markdown /tmp/dependency-changes.md --json /tmp/dependency-changes.json locally for detailed release-style evidence.

@github-actions

github-actions Bot commented May 29, 2026

Copy link
Copy Markdown
Contributor

Dependency graph change authorized

This PR includes dependency graph changes. A member of @openclaw/openclaw-secops authorized this exact head SHA with /allow-dependencies-change.

  • Approved SHA: 5ecfbfe5200536e242faf76d9ecb79fa0f8caf2d
  • Approved by: @steipete
  • Reason: codex supervisor bundled extension dependencies

A later push changes the PR head SHA and requires a fresh security approval.

@clawsweeper

clawsweeper Bot commented May 29, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed May 28, 2026, 10:32 PM ET / 02:32 UTC.

Summary
The PR adds a bundled codex-supervisor plugin with OpenClaw and MCP tools for Codex app-server endpoint probing, session listing, transcript reads, sends, interrupts, docs, tests, package metadata, and lockfile entries.

PR surface: Source +1781, Tests +1084, Docs +268, Config +46, Other +19. Total +3198 across 35 files.

Reproducibility: yes. for the review blockers: source inspection shows invalid endpoint records are filtered, and the upstream Codex app-server docs require content: null on declined MCP elicitations. The broader feature still lacks after-fix live behavior proof.

Review metrics: 3 noteworthy metrics.

  • Supervisor config surfaces: 3 plugin fields and 3 environment variables added. New endpoint, transcript, and write-control knobs affect operator setup and must fail safely before merge.
  • Raw socket allowlist: 1 callsite added. A new raw socket app-server connection needs maintainer-visible security classification beyond ordinary CI.
  • Runtime dependency surface: 4 plugin runtime dependencies added. The exact head is authorized, but lockfile and package additions remain a supply-chain review surface for the bundled plugin.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🦐 gold shrimp
Result: blocked until real behavior proof from a real setup is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Add redacted live proof from a real Codex app-server or standalone MCP invocation; redact private endpoints, API keys, phone numbers, tokens, and other private details.
  • [P1] Fail fast on malformed endpoint config and add focused tests for bad JSON records and bad shorthand tokens.
  • Return { action: "decline", content: null } for MCP elicitations and get explicit maintainer/security acceptance for the bundled control plane.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR body lists tests, checks, and a Testbox id, but not redacted after-fix terminal output, logs, screenshots, recording, or linked artifacts from a live Codex app-server or standalone MCP invocation; after adding proof, update the PR body so ClawSweeper can re-review automatically, or ask a maintainer to comment @clawsweeper re-review.

Risk before merge

  • [P1] The PR body lists tests and a Testbox id, but it still does not include redacted after-fix output from a live Codex app-server or standalone MCP invocation.
  • [P1] Malformed endpoint config currently fails open by filtering bad entries, which can leave the supervisor monitoring zero endpoints, only part of a configured fleet, or the default local endpoint without an operator-facing error.
  • [P1] The MCP elicitation decline response does not match the app-server contract and can leave supervised turns blocked or erroring instead of failing closed cleanly.
  • [P1] Bundling transcript reads, send, interrupt, raw socket egress, and new runtime dependencies is a security-boundary/product decision that green unit tests do not settle.

Maintainer options:

  1. Fix protocol/config blockers before merge (recommended)
    Require fail-fast endpoint validation, { action: "decline", content: null } for MCP elicitations, and redacted live app-server or MCP proof before this enters main.
  2. Accept the new control-plane boundary explicitly
    Maintainers can decide the bundled supervisor, raw socket egress, and transcript/write controls are intentional after reviewing the dependency and security implications.
  3. Pause or move the surface out of core
    If the supervisor is not ready as a bundled plugin, pause this PR and pursue an external plugin or ClawHub path until the core boundary decision is settled.

Next step before merge

  • [P1] The protected maintainer label, new bundled control-plane/security boundary, and missing contributor proof require human maintainer/security review even though two code blockers are mechanically fixable.

Security
Needs attention: The diff introduces a new bundled control plane that can read and steer Codex sessions over app-server socket/WebSocket connections, so maintainer/security acceptance is still needed.

Review findings

  • [P1] Reject malformed endpoint config instead of filtering it — extensions/codex-supervisor/src/config.ts:164-165
  • [P2] Return null content for declined MCP elicitations — extensions/codex-supervisor/src/json-rpc-client.ts:61-62
Review details

Best possible solution:

Land only after malformed config and elicitation decline are fixed, redacted live Codex app-server or MCP proof is added, and maintainers explicitly accept bundling the supervisor control plane and raw socket/dependency surface.

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

Yes for the review blockers: source inspection shows invalid endpoint records are filtered, and the upstream Codex app-server docs require content: null on declined MCP elicitations. The broader feature still lacks after-fix live behavior proof.

Is this the best way to solve the issue?

No, not yet. The plugin direction is plausible, but the current branch needs fail-fast config parsing, the correct MCP decline contract, live proof, and explicit security/product acceptance before it is the safest implementation.

Full review comments:

  • [P1] Reject malformed endpoint config instead of filtering it — extensions/codex-supervisor/src/config.ts:164-165
    OPENCLAW_CODEX_SUPERVISOR_ENDPOINTS and plugin endpoints entries are parsed with map(...).filter(Boolean), so a typo can silently drop one endpoint, all endpoints, or fall back to the default local endpoint. For a supervisor control-plane config, invalid records should fail fast with a clear error and focused tests.
    Confidence: 0.88
  • [P2] Return null content for declined MCP elicitations — extensions/codex-supervisor/src/json-rpc-client.ts:61-62
    The Codex app-server contract documents declined MCP elicitations as { action: "decline", content: null }, but this handler returns only { action: "decline" }. A supervised turn that triggers an MCP elicitation can treat that response as malformed or fail to resolve the pending request, so include the content: null field and cover it in the approval-response test.
    Confidence: 0.86

Overall correctness: patch is incorrect
Overall confidence: 0.88

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add P2: This is a normal-priority feature PR with concrete blockers and security-sensitive review needs, not an urgent regression in existing user workflows.
  • add merge-risk: 🚨 compatibility: The new config/default surface can silently ignore malformed endpoint configuration and run against the wrong or partial endpoint set.
  • add merge-risk: 🚨 security-boundary: The PR bundles tools that can read transcripts and send or interrupt Codex sessions over raw app-server socket/WebSocket connections.

Label justifications:

  • P2: This is a normal-priority feature PR with concrete blockers and security-sensitive review needs, not an urgent regression in existing user workflows.
  • merge-risk: 🚨 compatibility: The new config/default surface can silently ignore malformed endpoint configuration and run against the wrong or partial endpoint set.
  • merge-risk: 🚨 security-boundary: The PR bundles tools that can read transcripts and send or interrupt Codex sessions over raw app-server socket/WebSocket connections.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body lists tests, checks, and a Testbox id, but not redacted after-fix terminal output, logs, screenshots, recording, or linked artifacts from a live Codex app-server or standalone MCP invocation; after adding proof, update the PR body so ClawSweeper can re-review automatically, or ask a maintainer to comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +1781, Tests +1084, Docs +268, Config +46, Other +19. Total +3198 across 35 files.

View PR surface stats
Area Files Added Removed Net
Source 12 1781 0 +1781
Tests 12 1142 58 +1084
Docs 4 268 0 +268
Config 5 46 0 +46
Generated 0 0 0 0
Other 2 20 1 +19
Total 35 3257 59 +3198

Security concerns:

  • [medium] New Codex session control plane needs security acceptance — extensions/codex-supervisor/index.ts:18
    The plugin registers transcript read, send, and interrupt tools with default-deny gates, but enabling it gives OpenClaw the ability to inspect and steer Codex sessions; maintainers should explicitly accept this bundled security boundary before merge.
    Confidence: 0.86
  • [medium] Raw app-server socket egress is newly allowlisted — extensions/codex-supervisor/src/json-rpc-client.ts:247
    The PR adds a net.createConnection path for Unix-socket app-server WebSocket transport and allowlists it in the raw socket CodeQL query; that classification is visible, but the raw egress plus remote WebSocket endpoint support remains a security review surface.
    Confidence: 0.82

What I checked:

Likely related people:

  • Peter Steinberger: Recent current-main commits extracted the Gateway client wrapper and touched adjacent Codex/plugin surfaces, so this history overlaps the PR's Gateway and Codex supervision boundaries beyond merely authoring the PR. (role: recent area contributor; confidence: high; commits: b1117d98622f, 025e6ac31d44, 51b5f75b92f7; files: src/gateway/client.ts, packages/gateway-client/src/client.ts, extensions/codex)
  • Vincent Koc: Recent current-main blame shows the raw socket CodeQL guard and Codex app-server approval handling came through a broad E2E/guardrail commit, which is directly relevant to this PR's raw socket and app-server request handling. (role: adjacent guardrail owner; confidence: medium; commits: d4021d1d542f; files: .github/codeql/openclaw-boundary/queries/raw-socket-callsite-classification.ql, extensions/codex/media-understanding-provider.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3cdefc8141

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +171 to +172
.map(endpointFromToken)
.filter((entry): entry is CodexSupervisorEndpoint => Boolean(entry)),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject invalid supervisor endpoints

When OPENCLAW_CODEX_SUPERVISOR_ENDPOINTS contains an invalid token (for example prod=https://host or a typo in a comma-separated fleet), this filter silently drops it instead of failing startup. If the typo is the only endpoint the supervisor starts with zero endpoints, and if it is mixed with valid endpoints it supervises only part of the configured fleet with no operator-facing error, which is risky for a new control-plane config surface. Please report the bad entry and fail fast instead of filtering it away.

Useful? React with 👍 / 👎.

Comment thread extensions/codex-supervisor/src/json-rpc-client.ts Fixed
@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. labels May 29, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dbf289351d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +61 to +62
if (method === "mcpServer/elicitation/request") {
return { action: "decline" };

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include null content when declining MCP elicitations

When a supervised Codex turn invokes an MCP server that triggers mcpServer/elicitation/request, this response omits the content field even though the Codex app-server contract documents decline/cancel responses as {"action":"decline","content":null} (see https://github.com/openai/codex/blob/main/codex-rs/app-server/README.md#mcp-server-elicitations). In that scenario the app-server can treat the client reply as malformed or fail to resolve the pending elicitation, which can leave the turn blocked instead of failing closed cleanly; return { action: "decline", content: null } here.

Useful? React with 👍 / 👎.

@openclaw-barnacle openclaw-barnacle Bot added the gateway Gateway runtime label May 29, 2026
…nsion

# Conflicts:
#	src/cron/schedule-identity.test.ts
@steipete

Copy link
Copy Markdown
Contributor Author

/allow-dependencies-change codex supervisor bundled extension dependencies

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. labels May 29, 2026
@openclaw-barnacle openclaw-barnacle Bot added the agents Agent runtime and tooling label May 29, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

/allow-dependencies-change codex supervisor bundled extension dependencies

…nsion

# Conflicts:
#	src/tui/gateway-chat.test.ts
@steipete

Copy link
Copy Markdown
Contributor Author

/allow-dependencies-change codex supervisor bundled extension dependencies

@steipete
steipete merged commit 9dd3bce into main May 29, 2026
101 of 102 checks passed
@steipete
steipete deleted the codex-supervisor-extension branch May 29, 2026 02:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling dependencies-changed PR changes dependency-related files docs Improvements or additions to documentation extensions: codex-supervisor Extension: codex-supervisor gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants