Skip to content

Add plan and fast slash commands#257

Open
leehogwang wants to merge 2 commits into
zed-industries:mainfrom
leehogwang:codex/plan-fast-slash-commands
Open

Add plan and fast slash commands#257
leehogwang wants to merge 2 commits into
zed-industries:mainfrom
leehogwang:codex/plan-fast-slash-commands

Conversation

@leehogwang
Copy link
Copy Markdown

@leehogwang leehogwang commented Apr 30, 2026

Summary

Adds Codex ACP support for the /plan and /fast slash commands so ACP clients such as Zed can expose the same core Codex controls available in the Codex TUI.

  • advertises /plan and /fast through ACP available commands
  • maps /plan to Codex Plan collaboration mode using the built-in Codex collaboration mode preset
  • supports /plan <prompt> by submitting the prompt with Plan mode in the same turn context
  • supports /plan off and /plan off <prompt> to explicitly leave Plan mode or continue immediately in Default mode
  • supports /fast, /fast on, /fast off, and /fast status using Codex service tier overrides
  • preserves the previous non-fast service tier when /fast off disables Fast mode
  • routes fixed-option Codex request_user_input events through ACP permission requests so Zed can show a choice UI during Plan mode
  • handles multiple fixed-option request_user_input questions sequentially and only returns answers to Codex after all questions have been resolved
  • also emits those request_user_input prompts as visible pending tool calls so the question remains in the thread history if the user switches away and returns
  • keys request_user_input permission requests by turn and call ID, and rejects free-form/secret prompt shapes that ACP permission buttons cannot represent
  • renders Codex Plan-mode PlanDelta / completed TurnItem::Plan output as visible assistant markdown so <proposed_plan> content is not dropped by ACP clients
  • sends a visible fallback message and returns an empty answer for request-user-input shapes that ACP cannot currently represent as a permission selection
  • adds unit coverage for the new command, request-user-input, proposed-plan rendering, and fast-tier restoration paths

Validation

  • CODEX_SKIP_VENDORED_BWRAP=1 CARGO_HOME=/tmp/codex-rust/cargo RUSTUP_HOME=/tmp/codex-rust/rustup /tmp/codex-rust/cargo/bin/cargo fmt
  • CODEX_SKIP_VENDORED_BWRAP=1 CARGO_HOME=/tmp/codex-rust/cargo RUSTUP_HOME=/tmp/codex-rust/rustup /tmp/codex-rust/cargo/bin/cargo test -- --nocapture
  • CODEX_SKIP_VENDORED_BWRAP=1 CARGO_HOME=/tmp/codex-rust/cargo RUSTUP_HOME=/tmp/codex-rust/rustup /tmp/codex-rust/cargo/bin/cargo build --bin codex-acp

Note: CODEX_SKIP_VENDORED_BWRAP=1 was needed in this environment because libcap.pc is not installed for the vendored bubblewrap build.

Release Notes:

  • Added Codex ACP support for /plan and /fast slash commands, including visible Plan-mode prompts and /plan off.

@leehogwang leehogwang force-pushed the codex/plan-fast-slash-commands branch from 5d38219 to 0a170f0 Compare April 30, 2026 05:58
@leehogwang leehogwang marked this pull request as ready for review April 30, 2026 07:31
Copy link
Copy Markdown

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

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: 0a170f000a

ℹ️ 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 thread src/thread.rs Outdated
Comment on lines +464 to +465
fn user_input_request_key(turn_id: &str) -> String {
format!("user-input:{turn_id}")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Key user-input permission requests by call ID

user_input_request_key uses only turn_id, so multiple RequestUserInput prompts emitted within the same turn overwrite each other in pending_permission_interactions and abort the earlier task. In that case the first prompt never gets a corresponding Op::UserInputAnswer, which can leave the turn waiting on an unanswered tool call. Use a per-call key (e.g. include call_id) to keep concurrent prompts distinct.

Useful? React with 👍 / 👎.

Comment thread src/thread.rs Outdated
Comment on lines +503 to +509
let [question] = event.questions.as_slice() else {
return None;
};
let options = question
.options
.as_ref()
.filter(|options| !options.is_empty())?;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject request_user_input prompts requiring free-form "Other"

The supported-shape gate only checks for a single question with non-empty options, but it ignores question.is_other. When is_other is true, this adapter still routes the prompt through fixed permission buttons, so users cannot provide the required free-form "Other" answer and the tool call receives an incomplete/incorrect response path. This shape should be treated as unsupported and sent through the existing fallback branch.

Useful? React with 👍 / 👎.

@leehogwang leehogwang force-pushed the codex/plan-fast-slash-commands branch 2 times, most recently from d837599 to 218665d Compare April 30, 2026 08:27
Copy link
Copy Markdown

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

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: 218665dea6

ℹ️ 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 thread src/thread.rs Outdated
self.set_service_tier(service_tier).await?;
}
"on" => self.set_service_tier(Some(ServiceTier::Fast)).await?,
"off" => self.set_service_tier(None).await?,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve prior non-fast tier when disabling /fast

The /fast off path always calls set_service_tier(None), which clears the session's tier preference instead of restoring whatever non-fast tier was active before /fast on (for example ServiceTier::Flex). Because this command also overwrites self.config.service_tier, users who start in a non-default tier cannot get back to it via /fast and silently run future turns with a different service tier than intended.

Useful? React with 👍 / 👎.

@leehogwang leehogwang force-pushed the codex/plan-fast-slash-commands branch 2 times, most recently from 0de7412 to 655076a Compare May 1, 2026 10:02
@leehogwang leehogwang changed the title [codex] Add plan and fast slash commands Add plan and fast slash commands May 1, 2026
Copy link
Copy Markdown

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

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: 655076a94b

ℹ️ 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 thread src/thread.rs
Comment on lines +3401 to +3402
(collaboration_mode, plan_rest)
} else {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Persist plan-off mode before accepting an inline prompt

When handling /plan off <prompt>, this branch only sets collaboration_mode: Default on Op::UserInputWithTurnContext for that one turn and does not submit Op::OverrideTurnContext. If the session was previously switched to Plan mode (for example via /plan), the persistent mode remains Plan after the prompted turn, so subsequent normal prompts keep running in Plan mode even though the user explicitly used off.

Useful? React with 👍 / 👎.

@leehogwang leehogwang force-pushed the codex/plan-fast-slash-commands branch from 655076a to 5465d67 Compare May 1, 2026 10:29
Copy link
Copy Markdown
Author

Addressed the latest Codex review in 5465d6738219788e022406e121067db3a79c11d7.

/plan off <prompt> now first persists the session collaboration mode back to Default via OverrideTurnContext, then submits the inline prompt with Default mode for that turn. The plan tests were updated to cover both operations.

@leehogwang leehogwang force-pushed the codex/plan-fast-slash-commands branch from 5465d67 to 24499a3 Compare May 1, 2026 15:08
Copy link
Copy Markdown
Author

Updated in 24499a37201c51a24e3669d2b4e4ef7aa689b671 to handle multi-question request_user_input events.

Previously, a request containing multiple fixed-option questions fell into the unsupported fallback and returned an empty answer immediately. The adapter now asks each fixed-option question sequentially through ACP permission requests, keeps each prompt visible as a pending tool call, and only submits Op::UserInputAnswer after all questions have been answered.

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