Skip to content

fix(app): give custom-provider context-window failures an actionable message - #1646

Merged
jhrozek merged 1 commit into
mainfrom
worktree-fix-provider-name-validation
Sep 17, 2026
Merged

jhrozek merged 1 commit into
mainfrom
worktree-fix-provider-name-validation

Conversation

@jhrozek

@jhrozek jhrozek commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • A custom (operator-defined) provider whose live model listing fails has no embedded catalog to fall back to, so mecatl correctly refuses inference until discovery succeeds or an override is configured — but the failure was hard to act on. contextWindowUnavailable named the models.context_windows key without showing its shape, and statusHintFor gave every custom provider an empty remediation hint even though the common real cause (the API key works for inference but the gateway's listing endpoint 401s, because some OpenAI-compatible gateways authorize or implement listing differently from completions) is worth naming.

Development stage

  • Spike / Routine — acceptance-plan spine exempt; Spike evidence does not ship as-is

Contract linkage

  • Work classification: Routine
  • Classification rationale: diagnostics message and doc wording only; no admission/gating behavior change, no interface/config schema change, no ADR-level decision touched. The fail-closed design for a live-listable custom provider with no catalog floor is unchanged.
  • Decision record: None — no behavioral change
  • Human waiver of spine: N/A (Routine)
  • Acceptance plan: N/A (Routine)
  • Human decisions resolved and recorded: N/A
  • Plan / Interface PR: N/A
  • Approved commit baseline: N/A
  • Combined/exemption rationale: N/A

Interface conformance

  • N/A — no interface change.

Issue relationship

Relates to a user support report about custom OpenAI-compatible provider setup (no tracked issue number).

Type of change

  • Bug fix
  • Documentation/process

Test plan

Baseline checks

  • Offline test suite (targeted: go test ./internal/app/..., all green; updated two tests that pinned the previous "no hint" behavior)
  • Markdown changed: docs generation/link checks (task docs — 0 broken links/anchors)
  • Linting (task lint) — skipped: local golangci-lint binary is built against Go 1.26, older than this repo's Go 1.27 toolchain requirement, so it refuses to load config in this environment. go build ./... and go vet ./... are clean.
  • Offline demo (go run ./cmd/mecademo) — not run this session; no engine/agent-loop code touched.
  • Full task test — not run (long-running full-repo suite); ran the targeted internal/app package instead, plus confirmed one unrelated pre-existing failure (TestCommandRunnerEnvironment_Scenario2_DefaultScrub, environment-dependent on this machine) reproduces identically with this diff stashed out.

Changes

File Change
internal/app/modellister.go contextWindowUnavailable error now includes a concrete models.context_windows.<provider>.<model>: 128000 example
internal/app/registry.go statusHintFor gains a generic, non-vendor-specific hint for any operator-defined custom provider (previously always "")
internal/app/operator_defined_providers_test.go Updated two tests that pinned the previous "no hint" behavior to expect the new generic hint
user-docs/mecatui/troubleshooting.md Extends the existing "A custom model is listed but requests fail" entry with the startup-log signature and a curl check for the listing-vs-inference auth gap (kept as an extension, not a new section, since user-docs/features/choose-models.md and this same troubleshooting page already document the naming rule and the models.context_windows override in detail as of #1636)

User-facing change

  • The context window unavailable error now shows the exact YAML shape of the override instead of only naming the config key.
  • mecatui providers status / the /models picker's provider-status hint is no longer blank for a custom provider whose live listing failed — it now explains the likely listing-vs-inference auth gap.
  • Troubleshooting docs gain a short pointer to the startup-log signature and a curl check for this failure mode.

Special notes for reviewers

  • This branch originally also modified user-docs/mecatui/index.md and added a separate "context window unavailable" troubleshooting section, but fix(mecatui): clarify provider onboarding #1636 (merged on top of this branch's base) already covers both the provider-naming rule and the models.context_windows override in more detail. Those two doc hunks were dropped in favor of extending fix(mecatui): clarify provider onboarding #1636's existing section, to avoid two treatments of the same ground.
  • No admission/gating behavior changes — this is diagnostics and docs only.

🤖 Generated with Claude Code

…message

A custom (operator-defined) provider whose live model listing fails
has no embedded catalog to fall back to, so mecatl correctly refuses
inference until discovery succeeds or an override is configured — but
the failure was hard to act on: the terminal contextWindowUnavailable
error named the config key without showing its shape, and
statusHintFor gave every custom provider an empty hint even though the
one real gap ("the key works for inference but listing itself 401s,
because some OpenAI-compatible gateways authorize or implement listing
differently from completions") is common and worth naming.

- contextWindowUnavailable now includes a concrete
  models.context_windows.<provider>.<model>: <tokens> example instead
  of only naming the key.
- statusHintFor gains a generic (not vendor-specific) hint for any
  operator-defined custom provider, mirroring the existing
  ToolHive/Codex hint tables.
- Extend the existing "A custom model is listed but requests fail"
  troubleshooting entry with the startup-log signature and a curl
  check for the listing-vs-inference auth gap, rather than adding a
  separate duplicate section (user-docs/features/choose-models.md and
  troubleshooting.md already cover the naming rule and the
  models.context_windows override in detail as of #1636).

No admission/gating behavior changes — this is diagnostics and docs
only; the fail-closed design for a live-listable provider with no
catalog floor is unchanged.

Co-authored-by: mecatl <[email protected]>
@jhrozek
jhrozek merged commit 5a47fdf into main Sep 17, 2026
35 checks passed
@jhrozek
jhrozek deleted the worktree-fix-provider-name-validation branch September 17, 2026 08:31
@toolhive-release-app toolhive-release-app Bot mentioned this pull request Sep 21, 2026
2 tasks

This branch was successfully deployed

1 active deployment
Preview — 15efe8be Deployed Sep 16, 2026 by vercel[bot]
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.

1 participant