Skip to content

fix(agents): show reasoning effort button for agent session reasoning models#13569

Open
DeJeune wants to merge 2 commits intomainfrom
DeJeune/reasoning-btn-fix
Open

fix(agents): show reasoning effort button for agent session reasoning models#13569
DeJeune wants to merge 2 commits intomainfrom
DeJeune/reasoning-btn-fix

Conversation

@DeJeune
Copy link
Collaborator

@DeJeune DeJeune commented Mar 17, 2026

What this PR does

Before this PR:

When selecting a reasoning model (e.g., Claude with extended thinking, o3) in an agent session, the reasoning effort / thinking button was invisible — users could not configure thinking intensity.

After this PR:

The reasoning effort button correctly appears for reasoning models in agent sessions, matching the behavior in normal chat.

image

Why we need it and why it was done in this way

Root cause: InputbarTools internally called useAssistant(assistantId) to resolve the assistant and model. For agent sessions, the assistantId is an agent ID that doesn't exist in the Redux state.assistants.assistants array. This caused:

  1. assistant resolved to undefined (cast as Assistant)
  2. model fell back to the global defaultModel (e.g., gpt-4o)
  3. The thinking tool's condition: isReasoningModel(model) returned false
  4. The button was filtered out of availableTools entirely

The fix: Pass assistant and model as props from the caller (which already has the correct data) instead of having InputbarTools fetch them internally via useAssistant.

The following tradeoffs were made:

  • Removes useAssistant from InputbarTools, making it a controlled component that relies on the caller to provide assistant/model data. This is a minor interface change but makes the component more predictable and reusable.

The following alternatives were considered:

  1. Add modelOverride prop as a fallback — Would keep useAssistant as the primary source and only override when needed. Rejected because it's a band-aid that doesn't address the root cause: useAssistant is being called with an ID that fundamentally cannot exist in Redux for agent sessions.

  2. Dispatch agent assistant stub into Redux store — Would make useAssistant(agentId) find the assistant naturally. Rejected because:

    • The stub would appear in the assistants sidebar UI (no type-based filtering exists)
    • It would be persisted by redux-persist, polluting storage
    • useAssistant's useEffect would sync reasoning effort settings back to Redux, conflicting with agent session's local state management
    • Requires cleanup on unmount with potential race conditions
    • Redux data model changes are currently blocked until v2.0.0
  3. Pass props from caller (chosen approach) — The simplest fix. Both callers (Inputbar and AgentSessionInputbar) already have the correct assistant and model. Three files changed, ~9 lines added / ~7 removed.

Breaking changes

None. Internal component interface change only — InputbarTools is not exported as a public API.

Special notes for your reviewer

The assistantId prop was removed from InputbarToolsNewProps since assistant.id provides the same information. No external consumers exist.

Checklist

Release note

fix: reasoning effort button now appears correctly when using reasoning models in agent sessions

… models

InputbarTools used useAssistant(assistantId) to resolve the model, but
agent session IDs don't exist in the Redux assistants store. This caused
the model to fall back to the global defaultModel, which is typically
not a reasoning model, so the thinking tool's condition check
(isReasoningModel) failed and the button was filtered out.

Fix by passing assistant and model as props from the caller, which
already has the correct data, instead of having InputbarTools fetch
internally via useAssistant.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: suyao <sy20010504@gmail.com>
Copy link
Contributor

@cherry-ai-bot cherry-ai-bot bot left a comment

Choose a reason for hiding this comment

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

The latest update addresses the non-null assertion concern cleanly. AgentSessionInputbar now passes assistant.model without forcing !, and InputbarTools accepts an optional model override while falling back to assistant.model internally. That keeps the original fix intact for agent-session reasoning models without introducing a new runtime hazard. I do not see any remaining blocking issues in the current patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants