Skip to content

feat(BA-6550): represent model service command as string#12445

Open
seedspirit wants to merge 5 commits into
mainfrom
feat/BA-6550
Open

feat(BA-6550): represent model service command as string#12445
seedspirit wants to merge 5 commits into
mainfrom
feat/BA-6550

Conversation

@seedspirit

@seedspirit seedspirit commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Refactor model service start_command to use a single internal command string while preserving deprecated list input compatibility.
  • Keep /bin/bash as the default shell, allow explicit null/empty shell for direct argv execution, and update kernel-side command resolution accordingly.
  • Add an idempotent Alembic data migration for stored model definitions in revisions, revision presets, and runtime variant defaults.

Test plan

  • pants fmt --changed-since=HEAD
  • pants fix --changed-since=HEAD
  • pants lint --changed-since=HEAD
  • pants check --changed-since=HEAD
  • pants test --changed-since=HEAD
  • pants lint --changed-since=origin/main
  • Push hook: lint/check/test on origin/main..HEAD@603d0918f
  • Live manager/web API verification for explicit command, deprecated list start_command, vLLM default model definition, and revision preset storage

Resolves BA-6550


📚 Documentation preview 📚: https://sorna--12445.org.readthedocs.build/en/12445/


📚 Documentation preview 📚: https://sorna-ko--12445.org.readthedocs.build/ko/12445/

@github-actions github-actions Bot added size:L 100~500 LoC comp:manager Related to Manager component comp:agent Related to Agent component comp:common Related to Common component require:db-migration Automatically set when alembic migrations are added or updated labels Jun 29, 2026
Co-authored-by: octodog <mu001@lablup.com>
@github-actions github-actions Bot added the area:docs Documentations label Jun 29, 2026
@seedspirit seedspirit marked this pull request as ready for review June 29, 2026 07:15
@seedspirit seedspirit requested a review from a team as a code owner June 29, 2026 07:16
Copilot AI review requested due to automatic review settings June 29, 2026 07:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR (BA-6550) refactors the model service start_command from an argv list (list[str]) to a single internal command string, while keeping backward compatibility with deprecated list-form input and the legacy command/start_command API fields. Shell handling moves to the kernel: /bin/bash remains the default, but an explicit null/empty shell now triggers direct shlex.split argv execution. An idempotent Alembic data migration converts already-stored model definitions to the new string form across revisions, revision presets, and runtime variant defaults.

Changes:

  • start_command is normalized to str | None internally; lists are folded via shlex.join, {model_path} substitution and arg-appending operate on strings, and the kernel splits/wraps based on shell.
  • shell is widened to str | None (GQL/DTO/config), with explicit null preserved through to_resolved; output DTO exposes both new command and deprecated start_command.
  • New data migration ba6615a4d2f1 stringifies stored argv lists; extensive test updates across manager/agent/kernel/common.

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/ai/backend/common/config.py Core: start_command str, _resolve_start_command, string-based merge/append/placeholder
src/ai/backend/kernel/service.py Shell None/empty handling: wrap vs shlex.split
src/ai/backend/agent/agent.py Image-cmd fallback and legacy env args use shlex.join
src/ai/backend/common/dto/manager/v2/deployment/types.py Output DTO command + deprecated start_command derivation
src/ai/backend/manager/api/adapters/deployment_revision_preset/adapter.py Maps internal string to command + legacy list
.../alembic/versions/ba6615a4d2f1_*.py Idempotent data migration; # Part of: placeholder unfilled
.../gql/deployment/types/revision_preset.py, request.py shell widened to nullable
docs/.../*.graphql, changes/12445.enhance.md Schema/changelog updates
tests/** Updated expectations to string form; new shell/alias cases

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@seedspirit seedspirit requested a review from HyeockJinKim June 29, 2026 09:19

@fregataa fregataa left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This seems to be a feature job rather than an enhancement or refactoring since API schema changes.
And is this correct?

  • API allows array typed start_command and shell is used only when start_command is set
  • Agent and Kernel also allows start_command and shell is used only when start_command is set
  • All Agent, Kernel and API uses command if it is set

@seedspirit

Copy link
Copy Markdown
Contributor Author

@fregataa Yes, that's correct with a few details:

  • The list-form start_command is kept for backward compatibility, but it is deprecated and will be removed in the future.
  • Since both the deprecated start_command and the new command can currently be set, command takes precedence when both are provided.
  • shell, start_command, and command are independent configuration fields.
  • When shell is set, the command string is executed as shell -c command.
  • When shell is null, the command string is split with shlex.split() and executed directly as argv.

@seedspirit seedspirit changed the title refactor(BA-6550): represent model service command as string feat(BA-6550): represent model service command as string Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:docs Documentations comp:agent Related to Agent component comp:common Related to Common component comp:manager Related to Manager component require:db-migration Automatically set when alembic migrations are added or updated size:L 100~500 LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants