Gate goal tools by thread eligibility#24925
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 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) |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
this is in sync with the old behaviour
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
GoalRuntimeConfigthat separates goal enablement from whether goal tools are available for the current thread.persistent_thread_state_availableandSessionSource, hiding tools for review subagents.GoalRuntimeHandle::tools_visible()when contributing thread tools so enabled runtime state does not automatically imply tool exposure.Testing
goal_tools_hidden_for_ephemeral_threads.goal_tools_hidden_for_review_subagents.