Skip to content

fix(mastra): use portable model aliases#650

Merged
lionello merged 2 commits into
mainfrom
sam/fix-model-configuration-two-a7f4gs
Jul 20, 2026
Merged

fix(mastra): use portable model aliases#650
lionello merged 2 commits into
mainfrom
sam/fix-model-configuration-two-a7f4gs

Conversation

@defang-sam

@defang-sam defang-sam Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

What

Use the portable bare aliases in mastra-extended:

  • chat-default
  • embedding-default

Why

Stable Defang releases recognize the bare aliases. The ai/ spellings previously passed through to LiteLLM, which interpreted ai as an invalid provider and failed only when the application made a model call.

Scope

This branch is based on current main and changes only the two model values in samples/mastra-extended/compose.yaml. It no longer duplicates the open self-updating Mastra feature from #648.

Validation

The CLI from DefangLabs/defang#2175 generates both gateways with the bare aliases and the corrected 0.5 CPU / 2 GiB reservations.

CI tooling fix (added)

The Deploy Changed Samples job was failing at pre-flight config load:

validating .../mastra-extended/compose.yaml: services.app additional properties 'models' not allowed

The test tool (tools/testing) loads each compose file via compose-go only to enumerate empty-valued env vars (config names), and pinned compose-go v2.6.5, whose schema predates the service-level models: binding this sample uses. Bumped it to v2.7.1 — the minimal version that accepts the long-form endpoint_var/model_var binding (no go directive change and no transitive dependency changes). defang compose up was never reached before, so this unblocks the deploy test.

Samples Checklist

✅ All good!

@defang-sam
defang-sam Bot had a problem deploying to deploy-changed-samples July 19, 2026 23:26 Failure
@defang-sam
defang-sam Bot force-pushed the sam/fix-model-configuration-two-a7f4gs branch from 8c8531b to 3cd3c98 Compare July 20, 2026 07:35
@defang-sam
defang-sam Bot had a problem deploying to deploy-changed-samples July 20, 2026 07:35 Failure
@defang-sam defang-sam Bot changed the title fix(mastra): correct model names for the models: syntax + portable CHAT_MODEL override fix(mastra): use portable model aliases Jul 20, 2026
@defang-sam

defang-sam Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

CI note: deploy_changed_samples fails before either changed alias is evaluated. Its staging Compose loader rejects the already-present services.app.models field with additional properties models not allowed; static schema/test/check_samples jobs pass. I have kept this PR scoped to the two alias corrections rather than hiding the loader/schema drift with unrelated changes.

The Deploy Changed Samples CI tool (tools/testing) loads each sample's
compose.yaml via compose-go purely to enumerate empty-valued env vars
(config names) before deploying. It pinned compose-go v2.6.5, whose
schema does not recognize the modern service-level `models:` binding
(endpoint_var/model_var). This caused mastra-extended to fail at
pre-flight config load with:

  validating .../mastra-extended/compose.yaml: services.app additional
  properties 'models' not allowed

before `defang compose up` ever ran. v2.7.1 is the minimal version that
accepts the long-form service `models:` binding (v2.7.0 accepts the
short form only). No `go` directive change and no transitive dependency
changes (v2.7.1 has an identical go.mod to v2.6.5).

Precedent: 64e746e bumped compose-go for the `provider` field.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@defang-sam
defang-sam Bot had a problem deploying to deploy-changed-samples July 20, 2026 13:30 Failure
@lionello
lionello merged commit f586f36 into main Jul 20, 2026
7 of 8 checks passed
@lionello
lionello deleted the sam/fix-model-configuration-two-a7f4gs branch July 20, 2026 13:34
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