Skip to content

🧹 fix: Order Enabled Guard After Config Expansion in useGetAgentByIdQuery#13927

Merged
danny-avila merged 1 commit into
danny-avila:devfrom
newjersey:dlew/fix-use-get-agent-by-id-query-enabled-guard
Jun 23, 2026
Merged

🧹 fix: Order Enabled Guard After Config Expansion in useGetAgentByIdQuery#13927
danny-avila merged 1 commit into
danny-avila:devfrom
newjersey:dlew/fix-use-get-agent-by-id-query-enabled-guard

Conversation

@dlew

@dlew dlew commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Otherwise, it's possible for a config to override the isValidAgentId check.

Without that check, it's possible to query getAgentById() with a blank agent_id, which can result in polluting the QueryKeys.agent cache with a full list of agents (instead of just a single agent result).

Change Type

  • Bug fix (non-breaking change which fixes an issue)

Testing

This broke on our New Jersey fork for reasons that aren't related to core LibreChat. But basically, use getAgentById() w/ a null agent_id but a defined { enabled: true }, and it'll pollute the query cache.

Checklist

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • My changes do not introduce new warnings
  • Local unit tests pass with my changes

Otherwise, it's possible for a config to override the `isValidAgentId` check.

Without that check, it's possible to query `getAgentById()` with a blank `agent_id`,
which can result in polluting the `QueryKeys.agent` cache with a full list of agents
(instead of just a single agent result).
@danny-avila danny-avila changed the title fix: moved enabled after config expansion in useGetAgentByIdQuery() 🧹 fix: Order Enabled Guard After Config Expansion in useGetAgentByIdQuery Jun 23, 2026
@danny-avila
danny-avila merged commit f09a1ad into danny-avila:dev Jun 23, 2026
17 checks passed
@dlew
dlew deleted the dlew/fix-use-get-agent-by-id-query-enabled-guard branch June 23, 2026 21:30
fuuuzzy pushed a commit to fuuuzzy/LibreChat that referenced this pull request Jul 7, 2026
…Query` (danny-avila#13927)

Otherwise, it's possible for a config to override the `isValidAgentId` check.

Without that check, it's possible to query `getAgentById()` with a blank `agent_id`,
which can result in polluting the `QueryKeys.agent` cache with a full list of agents
(instead of just a single agent result).
ThomasVuNguyen pushed a commit to ThomasVuNguyen/LibreChat that referenced this pull request Jul 15, 2026
…Query` (danny-avila#13927)

Otherwise, it's possible for a config to override the `isValidAgentId` check.

Without that check, it's possible to query `getAgentById()` with a blank `agent_id`,
which can result in polluting the `QueryKeys.agent` cache with a full list of agents
(instead of just a single agent result).
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