Skip to content

Gate goal tools by thread eligibility#24925

Merged
jif-oai merged 1 commit into
mainfrom
jif/goal-thread-tool-eligibility
May 28, 2026
Merged

Gate goal tools by thread eligibility#24925
jif-oai merged 1 commit into
mainfrom
jif/goal-thread-tool-eligibility

Conversation

@jif-oai
Copy link
Copy Markdown
Collaborator

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

Why

Goal tools create and update goal state for a persistent thread. The extension was only checking whether goals were enabled before advertising those tools, which meant they could be surfaced in contexts that should not receive thread goal controls: ephemeral threads without persistent thread state and review subagents.

Those sessions can still run the goal extension lifecycle, but the thread tools should only be visible when the current thread can safely use them.

What changed

  • Adds a GoalRuntimeConfig that separates goal enablement from whether goal tools are available for the current thread.
  • Computes tool eligibility on thread start from persistent_thread_state_available and SessionSource, hiding tools for review subagents.
  • Uses GoalRuntimeHandle::tools_visible() when contributing thread tools so enabled runtime state does not automatically imply tool exposure.
  • Adds backend coverage for hiding goal tools on ephemeral threads and review subagents.

Testing

  • Added goal_tools_hidden_for_ephemeral_threads.
  • Added goal_tools_hidden_for_review_subagents.

@jif-oai jif-oai changed the title feat: goal ext thread tools elligibility Gate goal tools by thread eligibility May 28, 2026
@jif-oai
Copy link
Copy Markdown
Collaborator Author

jif-oai commented May 28, 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: 461524b5d6

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

let tools_available_for_thread = input.persistent_thread_state_available
&& !matches!(
input.session_source,
SessionSource::SubAgent(SubAgentSource::Review)
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.

P2 Badge Hide goal tools for guardian review sessions

When auto-approval review uses the reusable guardian reviewer, the spawned session is tagged as SessionSource::SubAgent(SubAgentSource::Other("guardian")) in codex-rs/core/src/guardian/review_session.rs:607, and build_guardian_review_session_config does not disable Feature::Goals. In that non-ephemeral review session this exact SubAgentSource::Review check still leaves goal tools visible, so reviewer agents can still see and call create/update goal tools despite this gate trying to suppress goal controls in review contexts.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is in sync with the old behaviour

@jif-oai jif-oai merged commit e426d48 into main May 28, 2026
31 checks passed
@jif-oai jif-oai deleted the jif/goal-thread-tool-eligibility branch May 28, 2026 15:47
@github-actions github-actions Bot locked and limited conversation to collaborators May 28, 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