Skip to content

[codex] Add Codex slash command support#3558

Open
StiensWout wants to merge 1 commit into
pingdotgg:mainfrom
StiensWout:codex/slash-command-support
Open

[codex] Add Codex slash command support#3558
StiensWout wants to merge 1 commit into
pingdotgg:mainfrom
StiensWout:codex/slash-command-support

Conversation

@StiensWout

@StiensWout StiensWout commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Advertise Codex provider slash commands for /review and /compact after the app-server probe succeeds.
  • Route standalone /review [instructions] and /compact prompts through Codex app-server RPCs instead of sending them as chat messages.
  • Keep this to app-server-backed commands; broader /goal handling remains separate native goal work because Codex exposes dedicated goal RPCs.

Why

Codex slash commands are not a generic text passthrough in T3 Code. /review returns a turn from review/start, while /compact starts through thread/compact/start and reports its turn through turn/started, so the Codex provider runtime needs to own that mapping.

Impact

Codex users see /review and /compact in the composer command menu. Submitting either command starts the matching provider-native turn and preserves the usual T3 turn/session state.

Validation

  • PATH="$HOME/.vite-plus/bin:$PATH" vp check
  • PATH="$HOME/.vite-plus/bin:$PATH" vp run --filter ./apps/server typecheck
  • PATH="$HOME/.vite-plus/bin:$PATH" vp test run apps/server/src/provider/Layers/CodexAdapter.test.ts
  • PATH="$HOME/.vite-plus/bin:$PATH" vp run typecheck

Refs #2491

Note

Add /compact and /review slash command support to the Codex provider

  • Defines CODEX_APP_SERVER_SLASH_COMMANDS in CodexProvider.ts advertising compact and review slash commands; successful provider probes now include these, while error/disabled states return an empty list.
  • Adds parseStandaloneCodexSlashCommand in CodexAdapter.ts to detect single-line /compact or /review [instructions] messages with no attachments, routing them to runSlashCommand instead of a normal sendTurn.
  • Implements runSlashCommand in CodexSessionRuntime.ts: /compact calls thread/compact/start and waits for the next turn/started notification; /review calls review/start with optional instructions and inline delivery.
  • Serializes all turn starts (both sendTurn and runSlashCommand) with a semaphore, tracking known turn IDs and pending waiters to correctly resolve or fail them on process exit or runtime close.
  • Risk: concurrent slash command and sendTurn calls are now serialized, which changes timing behavior for back-to-back turn starts.

Macroscope summarized 21bf969.


Note

Medium Risk
Changes Codex session turn-start orchestration and async compact turn correlation; failures or missing turn/started events could block or error slash commands without affecting unrelated providers.

Overview
Adds Codex-native slash commands so standalone /review and /compact prompts are not sent as ordinary chat turns.

After a successful app-server probe, the Codex provider snapshot now includes review and compact in slashCommands (empty while disabled or probe fails). In CodexAdapter, parseStandaloneCodexSlashCommand recognizes attachment-free /compact or /review [instructions] input and calls runSlashCommand instead of sendTurn, optionally passing the bound instance’s selected model.

CodexSessionRuntime implements runSlashCommand: review/start with custom instructions or uncommitted changes; thread/compact/start plus a deferred waiter on the next turn/started that ignores already-known turn IDs. Turn starts (slash commands and normal sends) share a semaphore, and known turn IDs are tracked on thread open/read/rollback. Process exit/close fails pending compact waiters.

Reviewed by Cursor Bugbot for commit 21bf969. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 6d0a2e55-0785-4b83-ae64-09819625e652

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Jun 25, 2026
Comment thread apps/server/src/provider/Layers/CodexAdapter.ts
Comment thread apps/server/src/provider/Layers/CodexSessionRuntime.ts Outdated
Comment thread apps/server/src/provider/Layers/CodexSessionRuntime.ts
@StiensWout StiensWout force-pushed the codex/slash-command-support branch from 213da6a to d42359e Compare June 25, 2026 18:58
@StiensWout StiensWout marked this pull request as ready for review June 25, 2026 18:58

@cursor cursor 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.

Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d42359e. Configure here.

Comment thread apps/server/src/provider/Layers/CodexSessionRuntime.ts
Comment thread apps/server/src/provider/Layers/CodexSessionRuntime.ts
Comment thread apps/server/src/provider/Layers/CodexAdapter.ts
@macroscopeapp

macroscopeapp Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

This PR introduces two new user-facing slash commands (/compact and /review) with significant new runtime logic, async coordination patterns, and API integrations. New feature additions that enable new user-facing workflows warrant human review.

You can customize Macroscope's approvability policy. Learn more.

Co-authored-by: Codex <codex@openai.com>
@StiensWout StiensWout force-pushed the codex/slash-command-support branch from d42359e to 21bf969 Compare June 25, 2026 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant