Skip to content

feat(codex): bind CLI sessions from nodes#81747

Merged
mbelinky merged 4 commits into
mainfrom
mb/codex-cli-node-sessions
May 14, 2026
Merged

feat(codex): bind CLI sessions from nodes#81747
mbelinky merged 4 commits into
mainfrom
mb/codex-cli-node-sessions

Conversation

@mbelinky

@mbelinky mbelinky commented May 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add Codex plugin node-host commands for listing and resuming local Codex CLI sessions on paired nodes
  • add /codex sessions --host <node> and /codex resume <session-id> --host <node> --bind here for binding a chat to an existing CLI session
  • route bound follow-up messages through codex exec resume on the selected node, with docs and changelog coverage

Real behavior proof

  • Behavior addressed: An OpenClaw conversation can discover existing Codex CLI sessions on a paired node and bind to one so follow-up chat messages continue that real CLI session.
  • Real environment tested: AWS Crabbox focused proof run_a901a61e006f on t3.large, OpenClaw 2026.5.12-beta.6, real codex-cli 0.130.0 auth/session.
  • Exact steps or command run after this patch: Ran the OpenClaw Codex node-host session handlers against a real authed Codex CLI session: codex.cli.sessions.list followed by codex.cli.session.resume.
  • Evidence after fix: Terminal output from the AWS Crabbox run included PROOF_OK session=019e258d-bf7b-7ce1-bbb0-457ba23fa623 after the resume handler returned the expected token.
  • Observed result after fix: The node-host list handler found the real CLI session, and the resume handler continued it successfully through codex exec resume.
  • What was not tested: Full live gateway-to-node chat pairing was not rerun in this PR lane; the focused proof covered the node-host Codex CLI behavior directly, and local tests cover command routing/binding behavior.

Verification

  • pnpm exec oxfmt --check --threads=1 CHANGELOG.md docs/plugins/codex-harness.md extensions/codex/index.ts extensions/codex/src/command-formatters.ts extensions/codex/src/command-handlers.ts extensions/codex/src/commands.test.ts extensions/codex/src/conversation-binding-data.ts extensions/codex/src/conversation-binding.test.ts extensions/codex/src/conversation-binding.ts extensions/codex/src/node-cli-sessions.ts extensions/codex/src/node-cli-sessions.test.ts
  • pnpm run lint:tmp:no-random-messaging
  • pnpm run lint:extensions:bundled
  • OPENCLAW_VITEST_MAX_WORKERS=4 pnpm test extensions/codex/src/node-cli-sessions.test.ts extensions/codex/src/conversation-binding.test.ts extensions/codex/src/commands.test.ts (96 tests, including Windows .cmd Codex shim resolution)
  • pnpm tsgo:extensions
  • git diff --check

Release branch

Validated the focused proof against origin/release/2026.5.12 before rebasing this PR onto main. If this should ship in the current release line, the rebased commit to discuss for backport is 27c9564081 feat(codex): bind CLI sessions from nodes.

Maintainer discussion flags

Touches node command policy and Codex slash-command behavior; maintainer approved merge in chat.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: codex size: XL maintainer Maintainer-authored PR labels May 14, 2026
@clawsweeper

clawsweeper Bot commented May 14, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

Summary
The PR adds Codex node-host commands and slash-command handling to list/resume local Codex CLI sessions on paired nodes, bind conversations to those sessions, route follow-up messages through codex exec resume, and update tests/docs/changelog.

Reproducibility: not applicable. as a feature PR rather than a bug report. The after-fix path is evidenced by PR-body Crabbox proof for real node-host list/resume behavior plus source inspection of the command routing.

Real behavior proof
Sufficient (logs): The PR body includes focused AWS Crabbox logs from a real Codex CLI auth/session and an observed PROOF_OK after list and resume handlers ran.

Next step before merge
Protected maintainer label plus node-command policy and slash-command UX changes require human review; no narrow automation repair remains after the Windows shim fix.

Security
Cleared: No concrete supply-chain regression found; the new codex exec resume node-host path is marked dangerous and excluded from default allowlists, with final policy acceptance left to maintainers.

Review details

Best possible solution:

Have maintainers review the dangerous node-command policy and /codex UX, then merge the branch if that policy decision is accepted and normal checks stay green.

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

Not applicable as a feature PR rather than a bug report. The after-fix path is evidenced by PR-body Crabbox proof for real node-host list/resume behavior plus source inspection of the command routing.

Is this the best way to solve the issue?

Unclear pending maintainer policy review: the implementation follows existing plugin node-host APIs and now uses the established Windows spawn helper, but accepting a dangerous node resume command and the binding UX is a product/security decision.

What I checked:

  • Protected label and discussion context: The provided PR context lists the maintainer label and the PR body says the node command policy and Codex slash-command behavior are worth maintainer review before merging. (3595cd31e925)
  • Node command registration: The PR registers codex.cli.sessions.list as a default node command on macOS/Linux/Windows and registers codex.cli.session.resume as a dangerous command without default platforms, which matches the explicit-allowlist policy boundary. (extensions/codex/src/node-cli-sessions.ts:67, 3595cd31e925)
  • Slash-command binding flow: The PR adds /codex sessions --host ... and /codex resume ... --host ... --bind here, resolving the requested node session before creating a conversation binding. (extensions/codex/src/command-handlers.ts:534, 3595cd31e925)
  • Bound turn routing: Bound codex-cli-node-session messages are routed through the injected node resume helper with node id, session id, prompt, cwd, and timeout. (extensions/codex/src/conversation-binding.ts:157, 3595cd31e925)
  • Prior Windows finding addressed: Latest head resolves Codex CLI resume through resolveWindowsSpawnProgram/materializeWindowsSpawnProgram, and the added test covers Windows npm .cmd shims. (extensions/codex/src/node-cli-sessions.ts:268, 3595cd31e925)
  • Existing node policy contract: Current main filters dangerous plugin node commands out of default allowlists unless explicitly included in gateway.nodes.allowCommands, and the SDK docs say dangerous node-host commands should register node-invoke policies. (src/gateway/node-command-policy.ts:237, 66b98b72946f)

Likely related people:

  • steipete: Local blame shows current Codex entry/binding and node policy ranges on main, and GitHub commit history shows prior Codex harness/app-server and plugin SDK surface work in the same area. (role: introduced and recently maintained adjacent Codex plugin and node-policy surfaces; confidence: high; commits: 625713091e, dd26e8c44d4e, 31a0b7bd42a5; files: extensions/codex/index.ts, extensions/codex/src/conversation-binding.ts, extensions/codex/src/command-handlers.ts)
  • pashpashpash: Recent current-main history for Codex app-server auth, state isolation, and Windows/env handling touches the process/runtime boundary this PR extends. (role: recent Codex app-server runtime contributor; confidence: medium; commits: 78d51dcebe9e, a412603bad53, 027ea5f08bd9; files: extensions/codex/src/app-server/transport-stdio.ts, docs/plugins/codex-harness.md)
  • mbelinky: Beyond authoring this PR, recent current-main history shows Codex watchdog/subagent and related Codex work by this contributor, so they are relevant to follow-up on the proposed surface. (role: recent Codex area contributor and reviewer; confidence: medium; commits: 1aef36b60d83, 949012797bea, 8c75ed3eaa8f; files: extensions/codex/index.ts, extensions/codex/src/command-handlers.ts, CHANGELOG.md)

Remaining risk / open question:

  • The PR body says full live gateway-to-node chat pairing was not rerun; the posted proof covers node-host handlers and tests cover routing.
  • The new dangerous resume command and slash-command binding UX still need explicit maintainer approval because they change the node command policy surface.

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

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 14, 2026
@mbelinky
mbelinky force-pushed the mb/codex-cli-node-sessions branch from aae2a2e to 3595cd3 Compare May 14, 2026 08:57
@mbelinky
mbelinky force-pushed the mb/codex-cli-node-sessions branch from 3595cd3 to d0406ac Compare May 14, 2026 09:23
@mbelinky
mbelinky merged commit a5c1956 into main May 14, 2026
104 checks passed
@mbelinky
mbelinky deleted the mb/codex-cli-node-sessions branch May 14, 2026 09:24
@mbelinky

Copy link
Copy Markdown
Contributor Author

Merged via pinned squash merge at a5c1956 after rebasing onto current main. Focused verification stayed green: formatter on touched files, temp-boundary lint, bundled extension oxlint, 96 Codex tests, extension typecheck, diff whitespace, plus AWS Crabbox proof run_a901a61e006f. No open duplicate PRs/issues found in the targeted Codex CLI session resume search.

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. size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant