Skip to content

feat(compose): update Docker Model Runner syntax support - #2148

Merged
lionello merged 1 commit into
mainfrom
jordan/update-docker-compose-model-runner-syntax
Jun 23, 2026
Merged

feat(compose): update Docker Model Runner syntax support#2148
lionello merged 1 commit into
mainfrom
jordan/update-docker-compose-model-runner-syntax

Conversation

@jordanstephens

@jordanstephens jordanstephens commented Jun 23, 2026

Copy link
Copy Markdown
Contributor
  • Warn on context_size and runtime_flags in model definitions (Docker Model Runner-only parameters, not applicable to cloud deployments)
  • Deprecate provider: type: model beta syntax with a warning pointing to the top-level models: form; behavior is preserved for compatibility
  • Add withmodelvar fixture to cover the untested model_var override path in wireDependentServices

Description

Linked Issues

Checklist

  • I have performed a self-review of my code
  • I have added appropriate tests
  • I have updated the Defang CLI docs and/or README to reflect my changes, if necessary

Summary by CodeRabbit

  • Bug Fixes

    • Added warnings for unsupported model parameters (context_size, runtime_flags) in cloud deployments.
    • Added deprecation warning for legacy provider type syntax.
  • Refactor

    • Streamlined model configuration handling by removing duplicated logic.
    • Improved model-related warning emission and access gateway service construction.
  • Tests

    • Added test coverage for model variable-based configurations.

- Warn on `context_size` and `runtime_flags` in model definitions (Docker
  Model Runner-only parameters, not applicable to cloud deployments)
- Deprecate `provider: type: model` beta syntax with a warning pointing
  to the top-level `models:` form; behavior is preserved for compatibility
- Add `withmodelvar` fixture to cover the untested `model_var` override
  path in wireDependentServices

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jordanstephens
jordanstephens requested a review from lionello as a code owner June 23, 2026 02:07
@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c75e6073-f997-44fe-a5e8-60fcfa012213

📥 Commits

Reviewing files that changed from the base of the PR and between 2366141 and 1200f05.

📒 Files selected for processing (6)
  • src/pkg/cli/compose/fixup.go
  • src/testdata/models/compose.yaml
  • src/testdata/models/compose.yaml.fixup
  • src/testdata/models/compose.yaml.golden
  • src/testdata/models/compose.yaml.warnings
  • src/testdata/provider/compose.yaml.warnings

📝 Walkthrough

Walkthrough

Refactors fixupModel and fixupModelProvider in fixup.go to emit warnings for unsupported Docker Model Runner fields (context_size, runtime_flags) and a deprecation warning for the legacy provider: type: model syntax, while adding inline comments distinguishing beta vs modern compose syntax variants. Adds a withmodelvar service test case across compose test fixtures.

Changes

Model fixup warnings and model_var test coverage

Layer / File(s) Summary
fixupModel/fixupModelProvider warning logic and syntax comments
src/pkg/cli/compose/fixup.go
Adds inline comments to FixupServices marking beta vs modern compose model runner variants. fixupModel now warns when context_size or runtime_flags are set (unsupported for cloud). fixupModelProvider is narrowed to deprecated provider: type: model handling, emitting a deprecation warning and delegating to makeAccessGatewayService.
withmodelvar service and new warning fixtures
src/testdata/models/compose.yaml, src/testdata/models/compose.yaml.fixup, src/testdata/models/compose.yaml.golden, src/testdata/models/compose.yaml.warnings, src/testdata/provider/compose.yaml.warnings
Adds a withmodelvar service using model_var: MY_MODEL_NAME to the compose input, fixup, and golden fixtures. Expands warning files to cover the new context_size/runtime_flags cloud warnings for my_model, a memory-reservation warning for withmodelvar, and the provider deprecation warning for ai_runner.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • DefangLabs/defang#2012: Both PRs modify the fixupModel/fixupModelProvider/makeAccessGatewayService flow in src/pkg/cli/compose/fixup.go.

Suggested reviewers

  • lionello

🐇 A hop through the model fields, a warning flung!
context_size and runtime_flags, not for cloud — be among!
The old provider: model fades with a gentle adieu,
withmodelvar joins the test garden, fresh as morning dew.
Refactor complete, the rabbit hops on through! 🌿

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(compose): update Docker Model Runner syntax support' accurately reflects the main changes: adding parameter warnings, deprecating beta syntax, and improving test coverage for Docker Model Runner functionality.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jordan/update-docker-compose-model-runner-syntax

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

level=warning msg="The linter 'gomodguard' is deprecated (since v2.12.0) due to: new major version. Replaced by gomodguard_v2."
level=warning msg="Suggested new configuration:\nlinters:\n enable:\n - gomodguard_v2\n"
level=warning msg="[linters_context] running gomodguard failed: unable to read module file go.mod: current working directory must have a go.mod file: if you are not using go modules it is suggested to disable this linter"
level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies"


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

@lionello
lionello merged commit 352f314 into main Jun 23, 2026
15 checks passed
@lionello
lionello deleted the jordan/update-docker-compose-model-runner-syntax branch June 23, 2026 16:48
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