Skip to content

test(provider): re-slice floor scenarios keep their idle engines from republishing capacity - #2718

Merged
jonathan308 merged 1 commit into
devfrom
test/reslice-floor-idle-engines-quiet
Nov 24, 2026
Merged

jonathan308 merged 1 commit into
devfrom
test/reslice-floor-idle-engines-quiet

Conversation

@jonathan308

@jonathan308 jonathan308 commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

This fixes a flake in the KV re-slice floor tests. The change is test-only; production code is unchanged.

The failure: EngineV2ResliceFloorWiringTests ("KV re-slice keeps every slot's floor (orchestration)") failed twice today, then passed on re-run:

  • once at :89 expectResidentsServiceable ("nvidia-nemotron-3.5-lightning grant 2024526182" below its floor);
  • once in its child-process case ("a GLM charge another test left retained doesn't shrink the scenario's budget").

Cause: a per-engine race on the capacity gauge, where a stale write overwrites a newer one. No state carries over between tests.

  • ResliceFloorScenario.makeBridge builds real EngineV2 residents that sit idle.
  • An idle engine's loop republishes its whole capacity snapshot every 1 ms, from the engine queue (EngineLoopV2.publishGauges, CBv2EngineLoopConfig.idleRecheckInterval = 0.001). It reads kvBytesCapacity from the admission ledger.
  • A re-slice point-updates the same gauge from the bridge (EngineV2.updateKVBytesCapacity).
  • A publish that read the ledger just before a shrink, and writes just after it, puts the old capacity back until the next publish.
  • EngineV2Bridge.minimumServiceableGrantBytes combines that gauge capacity with the ledger's admissible bytes. A floor read in that window therefore comes out larger by about the size of the shrink. Lightning is the slot the floor-aware re-slice shrinks most, so its floor read lands above its real grant.

What was ruled out:

  • The test hooks already pin the physical memory and the retained GLM charge.
  • MTP staging is per server.
  • The activation reserve comes from a static map.
  • No suite in the failing shard writes the memory environment variables.
  • The child-process case fails the same way because it runs the same scenario, not because the child inherits state.

Change: the fixture's residents use CBv2EngineLoopConfig(idleRecheckInterval: 3_600). An idle resident publishes its capacity once when it starts and not again during the test, so the re-slice's point update stands. This one fixture line covers all three suites that share the fixture:

  • EngineV2ResliceFloorWiringTests;
  • EngineV2ResliceFloorTests;
  • the Nemotron Super managed-slot capacity tests.

Why there's no red control: the failure needs a 1 ms engine-queue publish to land between two reads, so it can't be forced red deterministically. The change is test-only and leaves every assertion as it was.

Production: the same race can, for about 1 ms after a resize, show an idle engine's old capacity and inflate a floor read made in that window. The worst case is a spurious "would leave a model without its fixed request workspace" refusal right after a resize. It's fail-safe and never a wrong output. It's tracked separately; the proper fix is a generation counter in the SDK's capacity gauges, or reading the floor's capacity from the ledger.

Commit What it does
2fdfabed75 ResliceFloorScenario.makeBridge: idle recheck every hour for the resident engines

Linked issue

None.

Test plan

  • Test-only, with no red control (see above).
  • CI (dev) on the exact head 2fdfabed75: run 45450759303, green.
  • Evidence: removes the idle republish during the test; one CI pass. The fixture takes the racing writer away by construction, so a repeat loop isn't needed.

Components touched

  • provider-swift (Swift CLI): tests only

Protocol / interface changes

  • No protocol/interface changes

Documentation impact

  • No documentation needed. Reason: test fixture only.

Changelog

  • No user-visible change.

Notes for reviewers

Based on 939db0b3d5, which is in dev (D8 86ac4a774e); the PR targets dev and shows only its one commit.

Before And After

sequenceDiagram
  participant L as idle engine loop (1 ms)
  participant B as bridge re-slice
  participant T as test
  Note over L,T: Before
  L->>L: reads ledger capacity (old)
  B->>L: point update: capacity = new
  L->>L: publishes snapshot (old capacity)
  T->>B: floor = f(gauge old, ledger new) → too high
  Note over L,T: After (idleRecheckInterval 3,600 s)
  L->>L: publishes once at start
  B->>L: point update: capacity = new (stands)
  T->>B: floor = f(new, new)
Loading

Refactor Pass

Refactor pass: no change justified.


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

… republishing capacity

ResliceFloorScenario.makeBridge builds real EngineV2 residents that sit idle. An idle engine's loop republishes its capacity snapshot every 1 ms (CBv2EngineLoopConfig.idleRecheckInterval), reading the admission ledger on the engine queue, while a re-slice point-updates the same gauge from the bridge. A publish that read before the update and writes after it restores the old capacity until the next publish. EngineV2Bridge.minimumServiceableGrantBytes combines that gauge capacity with the ledger's admissible bytes, so a floor read in that window comes out too high; the orchestration suite then saw a resident's grant below its floor (once on a composition run, once on a wave-2 run). The fixture's residents now wait an hour between idle rechecks, so the re-slice's point update stands for the whole test. Test-only; this covers EngineV2ResliceFloorWiringTests, EngineV2ResliceFloorTests and the Nemotron Super managed-slot capacity tests, which share the fixture.
@jonathan308 jonathan308 added the run-ci Trigger one-shot PR CI run (auto-removed when run starts) label Nov 24, 2026
@vercel

vercel Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
d-inference-landing Ready Ready Preview Nov 24, 2026 5:38pm UTC
darkbloom-status Ready Ready Preview Nov 24, 2026 5:38pm UTC
eigen-homepages-darkbloom Ready Ready Preview Nov 24, 2026 5:38pm UTC

Request Review

@github-actions github-actions Bot removed the run-ci Trigger one-shot PR CI run (auto-removed when run starts) label Nov 24, 2026
@jonathan308
jonathan308 changed the base branch from perf/sdk-pin-m9 to dev November 24, 2026 18:52
@jonathan308
jonathan308 merged commit 6a7b41e into dev Nov 24, 2026
27 checks passed

This branch was successfully deployed

3 active deployments
Preview – eigen-homepages-darkbloom — 2fdfabed Deployed Nov 24, 2026 by vercel[bot]
Preview – d-inference-landing — 2fdfabed Deployed Nov 24, 2026 by vercel[bot]
Preview – darkbloom-status — 2fdfabed Deployed Nov 24, 2026 by vercel[bot]
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.

1 participant