Skip to content

fix(lium): rent full offer gpu_count to avoid split 400#45

Merged
echobt merged 2 commits into
BaseIntelligence:mainfrom
alpha1122x:fix/lium-rent-full-gpu-count
Jul 27, 2026
Merged

fix(lium): rent full offer gpu_count to avoid split 400#45
echobt merged 2 commits into
BaseIntelligence:mainfrom
alpha1122x:fix/lium-rent-full-gpu-count

Conversation

@alpha1122x

@alpha1122x alpha1122x commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fix Lium provision() rent body so multi-GPU non-splittable executors no longer get HTTP 400 Provider doesn't allow GPU splitting.
  • InstanceSpec.gpu_count stays a minimum-need filter; the rent request now uses the selected offer's full gpu_count.

Changes

  • LiumClient.provision sets rent gpu_count from selected.gpu_count (full capacity), not spec.gpu_count.
  • Unit test pins the multi-GPU offer case (refuse partial split of 1 on an 8-GPU offer).

Test plan

  • uv run pytest tests/unit/test_compute_lium_client.py — 71 passed
  • Live gated E2E (BASE_LIVE_PROVIDER_TESTS=1 + real Lium key): rent → RUNNING → SSH nvidia-smi → DELETE; result=success, pods_remaining=0, balance delta ~$0.01
  • CI green on this head SHA

CI

  • Waiting for required checks to go green on this head SHA.

Notes

  • Live path exercised with a real account key; no secrets in tree/diff.
  • Full constation triangle (sidecar 8787 + recipe image) is out of scope for this PR; this unblocks Lium rent via the product client.

Summary by CodeRabbit

  • Bug Fixes

    • Improved compute provisioning for multi-GPU executors by avoiding unsupported minimum GPU requests.
    • When renting, the system now requests GPU count based on the selected offer’s capacity when available, reducing provider errors.
  • Tests

    • Added a unit test to ensure GPU requests don’t incorrectly use the minimum requested value when the offer supports more GPUs.
    • Reduced CI flakiness by adjusting a concurrency test’s timing/TTL behavior.

Lium returns HTTP 400 "Provider doesn't allow GPU splitting" when
the rent body requests gpu_count=1 on multi-GPU non-splittable
executors. InstanceSpec.gpu_count is a minimum-need filter; the rent
body must use the selected offer's full capacity instead.
@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

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 Plus

Run ID: e5bd815e-9e0d-4cd1-8eb7-e1c24565d513

📥 Commits

Reviewing files that changed from the base of the PR and between cddbd2f and cfdec9f.

📒 Files selected for processing (1)
  • tests/unit/test_master_weights_sealer.py

📝 Walkthrough

Walkthrough

Lium provisioning now conditionally sends the selected offer’s GPU count instead of the instance specification minimum. A unit test verifies this for non-splittable executors. The concurrent seal test uses a longer freshness interval and matching fake-clock advancement.

Changes

Lium GPU provisioning

Layer / File(s) Summary
Use selected offer GPU count in rent requests
src/base/compute/lium.py, tests/unit/test_compute_lium_client.py
The rent payload omits gpu_count when the selected offer has no positive value, otherwise sends the offer’s full GPU count; a unit test verifies it does not send the specification minimum for a larger non-splittable offer.

Seal race test stability

Layer / File(s) Summary
Adjust concurrent seal timing
tests/unit/test_master_weights_sealer.py
The test increases the freshness interval, documents wall-clock expiration behavior, and advances the fake clock beyond the configured interval.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: echobt

🚥 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 accurately summarizes the main Lium provisioning fix and its purpose.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/base/compute/lium.py`:
- Around line 188-189: Update _resolve_offer to enforce spec.gpu_count for both
selection paths: filter automatic candidates so candidate.gpu_count is at least
the requested count, and validate explicit offers before returning them,
rejecting undersized offers. Only include the validated GPU count in rent_body.

In `@tests/unit/test_compute_lium_client.py`:
- Around line 218-222: Update the GPU payload assertions in the positive offer
test to require body["gpu_count"] == multi.gpu_count (8). Remove the permissive
membership check that accepts None or an omitted field, while retaining the
existing rejection of the incorrect value 1 if still needed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 62d20939-ff74-4f40-93ea-01e497517335

📥 Commits

Reviewing files that changed from the base of the PR and between 7694f18 and cddbd2f.

📒 Files selected for processing (2)
  • src/base/compute/lium.py
  • tests/unit/test_compute_lium_client.py

Comment thread src/base/compute/lium.py
Comment on lines +188 to +189
if selected.gpu_count and selected.gpu_count > 0:
rent_body["gpu_count"] = selected.gpu_count

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Reject or filter undersized offers before renting.

_resolve_offer does not enforce spec.gpu_count: automatic selection chooses the cheapest offer regardless of GPU count, and explicit offers are returned without validation. This block can therefore rent fewer GPUs than requested instead of failing or selecting a compatible offer.

Proposed fix
+        if selected.gpu_count < spec.gpu_count:
+            raise LiumError(
+                f"offer {selected.id} provides {selected.gpu_count} GPUs, "
+                f"but {spec.gpu_count} are required"
+            )
         if selected.gpu_count and selected.gpu_count > 0:
             rent_body["gpu_count"] = selected.gpu_count

Also filter automatically selected offers by candidate.gpu_count >= spec.gpu_count.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if selected.gpu_count and selected.gpu_count > 0:
rent_body["gpu_count"] = selected.gpu_count
if selected.gpu_count < spec.gpu_count:
raise LiumError(
f"offer {selected.id} provides {selected.gpu_count} GPUs, "
f"but {spec.gpu_count} are required"
)
if selected.gpu_count and selected.gpu_count > 0:
rent_body["gpu_count"] = selected.gpu_count
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/base/compute/lium.py` around lines 188 - 189, Update _resolve_offer to
enforce spec.gpu_count for both selection paths: filter automatic candidates so
candidate.gpu_count is at least the requested count, and validate explicit
offers before returning them, rejecting undersized offers. Only include the
validated GPU count in rent_body.

Comment on lines +218 to +222
body = json.loads(routes["rent"].calls.last.request.content)
assert body.get("gpu_count") != 1
assert body.get("gpu_count") in (8, None)
if "gpu_count" in body:
assert body["gpu_count"] == multi.gpu_count

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Assert the full GPU count explicitly.

With multi.gpu_count == 8, accepting None allows an implementation that omits gpu_count entirely to pass. Assert the exact payload value for this positive offer.

Proposed fix
-    assert body.get("gpu_count") != 1
-    assert body.get("gpu_count") in (8, None)
-    if "gpu_count" in body:
-        assert body["gpu_count"] == multi.gpu_count
+    assert body["gpu_count"] == multi.gpu_count
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
body = json.loads(routes["rent"].calls.last.request.content)
assert body.get("gpu_count") != 1
assert body.get("gpu_count") in (8, None)
if "gpu_count" in body:
assert body["gpu_count"] == multi.gpu_count
assert body["gpu_count"] == multi.gpu_count
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/unit/test_compute_lium_client.py` around lines 218 - 222, Update the
GPU payload assertions in the positive offer test to require body["gpu_count"]
== multi.gpu_count (8). Remove the permissive membership check that accepts None
or an omitted field, while retaining the existing rejection of the incorrect
value 1 if still needed.

MasterWeightsResponse validates expires_at against real datetime.now,
so freshness_seconds=1 failed when concurrent seal latency exceeded 1s
on CI. Use a longer FakeClock TTL and expire via clock.advance.
@echobt
echobt merged commit c44b16f into BaseIntelligence:main Jul 27, 2026
23 checks passed
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