7.4 KiB
Managed console model switching — 2026-10-04
Scope
STRA-35 fixes the failed codex-qwen-ctl start selection of
strata-next-kar-ple-gpu while the qualified native runtime owned the GPU.
Previously the independent experiment controller rejected any occupied GPU;
it did not know how to stop and restore the native supervisor.
The installed console now routes ordinary llama.cpp, ordinary Strata,
experimental Strata and native starts through one remote coordinator.
Existing menu numbers are preserved; strata-native is appended.
Transaction
- Resolve and preflight the requested model through its existing controller. Ordinary downloads/verification happen before unloading the old model.
- Inventory managed process roots and reject unrelated CUDA processes. Serialize console switches with a private host lock.
- Save the previous launch recipe privately, stop the known current owner, and wait for its GPU memory to release.
- Launch the selected backend and wait for its API/model readiness.
- Only then discover the endpoint and update the harness profile.
- If the target fails, clean up its known processes and restore the previous recipe. Report failed restoration explicitly and retain the private journal.
The qualified legacy native runtime has no admin drain endpoint. An explicit model switch sends its supervisor normal SIGTERM; an in-flight native request can be interrupted. Existing ordinary/experiment controllers retain their busy-request guards. Unrelated GPU work is never killed.
Verification
- 11 transaction/preparation tests: sequencing, preflight preservation, unrelated and ambiguous owners, PID reuse/ancestry, idempotence, rollback, rollback failure, failed-target cleanup and GPU-release waiting.
- 5 menu tests: stable numbering, native dispatch, all backend routing, profile preservation on failure, installer backup and idempotence.
- All 16 passed on macOS and Linux; 13 existing native-service and 12 native-API
tests also passed on macOS. New suites are included in
check-local.sh. - Live RTX 5090 switch passed through the installed command:
codex-qwen-ctl start strata-next-kar-ple-gpu --layout 1x256 --kv-cache q8_0 --wait-seconds 900. Previous native PID 4031422 exited; experiment supervisor 4133313 and engine 4133347 became ready on port 18081. The private switch journal isready. Engine log confirmed the experimental level-2 PLE KAR CUDA cache arm. - Re-selecting the same model through
qwen-codex-ctl startpreserved those process IDs and completed successfully. The ordinary harness connection now selectsstrata-next-kar-ple-gpu. - A short non-streaming generation returned HTTP 200, one choice, 56 input and
16 output tokens. Its deliberately capped output ended with
length; this checks generation transport, not answer quality or a complete agent task. - Model startup took several minutes reading NTFS-backed weights. Observed disk reads were around 150 MB/s during loading; no whole-archive SHA pass was added. Switching the controller does not remove model I/O startup cost.
- The retained native restart recipe passed preflight. Reverse switching and the ordinary llama.cpp/Strata service transitions were covered by dispatch and transaction tests, but were not separately run on the GPU in this trial.
This is a lifecycle change; engine arguments, model weights and numerical kernels are unchanged. No inference speed or quality improvement is claimed. KAR PLE and V-only retain their experimental quality status. CPU fault tests exercise rollback; they are not a live GPU failure-injection trial.
Commands
codex-qwen-ctl start strata-next-kar-ple-gpu
codex-qwen-ctl start strata-native
codex-qwen-ctl start
qwen-codex-ctl uses the same controller. Start the agent with qwen-codex
after the controller reports readiness. Re-selecting the already-ready profile
keeps its process. --wait-seconds accepts 1–7200 seconds; the default is 3600.
Native uses the retained loopback SSH tunnel, creating one if the port is free.
The coordinator only manages the known host recipes; an externally started
untracked GPU workload still yields an ownership error.
Configured host layout (STRA-68)
The repository controller also accepts an opt-in private deployment file. The installed controller and the active trial are not changed by this feature. All paths are absolute and supplied by the operator, for example:
{
"schema_version": 1,
"root": "/home/alice/.local/state/strata/switch",
"native": "/home/alice/.local/state/strata/native",
"control": "/home/alice/.local/share/strata/console-helpers",
"agent_helper": "/home/alice/.local/share/strata/agent-profile.py",
"binary": "/home/alice/.local/share/strata/releases/v1/strata-next",
"config": "/home/alice/.config/strata/native-v1.json",
"cwd": "/home/alice/.local/share/strata",
"url": "http://127.0.0.1:18082",
"model": "strata-native-iq3-s",
"key_file": "/home/alice/.config/strata/api-key"
}
Only key_file is optional. The deployment and key files must be private regular
files owned by the invoking user (mode 0600); existing state directories must be
private too (0700). The readiness URL must be literal loopback HTTP with a port,
without credentials or a path. Readiness requires the expected service, model
and ready=true; redirects are not followed. Its socket timeout is not a hard
wall deadline against a slow byte stream.
chmod 600 /home/alice/.config/strata/deployment.json
printf '%s\n' '{"backend":"native","waitSeconds":3600}' |
python3 scripts/strata-model-switch.py \
--deployment /home/alice/.config/strata/deployment.json start
For this explicit mode, the native CLI runs provision --config before the
transaction can unload any current model. It resolves pinned assets, embedded
engine and native_model/derived tokenizer using the existing native bootstrap;
its bounded subprocess has private/null output and is killed/reaped on timeout.
No old PID file is needed for a first launch. An existing saved live recipe is
retained, including its selected environment. Use separate state directories for
separate native recipes; this remains a single-native-profile controller. Keep
versioned binary/config/model paths immutable while a model is running or being
switched so that rollback can reuse the saved recipe.
Without --deployment, the existing host defaults and preflight behavior remain.
This does not install qwen_remote, strata_remote or the agent helper, nor
make their own backend-specific paths portable: those helpers must already be
configured on the destination host. It also does not replace the native runtime
with Python; Python here is only the console management tool.
Validation adds private manifest, cold recipe, timeout/reap, authenticated
readiness and legacy-helper regression cases to the controller suite. The hosted
smoke-controller-deployment.py runs the actual combined native CLI with a
synthetic CPU engine, provisions a tiny verified GGUF offline, starts the native
profile from an empty state, preserves its PID on failed preflight, then fails a
simulated alternate backend and restores the original native process. The
synthetic Responses output must be exactly A before and after rollback (zero
tolerance). GPU ownership and the alternate backend are test adapters. This is
CPU process/transaction coverage; actual CUDA, real-model quality, clean-node
helper installation and GPU failure rollback remain separate acceptance gates.