Skip to content

[upstream #16547] PR 16547 follow-up: pass autoExpandTools into tool cards from the host instead of ~/store #212

Description

@berry-13

Finding: LibreChat-AI#16547, local review L-001 (local:7ee31e1:L-001).

useToolAutoExpand in client/src/components/Chat/Messages/Content/disclosure.ts reads the app-global autoExpandTools preference from ~/store via Recoil. The Client State Ownership rule in AGENTS.md says a feature that only consumes a shell preference should receive it through props or a host-supplied context.

This is not new reach. On canary, seven tool cards (ToolCall, WebSearch, RetrievalCall, CodeAnalyze, AskUserQuestionCall, useToolCallState, Wakeup) plus ToolCallGroup each call useRecoilValue(store.autoExpandTools) directly. PR 16547 folds the card reads into one hook and leaves the group-level reads alone.

Proposed change: supply the preference from the message host (for example next to SoleToolContext) and have useToolAutoExpand read it from context, then migrate Wakeup and ToolCallGroup the same way. Touches every tool card and MessageParts, so it does not belong in a single-tool-group bug fix.

Depends on the root PR because useToolAutoExpand only exists on its branch.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: clientreviewctl followups statereadyreviewctl followups staterefactorreviewctl followups state

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions