Skip to content

feat: add /codex:sessions, /codex:send and /codex:queue for existing Codex sessions - #833

Open
nobrainer-tech wants to merge 2 commits into
openai:mainfrom
nobrainer-tech:codex/upstream-session-queue
Open

nobrainer-tech wants to merge 2 commits into
openai:mainfrom
nobrainer-tech:codex/upstream-session-queue

Conversation

@nobrainer-tech

@nobrainer-tech nobrainer-tech commented Oct 29, 2026 •

Copy link
Copy Markdown

The plugin can continue its own latest rescue task, but users with an existing Codex conversation have no command to discover its section/ID and send it a follow-up. This adds an opt-in workflow for those conversations, including ones created outside the plugin.

  • /codex:sessions lists local sessions grouped by their persisted sections, with exact UUIDs and working directories. It paginates across all providers and includes an unsectioned group.
  • /codex:send <uuid> <message> previews the target, then queues the user-authorized message through native codex queue. It preserves the session settings and leaves its writer in control.
  • /codex:queue <uuid> shows pending IDs without message bodies. A queued receipt is explicitly distinct from task completion; uncertain sends are not retried.

The implementation reuses the app-server client with an opt-in request timeout and closes failed initialization attempts. Discovery uses one unfiltered thread enumeration so moving a thread between sections cannot cause the per-section scan gap. No new dependency, background hook, state store, version bump, or branding change.

How to verify — no Codex account needed

tests/sessions-live.test.mjs runs the three commands against the real codex binary. It uses a throwaway CODEX_HOME whose config.toml points the model provider at a loopback Responses API stub, so it needs no login, network or credits and never touches ~/.codex:

npm install -g @openai/codex
node --test tests/sessions-live.test.mjs

The test seeds a session with one completed turn, then checks that:

  1. sessions --json lists that session with its exact UUID and cwd;
  2. send without --execute writes nothing;
  3. send --execute returns a QUEUED receipt, queue shows that exact ID without the message body, and no model turn starts;
  4. opening the session (thread/resume, as Codex Desktop does) consumes the queue: the stub model receives the literal UTF-8, shell-sensitive message and the queue is empty afterwards.

CI already installs @openai/codex, so this runs on every push. That makes it the drift alarm for the experimental section, thread and queue APIs. The test is skipped when codex or codex queue is unavailable, and on Windows.

Validation

  • npm test: 102/102 pass with Codex CLI 0.163.0, and the live test also passes with 0.166.0 (current npm). Mutating the message passed to codex queue makes the live test fail.
  • npm run prebuild, npm run build and npm run check-version pass.
  • Run inside a live Claude Code session, four unrelated existing tests fail because the suite inherits CLAUDE_PLUGIN_DATA and CODEX_COMPANION_SESSION_ID. fix(tests): keep the suite hermetic inside a live Claude Code session #456 fixes that; this PR leaves it alone.

Compatibility

These commands require the experimental section/thread/queue APIs and native codex queue. The listing is local-only, not an atomic snapshot or a full Desktop export; remote hosts and ChatGPT are excluded. Windows execution is unverified and .cmd wrappers are not run through a shell. codex queue takes the message only as --message <TEXT> (no stdin option), so the text appears in the child process argv; the command docs prohibit sending secrets until Codex accepts stdin.

Related: #700 covers explicit thread resumption; #351 proposes session/history tracking and hooks. This PR focuses on discovery and queueing without resuming a thread or storing its conversation history.

@nobrainer-tech
nobrainer-tech requested a review from a team October 29, 2026 14:42
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-29T21:34:42.580591Z
We couldn’t complete this review. Comment @codex review to try again.
949a1d8 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Reviewers could not verify the integration without a working Codex setup.
The test drives sessions, send and queue through the real codex binary
with an isolated CODEX_HOME and a loopback Responses stub, so CI and
reviewers get end-to-end proof without credentials or network.
@nobrainer-tech

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

An unknown error occurred
ℹ️ 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".

@nobrainer-tech nobrainer-tech changed the title Add local session discovery and exact-thread queued messages feat: add /codex:sessions, /codex:send and /codex:queue for existing Codex sessions Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant