Skip to content

feat: handle goal usage limits in goal extension#24628

Merged
jif-oai merged 2 commits into
mainfrom
jif/goal-usage-limit
May 27, 2026
Merged

feat: handle goal usage limits in goal extension#24628
jif-oai merged 2 commits into
mainfrom
jif/goal-usage-limit

Conversation

@jif-oai
Copy link
Copy Markdown
Collaborator

@jif-oai jif-oai commented May 26, 2026

Why

The extracted goal runtime needs a host-callable path for turns that stop because the workspace usage limit is reached. In that case, any in-turn goal progress should be accounted before the goal becomes terminal, and active goal accounting must be cleared so later tool-finish or turn-stop handling does not keep charging usage to a stopped goal.

What changed

  • Adds GoalRuntimeHandle::usage_limit_active_goal_for_turn, which accounts current active-goal progress, marks the active or budget-limited thread goal as UsageLimited, records terminal metrics when the status changes, clears active goal accounting, and emits the updated goal event.
  • Covers both active and budget-limited goals in ext/goal/tests/goal_extension_backend.rs, including the invariant that later token/tool events do not add usage after the goal has been usage-limited.

Testing

  • Added usage_limit_active_goal_accounts_progress_and_clears_accounting.
  • Added usage_limit_budget_limited_goal_accounts_remaining_progress.

@jif-oai jif-oai changed the title feat: goal usage limit feat: handle goal usage limits in goal extension May 26, 2026
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: f16ba95d51

ℹ️ 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/runtime.rs
Comment thread codex-rs/ext/goal/src/runtime.rs
@jif-oai
Copy link
Copy Markdown
Collaborator Author

jif-oai commented May 27, 2026

@codex review

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: aa7599ba36

ℹ️ 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/runtime.rs
@jif-oai jif-oai merged commit bc00502 into main May 27, 2026
31 checks passed
@jif-oai jif-oai deleted the jif/goal-usage-limit branch May 27, 2026 11:00
@github-actions github-actions Bot locked and limited conversation to collaborators May 27, 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.

1 participant