feat(commands): multi-select ordered command pipeline with step reordering and single-pass composition (AI-05, AI-07)

This commit is contained in:
Yun Chan 2026-10-31 02:54:54 +09:00
parent f49acf0105
commit 10af20a0ad
157 changed files with 29455 additions and 913 deletions

View file

@ -168,6 +168,7 @@ class FakeWhisperModel:
self.source = source
self.device = device
self.compute_type = compute_type
self.cpu_threads = cpu_threads
FakeWhisperModel.created.append(self)
def transcribe(self, audio: np.ndarray, **_kwargs: object) -> tuple[Iterator[_Segment], _Info]:
@ -232,6 +233,16 @@ class SidecarGpuFallbackTest(unittest.TestCase):
self.assertEqual(self._transcribe().status_code, 200)
self.assertTrue(self.client.get("/health").json()["gpu"])
def test_primary_aux_and_cpu_fallback_use_worker_budget(self) -> None:
_FakeGpuEnv.cublas_missing = True
with mock.patch("cpu_budget.os.process_cpu_count", return_value=4, create=True):
primary = self.client.post("/load", json={"model_id": "medium"})
auxiliary = self.client.post("/load", json={"model_id": "small", "slot": "aux"})
self.assertEqual(primary.status_code, 200)
self.assertEqual(auxiliary.status_code, 200)
self.assertEqual([m.device for m in FakeWhisperModel.created], ["cuda", "cpu", "cpu"])
self.assertEqual([m.cpu_threads for m in FakeWhisperModel.created], [2, 2, 2])
def test_missing_cublas_detected_at_load_uses_cpu(self) -> None:
_FakeGpuEnv.cublas_missing = True
res = self.client.post("/load", json={"model_id": "medium"})