/goal rejects long pasted input before Codex can normalize the objective

Resolved 💬 5 comments Opened May 7, 2026 by trevorprater Closed May 7, 2026

What version of Codex CLI is running?

codex-cli 0.128.0

What subscription do you have?

Pro

Which model were you using?

GPT-5.5 xhigh

What platform is your computer?

Darwin 25.2.0 arm64 arm

What terminal emulator and version are you using (if applicable)?

Codex CLI/TUI. Terminal emulator should not affect this path.

What issue are you seeing?

The /goal slash command currently treats the slash-command argument as the final persisted ThreadGoal.objective and rejects it when the expanded objective exceeds MAX_THREAD_GOAL_OBJECTIVE_CHARS (4,000 chars).

That makes long pasted input unusable as the argument to /goal, even when the user intent is reasonable: paste a detailed task brief and let Codex turn it into a concise persisted goal. The current behavior blocks that flow before the model has a chance to normalize the source into a shorter goal.

The 4,000-character cap makes sense for the stored thread goal because it is persisted and repeatedly reinjected. It is less clear that the same cap should apply to raw user-provided /goal source text.

What steps can reproduce the bug?

  1. Enable the goals feature.
  2. Start a Codex CLI/TUI thread.
  3. Paste or type a /goal command whose expanded argument is longer than 4,000 characters, for example:
/goal <paste a detailed task brief longer than 4000 chars>
  1. Submit the command.

Current result: the TUI rejects the input and does not send anything to the model.

What is the expected behavior?

ThreadGoal.objective should stay bounded, but oversized raw /goal source text should be handled as source material for goal creation, not as the final stored objective.

A better flow would be:

  • If the expanded /goal argument is within the persisted objective limit, set the goal directly as today.
  • If the expanded argument exceeds the persisted objective limit but still fits a normal user turn, send a one-shot model turn asking Codex to normalize the source and call create_goal with a concise objective.
  • If the raw source is too large even for that normalization prompt, reject with a goal-specific error and preserve the pasted draft where possible.

Additional information

I have a proposed fix prepared in a fork branch, but this account could not open a PR against openai/codex via gh because GitHub rejected CreatePullRequest for the upstream repo.

Patch branch:
https://github.com/trevorprater/codex/tree/codex/normalize-long-goal-input

Upstream compare URL:
https://github.com/openai/codex/compare/main...trevorprater:codex/normalize-long-goal-input?expand=1

Fork draft PR carrying the patch:
https://github.com/trevorprater/codex/pull/1

Local validation on that branch:

just fmt
cargo test -p codex-tui goal_validation
cargo test -p codex-tui
just fix -p codex-tui

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗