Skip to content

fix: model association page throws Invalid input for channels without endpoints#1746

Merged
looplj merged 1 commit into
looplj:unstablefrom
djdembeck:fix/allow-null-channel-summary-endpoints
May 30, 2026
Merged

fix: model association page throws Invalid input for channels without endpoints#1746
looplj merged 1 commit into
looplj:unstablefrom
djdembeck:fix/allow-null-channel-summary-endpoints

Conversation

@djdembeck

@djdembeck djdembeck commented May 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Allows null for endpoints field in channelSummarySchema to fix Zod validation error when backend returns endpoints: null for legacy channels without custom endpoints configured.

Background

Where it was introduced

Commit 74d223c6 ("feat(llm): support responses websocket sessions #1730") added the endpoints field to the allChannelSummarys GraphQL query. This query returns channel summaries for the model association settings page.

What error it caused

When loading the model association page (/settings/models), the frontend queries allChannelSummarys which includes the endpoints field. For legacy channels that have no custom endpoint overrides configured, the backend returns:

{
  "endpoints": null
}

The Zod schema previously defined:

endpoints: z.array(channelEndpointSchema).optional().default([])

This doesn't allow null, causing Zod to throw "Invalid input" for each channel in the list:

Validation failed: edges.0.node.endpoints: Invalid input, edges.1.node.endpoints: Invalid input, ...

Solution

Added .nullable() to the schema:

endpoints: z.array(channelEndpointSchema).optional().default([]).nullable()

This allows the field to be null (from backend) while still defaulting to [] for new channels.

Testing

  • Verified schema accepts payload with endpoints: null
  • Verified legacy channels without custom endpoints work correctly

- prevents Zod validation error when backend returns endpoints: null
for legacy channels that have no custom endpoints configured

Closes looplj#1746
@greptile-apps

greptile-apps Bot commented May 29, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds .nullable() to the endpoints field in channelSummarySchema so that legacy channels that return endpoints: null from the backend pass Zod validation without an error. The change mirrors the existing pattern already applied to the tags field on the same schema.

  • schema.ts: one-line change on the endpoints field to match the tags nullable pattern, resolving the validation failure on the settings page for legacy channels.
  • All downstream consumers (channels-endpoints-dialog.tsx, channels-action-dialog.tsx) already guard against null via ?? [] and optional chaining, so no additional changes are needed.

Confidence Score: 5/5

Safe to merge — a one-line targeted fix that unblocks the settings page for legacy channels.

The change is a minimal, focused schema relaxation that mirrors an identical pattern already used for the tags field on the same object. Every downstream consumer of endpoints already uses null-safe access (?? [] or optional chaining), so the newly admitted null value cannot cause a runtime error in the UI.

No files require special attention.

Important Files Changed

Filename Overview
frontend/src/features/channels/data/schema.ts Added .nullable() to the endpoints field in channelSummarySchema to accept null from the backend; consistent with the existing tags field pattern and safely handled by all consumers.

Sequence Diagram

sequenceDiagram
    participant Backend
    participant ZodParser as Zod Parser (channelSummarySchema)
    participant Component as React Component

    Backend->>ZodParser: "{ endpoints: null } (legacy channel)"
    Note over ZodParser: Before: validation error – null not accepted
    Note over ZodParser: After: .nullable() accepts null, passes through
    ZodParser->>Component: "{ endpoints: null }"
    Component->>Component: channel.endpoints ?? [] → []
    Component->>Component: channel?.endpoints?.find(...) → undefined
Loading

Reviews (1): Last reviewed commit: "fix(frontend): allow null endpoints in c..." | Re-trigger Greptile

@djdembeck djdembeck changed the title fix(frontend): allow null endpoints in channelSummarySchema fix: model association page throws Invalid input for channels without endpoints May 29, 2026
@looplj looplj merged commit 88d2a59 into looplj:unstable May 30, 2026
4 checks passed
junjiangao pushed a commit to junjiangao/axonhub that referenced this pull request May 30, 2026
)

- prevents Zod validation error when backend returns endpoints: null
for legacy channels that have no custom endpoints configured

Closes looplj#1746
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