Skip to content

Block active goals after terminal turn errors#26690

Merged
etraut-openai merged 1 commit into
mainfrom
etraut/block-goals-on-terminal-turn-errors
Jun 5, 2026
Merged

Block active goals after terminal turn errors#26690
etraut-openai merged 1 commit into
mainfrom
etraut/block-goals-on-terminal-turn-errors

Conversation

@etraut-openai
Copy link
Copy Markdown
Collaborator

@etraut-openai etraut-openai commented Jun 5, 2026

Why

Terminal turn errors can leave a goal active. Automatic goal continuation may then repeatedly hit a permanent failure, including compaction requests rejected with HTTP 400, and consume excessive tokens.

This PR changes the goal extension to treat all turn-ending errors (including non-retryable errors and retryable errors that have exceeded their retry count) as "blocking" for the goal. The downside to this change is that there are some errors that may eventually succeed (e.g. a 429 due to a service outage), and previously the goal runtime would have kept the agent going in these situations.

What changed

  • Block the current active goal when a turn ends with an error other than a usage-limit error.
  • Preserve the existing usage_limited transition for usage-limit errors.
  • Share progress accounting, guarded state updates, metrics, and event emission in the goal runtime.

@etraut-openai etraut-openai marked this pull request as ready for review June 5, 2026 22:40
Copy link
Copy Markdown
Contributor

@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: 83f0691fb4

ℹ️ 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 codex-rs/ext/goal/src/extension.rs
Comment thread codex-rs/ext/goal/tests/goal_extension_backend.rs
@etraut-openai etraut-openai merged commit c62d792 into main Jun 5, 2026
31 checks passed
@etraut-openai etraut-openai deleted the etraut/block-goals-on-terminal-turn-errors branch June 5, 2026 22:54
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants