Skip to content

fix(catalog): carry Together /models array fix onto dev2-go (#639) - #682

Merged
Wibias merged 2 commits into
lidge-jun:dev2-gofrom
Wibias:sync/639-to-dev2-go
Jul 29, 2026
Merged

fix(catalog): carry Together /models array fix onto dev2-go (#639)#682
Wibias merged 2 commits into
lidge-jun:dev2-gofrom
Wibias:sync/639-to-dev2-go

Conversation

@Wibias

@Wibias Wibias commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

Go port

Ported nowgo/internal/codex/catalog_provider_fetch.go accepts top-level /models arrays (Together AI) and {data:[...]}, matching the TS oracle. Catalog discovery still rejects stray {models:[...]} (probe-only on TS).

Management probe on Go uses the injected fetchModels path (catalog fetch), so the Go catalog fix covers the #617 discovery failure mode.

Test plan

  • Cherry-pick of 9d181fc4 applied
  • go test ./internal/codex/ -run FetchProviderModels|ProviderModelsAPIItems
  • bun test ./tests/provider-connection-test.test.ts
  • CI on dev2-go

Wibias added 2 commits July 29, 2026 09:18
* fix(catalog): accept Together top-level /models arrays

Closes lidge-jun#617

* fix(catalog): keep models[] for probe only; array+data for discovery

(cherry picked from commit 9d181fc)
…#639)

Align FetchProviderModels with the TS oracle: accept top-level arrays
and {data:[...]}, reject stray {models} for catalog discovery.
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (2)
  • ^dev$
  • ^preview$

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 5cad3242-a222-441b-b9dd-4e4c6f92f067

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

@Wibias Wibias changed the title fix(catalog): carry Together /models array fix onto dig2-go (#639) fix(catalog): carry Together /models array fix onto dev2-go (#639) Jul 29, 2026
@github-actions github-actions Bot added the bug Something isn't working label Jul 29, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 549c4bcb92

ℹ️ 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".

if err := json.Unmarshal(trimmed, &items); err != nil {
return nil, false
}
return items, true

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject malformed items in top-level model arrays

When a top-level /models array contains null, {}, or an entry whose id is blank, unmarshalling into []ProviderModelsAPIItem succeeds and this branch reports the payload as valid. FetchProviderModels then skips those rows, marks discovery successful, and caches an empty or partial authoritative catalog instead of retaining the stale/configured fallback; the TypeScript path rejects the entire malformed list. Validate every decoded item has a nonblank ID before returning success.

Useful? React with 👍 / 👎.

const data = json !== null && typeof json === "object" && !Array.isArray(json)
? (json as { data?: unknown }).data
: undefined;
const data = providerModelsListFromResponse(json);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Add direct regression coverage for catalog discovery

The new Bun test exercises POST /api/providers/test, which calls providerModelsListFromProbeResponse; it never reaches the changed fetchProviderModels path or providerModelsListFromResponse. The TypeScript catalog behavior this change is intended to deliver can therefore regress while the added test remains green. Add a top-level-array case alongside the existing catalog discovery tests, exercising gatherRoutedModels or fetchProviderModels directly.

AGENTS.md reference: src/AGENTS.md:L22-L25

Useful? React with 👍 / 👎.

@Wibias
Wibias merged commit 78a9cee into lidge-jun:dev2-go Jul 29, 2026
8 of 12 checks passed
@Wibias

Wibias commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator Author

Merged. Cross-platform CI had known dig2-go flakes unrelated to this change (prepare-release-assets GNU tar -s / Windows npm pack mode 420) — same class as #681.

Go decision

Ported now in this PR (go/internal/codex/catalog_provider_fetch.go + tests). No needs-go-port issue.

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant