Skip to content

Allow creating a new goal after completion - #26681

Merged
etraut-openai merged 2 commits into
mainfrom
etraut/allow-goal-after-completion
Jun 9, 2026
Merged

Allow creating a new goal after completion#26681
etraut-openai merged 2 commits into
mainfrom
etraut/allow-goal-after-completion

Conversation

@etraut-openai

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

Copy link
Copy Markdown
Contributor

Why

Users have indicated that they want an agent to be able to create a new goal for itself after completing the previous goal. Currently, that's not possible because agents cannot overwrite an existing goal even if it's complete. This PR removes this limitation and allows create_goal to overwrite an existing goal if it is in the complete state.

What changed

create_goal now replaces the existing goal only when its status is complete. The replacement is performed atomically in the goal store, creates a fresh active goal with reset usage, and continues to reject creation while any unfinished goal exists. App server clients see a single thread/goal/updated event when the previous goal is replaced with the new one.

The tool description and error message now reflect these semantics.

What didn't change

Agents are not allowed to create a new goal (overwrite their existing goal) if an existing goal is still active, blocked, paused, or in any other state other than "completed".

@etraut-openai
etraut-openai marked this pull request as ready for review June 5, 2026 22:08
@etraut-openai etraut-openai changed the title [codex] Allow creating goals after completion Allow creating goals after completion Jun 5, 2026
@etraut-openai etraut-openai changed the title Allow creating goals after completion Allow creating a new goal after completion Jun 5, 2026
@etraut-openai
etraut-openai force-pushed the etraut/allow-goal-after-completion branch from 29bacfa to c7d48b9 Compare June 8, 2026 04:19

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c7d48b9a0f

ℹ️ 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".


#[tokio::test]
async fn installed_goal_tools_reject_duplicate_goal_creation() -> anyhow::Result<()> {
async fn installed_goal_tools_only_replace_complete_goal() -> anyhow::Result<()> {

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.

P3 Badge Add an end-to-end goal replacement test

Because this changes how the model-facing create_goal tool can advance after update_goal, it is agent logic. The added coverage here exercises the extension harness only; AGENTS.md “Test authoring guidance” requires such features to add an integration test under core/suite using test_codex, so the end-to-end prompt/tool flow can regress unnoticed.

Useful? React with 👍 / 👎.

@jif-oai jif-oai 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.

lgtm

@etraut-openai
etraut-openai force-pushed the etraut/allow-goal-after-completion branch from c7d48b9 to e334749 Compare June 8, 2026 16:16

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e334749c06

ℹ️ 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 on lines +177 to +179
assert_eq!(json!("replacement goal"), result["goal"]["objective"]);
assert_eq!(json!("active"), result["goal"]["status"]);
assert_eq!(json!(0), result["goal"]["tokensUsed"]);

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.

P3 Badge Compare the full replacement response

AGENTS.md Test assertions asks tests to compare whole objects rather than fields when possible. Here the new replacement assertion checks only three fields of the tool result, so regressions to tokenBudget, remainingTokens, timestamps, or extra response shape would still pass; compare the full response object as in the create-goal test above.

Useful? React with 👍 / 👎.

@etraut-openai
etraut-openai merged commit 36bf63a into main Jun 9, 2026
31 checks passed
@etraut-openai
etraut-openai deleted the etraut/allow-goal-after-completion branch June 9, 2026 20:23
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 9, 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