lablup / lablup/backend.ai

Revision add silently drops a partially specified resource config

Open
#13,286 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
670
Forks
183
Avg merge
15h 13m
Merged PRs (30d)
368

Description

## Problem

When adding a deployment revision, the adapter builds the ResourceSpec only if cluster_config and resource_config are both present. Supplying just one silently discards the other, and the request fails later with a message that points somewhere else.

```
# api/adapters/deployment/adapter.py, add_revision
resource_spec = None
if input.cluster_config is not None and input.resource_config is not None:
resource_spec = ResourceSpec(...)
```

## Reproduction

Add a revision with resource_config but no cluster_config:

```
./bai deployment revision add --config '{
"model_mount_config": {...}, "model_runtime_config": {...}, "image": {...},
"resource_config": {"resource_slots": {"entries": [
{"resource_type": "cpu", "quantity": "1"},
{"resource_type": "mem", "quantity": "2147483648"}]}}}'

InvalidAPIParameters: resource_slots is missing required resource slot(s): ['cpu', 'mem'].
```

The slots were supplied. They were dropped because cluster_config was absent, and the error names the field that was provided rather than the one that was missing. Verified against a live manager on 26.8.0rc1; it took six attempts to find the real cause.

## Expected

Both fields are optional on AddRevisionInput because a revision preset may supply them, unlike CreateRevisionInput where both are required. That makes silent discard the wrong behavior for a partially specified pair. The controller already rejects each missing merged piece explicitly - image_id, mounts, model_definition - so this path should say what is missing too.

## Acceptance Criteria

- Supplying only one of cluster_config / resource_config is rejected with a message naming the missing companion
- Supplying both keeps working unchanged
- Supplying neither keeps working, so a revision preset can still provide them
- CI quality gates (format, lint, type check, unit suite) are green

## References

- src/ai/backend/manager/api/adapters/deployment/adapter.py - add_revision
- src/ai/backend/manager/sokovan/deployment/deployment_controller.py - the explicit checks this path lacks
- CHECKLIST_26.8 item 12 - Model Serving / Deployment, found while running it

JIRA Issue: BA-7100

Contributor guide

Open the contributing guide

Research direction

Start in src/ai/backend/manager/api/adapters/deployment/adapter.py at add_revision, then read the explicit merged-field checks in src/ai/backend/manager/sokovan/deployment/deployment_controller.py. Verify the three one-field, both-fields, and neither-fields cases, and run the format, lint, type-check, and unit-suite quality gates; done means the missing companion is named without changing valid cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.