Skip to content

feat(native-chat): suggested prompts in Codex chats - #48472

Merged
AmoabaKelvin merged 1 commit into
mainfrom
codex-suggested-prompts
Nov 24, 2026
Merged

AmoabaKelvin merged 1 commit into
mainfrom
codex-suggested-prompts

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

ELI5

Codex chats now guess what you'll type next and show it as grey text in the empty message box, the same way Claude chats already do. Press Tab to use it. Nothing is sent unless you do.

Files Added Deleted Net
Test 0 0 0 0
Prod 19 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​207 $\color{#cf222e}{\Huge{\mathbf{−}}}$​40 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​167

What Changed

Before: suggested prompts only appeared after Claude replies. A Codex chat always showed "Ask anything…".

After: when a Codex turn finishes, Orca asks Codex for a guess at your next message. If one comes back, the empty composer shows it. Starting the next turn clears it.

How it works: Codex's app-server has thread/sample (0.164 and later, behind the experimentalApi capability Orca already sends at initialize). It runs one turn on a hidden, throwaway fork of the thread, using the thread's own model and auth with the prompt cache, and returns the text. The fork never touches the real thread or writes a rollout. This is the same call the Codex desktop app uses for its composer predictions, and Orca sends the same composer_prediction request metadata.

  • Only runs while a chat that shows suggestions is open and the Suggested prompts setting is on, through the existing interest signal the Claude path uses.
  • Only after a turn that ended completed, on the main thread (not subagents).
  • A guess that arrives after a send, a new turn or a relaunch is dropped. Codex also rejects a sample whose source turn is no longer the latest.
  • On a Codex without thread/sample, the first refusal turns it off for that process.
  • The setting's copy now says "Claude or Codex" and "that agent's usage", in all 12 languages.

Why

#48405 asks for suggestions in Codex and Pi chats, because Codex is many people's main agent and Claude's suggestions cost Claude usage. The open-source app-server declares a thread/prediction/updated notification but never sends it (thread/prediction/request returns "not implemented yet" through 0.174 alpha), so Orca has to ask with thread/sample itself. Generating the guess in Orca with its own model call would mean copying each provider's auth, which isn't practical.

Linked Issue

Part of #48405. This covers Codex only. Pi still needs a way to feed a guess back (an Orca Pi extension is the likely route), so the issue stays open.

Visual Proof

Before: after a Codex reply, the composer showed only "Ask anything, @ to mention files, / for commands".

After: a real Codex 0.167.2 chat in a hidden dev build. The grey text in the composer is Codex's guess.

codex-prompt-suggestion.png

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below
  • Every added test fails without this change and avoids the test anti-patterns

macOS, hidden dev build, Codex 0.167.2, two fresh chats and one resumed chat over eight turns:

  • Every turn that left a next step got a guess, typically 5–10 s after the reply. Example guesses: "Read todo.py and tell me what commands it supports.", "Implement add and list commands in todo.py, saving todos to a local JSON file." "Thanks, that's all for now." got none.
  • Tab put the guess into the composer. Sending the next message cleared it at once.
  • Switching tabs moved interest to the visible chat. The transcript showed no extra rows from the samples, and no rollout files were left for them.
  • Probed the protocol directly as well: a stale expectedTurnId is refused with "sample source turn must be the latest finished turn".

No unit test. The logic is wiring plus stale checks, and the run above covers it.

Performance

One extra model request per finished Codex turn, and only while that chat is open with the setting on. In the runs above each request was about 27k input tokens, 75–98% of them cached, plus 30–190 output tokens. Nothing changes for the main process, renderer or disk.

Risk

Each guess counts toward the user's Codex usage, unless OpenAI exempts requests tagged composer_prediction (the issue says the desktop app's are free during the beta). Orca can't confirm that. The setting turns it off, and its copy now says so for Codex too. If a sample misbehaves, the worst case is a missing or stale grey hint. A plain revert backs it out.

Level: Low

AI Disclosure

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

The host adapter publishes the guess, so SSH and paired hosts get it once they run this build. An older host publishes nothing, as today. Mobile doesn't show suggestions for any agent yet.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

Codex's app-server can sample a hidden fork of the thread (`thread/sample`),
which is how its desktop app makes composer predictions.
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Walkthrough

Codex sessions can now request prompt predictions after completed turns when the setting is enabled and a reader is interested. The adapter validates responses and checks session and turn state before publishing suggestions. Method-refusal detection is shared with background terminal handlers. The adapter also delegates live-provider-process checks to a new predicate. Settings descriptions and translations now refer to both Claude and Codex.

Merge Risk: Low · up to 6a465

Codex chats gain suggested prompts. A suggestion can still appear after the user turns the setting off, and the settings text may misstate whether suggestions count toward usage. Both are small issues to fix before or soon after merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "feat(native-chat): suggested prompts in Codex chats" names the main change: suggested prompts (grey composer hints) now appear in Codex chats. The changeset adds CodexComposerPredictions, t…
Description check Passed The description follows the template: ELI5, What Changed, Why, Linked Issue (Part of #48405, which is a partial link rather than a closing reference), Visual Proof with before/after, Testing, Performa…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "feat(native-chat): suggested prompts in Codex chats" names the main change: suggested prompts (grey composer hints) now appear in Codex chats. The changeset adds CodexComposerPredictions, the thread/sample request, and the settings copy update for Codex. The title is specific and matches the primary change.

Full details: Description check

Explanation

The description follows the template: ELI5, What Changed, Why, Linked Issue (Part of #48405, which is a partial link rather than a closing reference), Visual Proof with before/after, Testing, Performance, Risk with level Low, Agent skill upstream boundary, Notes, and Checklist. Gaps: the AI Disclosure section is empty, the Review section is empty, and the Linked Issue uses 'Part of' instead of 'Fixes #'. The checklist leaves lint, typecheck, test, and build unchecked, and no unit test was added, which the author explains. The description is substantially complete.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

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

Actionable comments posted: 3

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b591aa9d-4005-4a3c-98da-9e93c32048e6
Commits

Reviewing files that changed from the base of the PR and between a8396ef and 6a46589.

Files selected for processing: 19

  • src/main/codex/app-server/codex-app-server-request-error.ts
  • src/main/codex/structured/background-work/codex-background-terminals.ts
  • src/main/codex/structured/session-lifecycle/codex-live-provider-process.ts
  • src/main/codex/structured/session-lifecycle/codex-structured-session-adapter.ts
  • src/main/codex/structured/session-lifecycle/codex-structured-session-state.ts
  • src/main/codex/structured/turns/codex-composer-predictions.ts
  • src/main/runtime/agent-session/installation/structured-agent-runtime-registrations.ts
  • src/renderer/src/components/settings/chat/chat-behavior-search.ts
  • src/renderer/src/i18n/locales/de.json
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/pt.json
  • src/renderer/src/i18n/locales/ru.json
  • src/renderer/src/i18n/locales/tr.json
  • src/renderer/src/i18n/locales/zh-Hant.json
  • src/renderer/src/i18n/locales/zh.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

session.ended ||
session.dispatchPending ||
(session.activeTurnIds?.size ?? 0) > 0 ||
!this.readers.has(sessionId)

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.

Minor · Functional Correctness · Quick win

Re-check the Suggested prompts setting before publishing a pending sample.

When the user disables Suggested prompts during a thread/sample request, the result can still reach the composer. The setting is read only before the request starts. The publish guard checks reader interest, but reader interest does not change when the setting changes, and the delivery path does not read the setting. Add the same setting check to the publish guard so a disabled setting drops the stale result.

Suggested fix

--- "a/src/main/codex/structured/turns/codex-composer-predictions.ts"
+++ "b/src/main/codex/structured/turns/codex-composer-predictions.ts"
@@ -126,10 +126,11 @@
       state.sourceTurnId !== turnId ||
       this.sessions.get(sessionId) !== session ||
       session.ended ||
       session.dispatchPending ||
       (session.activeTurnIds?.size ?? 0) > 0 ||
-      !this.readers.has(sessionId)
+      !this.readers.has(sessionId) ||
+      !(this.deps().promptSuggestions?.() ?? false)
     ) {
       return
     }
     session.events?.setPromptSuggestion?.(suggestion)
Committable suggestion

IMPORTANT
Review the replacement and indentation, then test before committing.

Suggested change
!this.readers.has(sessionId)
!this.readers.has(sessionId) ||
!(this.deps().promptSuggestions?.() ?? false)

"turnDiffsSearchEdits": "edits",
"promptSuggestionsTitle": "Suggested prompts",
"promptSuggestionsCopy": "After Claude replies, its guess at your next message shows in the empty message box. Press Tab to use it. Each guess is an extra request that counts toward your Claude usage.",
"promptSuggestionsCopy": "After Claude or Codex replies, its guess at your next message shows in the empty message box. Press Tab to use it. Each guess is an extra request that counts toward that agent's usage.",

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.

Minor · Functional Correctness · Quick win

Remove the Codex usage claim from the composer prediction copy.

The promptSuggestionsCopy string states that each suggestion counts toward the agent's usage. For Codex, OpenAI's documentation says composer predictions do not count toward Codex usage limits or consume credits during the beta. Users who read the string receive incorrect billing information about Codex.

Correct the Codex part of the sentence so it matches the documented beta behavior. The string applies to both agents, so the sentence needs restructuring. Choose the exact wording and whether to add a beta condition. Apply the same change to the matching promptSuggestionsCopy key in the other 11 locale files that this PR changes.

"turnDiffsSearchEdits": "düzenlemeler",
"promptSuggestionsTitle": "Önerilen istemler",
"promptSuggestionsCopy": "Claude yanıt verdikten sonra, bir sonraki mesajınız için tahmini boş mesaj kutusunda görünür. Kullanmak için Tab tuşuna basın. Her tahmin, Claude kullanımınıza sayılan ek bir istektir.",
"promptSuggestionsCopy": "Claude veya Codex yanıt verdikten sonra, bir sonraki mesajınız için tahmini boş mesaj kutusunda görünür. Kullanmak için Tab tuşuna basın. Her tahmin, o ajanın kullanımına sayılan ek bir istektir.",

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.

Minor · Functional Correctness · Quick win

Remove the unconditional usage claim from the prediction copy.

The string says every prediction counts toward the agent's usage. The PR states that this accounting is unconfirmed for composer_prediction requests. The official Codex beta documentation also says prediction generation does not count toward usage limits. The copy therefore asserts a usage effect that the available evidence does not support, and it may mislead users about cost.

Change the sentence so it does not state a usage effect as fact. Keep the Claude and Codex scope and the Tab behavior. Apply the same change to the matching prediction-copy strings in the other two translations named in the comment.

@AmoabaKelvin
AmoabaKelvin merged commit 4624954 into main Nov 24, 2026
54 checks passed
Jinwoo-H pushed a commit that referenced this pull request Nov 24, 2026
Codex's app-server can sample a hidden fork of the thread (`thread/sample`),
which is how its desktop app makes composer predictions.
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