Repository navigation
rebase: GPUs on demand per command, zcode 0.17/0.18 adaptation, baseline wheel variant; target vLLM main (cu132) - #455
Conversation
Signed-off-by: tzhouam <tzhouam@connect.ust.hk>
…launchers Signed-off-by: tzhouam <tzhouam@connect.ust.hk>
Signed-off-by: tzhouam <tzhouam@connect.ust.hk>
…aign vLLM cut releases/v0.34.0 on 2026-11-08 (v0.34.0rc0 = 34b780fe66, cu130 x86_64 wheel published). The campaign's wheel pick and commit assignment now target the release branch instead of main; the launcher pins the rc0 commit via force_upstream_commit and will re-pin to the tag commit at v0.34.0 final. Same pattern as the v0.33.0 campaign.
zcode 0.17 added a workspace trust review (createWorkspaceMcpTrust) for
project-scope MCP servers; headless --prompt sessions cannot grant it and
the infermatrix-tools bridge is silently left unconnected — every module
agent ran read-only and blocked (run-20261111-160314: 4 modules failed,
1 hung at session start). User-scope declaration would need HOME
redirection, which measurably breaks the CLI's model-selection bootstrap
and runs retention cleanup against symlinked host dirs — rejected.
The provider now appends the session's trust record (sha256 over the
canonical {version, workspaceIdentity, workingDirectory, serverName,
sourcePaths, config:executionConfig} form, key-sorted per object) to
~/.zcode/security/workspace-mcp-trust-v1.json, flock-serialized and
idempotent, pruning our records whose session dirs are gone. Digest
golden-verified against a live 0.17.1 session (bridge spawned, tool-call
round-trip). A future zcode digest change fails closed: the bridge stays
unconnected and the engine's lifecycle check blocks the module.
…iant A main-tracking campaign can be built with a newer CUDA than the release the target repo is last aligned to. vLLM moved main's default build from 13.0 to 13.2 in 3996083d37 (#55387): main publishes cu132 wheels only, while v0.34.0 final, the baseline of the v0.35.0 campaign, is cu130 only. ensure_baseline_venv fetched the baseline wheel with the target's variant, so the baseline runtime could not be built and the test loop fell back to running the baseline on the campaign venv. The adapter can now declare rebase.wheel.baseline_variant. Unset, the behaviour is unchanged.
…ion campaign vLLM has not cut releases/v0.35.0 (2026-11-23), so the wheel pick and commit assignment target main (tip eff4de9be3c, pinned by the launcher); flip to the release branch once it is cut, as the v0.33.0 and v0.34.0 campaigns did. vllm-omni main 9b753874d is aligned to vLLM v0.34.0 final (62d4bc3c7e). Main has published cu132 wheels only since 3996083d37 (#55387, 2026-11-10), so the wheel variant moves to cu132 and the baseline runtime takes its v0.34.0 wheel from cu130 (baseline_variant). PyPI's torch==2.14.0 stays +cu130; only vLLM's own kernels are built with CUDA 13.2. The cu132 wheel at eff4de9be3c ran on this machine's driver (570.133.20 with the CUDA 13.0 compat package, 580.95.05): vllm._C_stable_libtorch loads, rms_norm matches its reference, and Qwen2.5-0.5B generates with CUDA graphs on an L20X.
… session tools
zcode 0.18 asks for every MCP tool in plan mode, so a read-only scope that
needs the bridge got its reads denied in a headless prompt ("Plan mode
requires approval for MCP tools that are not read-only"). It now runs
`guarded`: after the denylist both modes leave the same native tools, and
guarded keeps the ask for dangerous commands. A readOnlyHint on the bridge
tools does not help in plan mode; every MCP capability there is
needsApproval.
0.18 also adds session management (CreateSession, ForkSession,
InterruptSession, SendToSession, ReadSession, ...) that reaches the host's
other sessions; those tools join the denylist. The host's plugin servers
(mcp__plugin_*) are listed in every mode and stay outside the audit
allowlist, as before.
Checked live on 0.18.0 through the real transport: a read-only session
reads through the bridge, a mutating one writes through it, and a one-shot
call serves the pinned model. zcode 0.18 starts the bridge twice per
session and kills it without an exit record, so bridge_health now reports
`restarted`; that verdict is traced, not acted on.
A campaign held one `gpu run` reservation, four cards, for its whole run, and every GPU command inherited CUDA_VISIBLE_DEVICES from it. On 2026-11-25 the v0.35.0 campaign had GPUs 0-3 for five hours with at most 130 MB in use while twelve requests waited in the queue. Nothing needs four cards at once: all 71 jobs of the manifest declare min_gpus=1, tests run one at a time under the GPU lock, and 52 of them use one card (13 two, one three, five four, by their cards_N markers). Owner decision: no reservation spans the campaign. In demand mode each GPU command asks the scheduler for the cards it needs and holds them only while it runs: - testing/gpu_demand.py: the mode (opt-in), the cards of a command, and the `gpu run` wrapper. The scheduler's own output goes to a side log, never into the test log: on this host it carries a "failed to activate booking" warning, which matches the watchdog's `failed to` pattern and would start an LLM review of every job. - TestRunner runs a job under the wrapper, asks for TestJob.gpus (else the largest cards_N marker, or one card for a run that takes the GPU lock), waits at most half of the job's timeout in the queue, and reports an expired wait as a skip. It stops cleaning processes on the card after the command: the card is released by then and may be someone else's. - The agents' run_pytest/reproduce ask for one card and report a skip as not passed; run_precommit asks for none. The module test wrapper asks for one card and keeps returning the outcome's own rc, so it now says on stdout as well as stderr when nothing ran. - run_shell gives a bare pytest, or Python touching CUDA, one card the same way; a command that names the wrapper or `gpu run` is left to it. 882 of the agents' 1039 tool calls went through run_shell on 2026-11-24/25. - The module prompt and the run config no longer default to CUDA_VISIBLE_DEVICES=0,1 when the session holds no cards. Checked with a stand-in scheduler (50 tests) and under the real one: one TestRunner command held exactly one card for its 35 s and none before or after, and the installed wrapper did the same for a command an agent would run. Importing vllm and its extension opens no CUDA context, so the wheel step's import check needs no card.
…the baseline wheel variant Four SPEC pages had fallen behind their source: testing (gpu_demand.py and the runner's demand path), providers/zcode (the 0.17 trust seeding and the 0.18 guarded mode and denied session tools), rebase_engine (run_shell, the module test wrapper and the prompt under on-demand GPUs; the baseline venv's wheel variant) and engine/steps/rebase_v3 (the agents' test tools ask for one card, a skip is not a pass, no fabricated 0,1 in demand mode). check_spec_freshness.py --strict is clean again. testing's module list also gains cpu_ci_resources.py, which it had left out.
The v0.34.0/0.35.0 cycle added two core mentions of the target project: the baseline-variant note in rebase_engine/wheel.py named the project, and testing/gpu_demand.py matched the module test wrapper by one repository's name. test_repo_vocabulary.py pins both files at zero. Say the same things without the names: the note describes the situation (a release line may ship cu130 only while main builds cu132), and the wrapper is matched by its shape, imx-<repo>-pytest, which is how every adapter's wrapper is named.
…ree hours
scheduler_wrap passed the command timeout to --idle-timeout as seconds.
Measured on the scheduler (2026-11-25): it reads one unit only and caps
the idle release at three hours. Above the cap it refuses the request
("idle timeout cannot exceed 3h"), so nothing runs; in between it takes
8100s, then hands its supervisor "2h15m", which that process cannot
read. The v0.35.0 campaign asked for 6h15m for its six-hour module
tests: three of them never ran, and the runner reported each as a
silent exit.
idle_timeout() rounds the duration up to one unit (seconds, minutes or
hours) and caps it at IDLE_MAX_SEC, so the reservation still outlives
the runner's own timers whenever the cap allows. The command timeout
stays in seconds; the scheduler takes any duration there.
The log no longer claims cards that were not granted. Without a
"Reserved ..." line nothing ran, so it says that and quotes the
scheduler's error, cut before the flag list that follows it.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f44145f332
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| from __future__ import annotations | ||
|
|
||
| import fcntl |
There was a problem hiding this comment.
Guard the POSIX-only fcntl import
On Windows, importing this module now raises ModuleNotFoundError because fcntl is unavailable. Since transport_for_id(..., "zcode") imports this module, this disables the entire zcode backend, including one-shot calls that never seed MCP trust. Use a guarded import and handle unavailable locking explicitly, as the existing engine/lifecycle.py and providers/cursor.py implementations do.
Useful? React with 👍 / 👎.
| if _SELF_SERVED.search(command or ""): | ||
| return False |
There was a problem hiding this comment.
Scope scheduler exemptions to the command that handles its GPUs
In demand mode, mentioning a self-served command anywhere in the shell text disables scheduling for every command in that invocation. For example, echo imx-omni-pytest && pytest tests/gpu makes shell_needs_gpu() return false, so handle_run_shell executes pytest without acquiring any cards. Similarly, a CUDA probe following a completed wrapper invocation runs after that wrapper has released its reservation. Determine exemptions per actual simple command rather than treating a textual match anywhere as evidence that the entire shell invocation holds GPUs.
Useful? React with 👍 / 👎.
| rc, wd_hit, timed_out = self._spawn( | ||
| _exec_wrap(fallback), job, run_env, log_file, | ||
| append=True) | ||
| self._command(job, fallback, side_log), job, run_env, | ||
| log_file, append=True) | ||
| append_silent_log_footer(log_file, rc, "cov-fallback") |
There was a problem hiding this comment.
Handle an expired GPU wait on the coverage fallback
When the primary invocation rejects unsupported --cov flags, its reservation ends and the fallback requests a new one. If that second request expires, _spawn() returns NO_GPU_RC, but this branch returns it as rc=97, skipped=False instead of applying the explicit skip handling used for the primary attempt. Consequently, temporary GPU unavailability is reported to the test loop as a test failure and can trigger unnecessary debugging or regression classification. Apply the scheduler outcome handling to the fallback as well.
Useful? React with 👍 / 👎.
Summary
Rebase-engine changes accumulated over the vLLM v0.34.0 and v0.35.0 campaigns. The first six commits date from the v0.34.0 cycle and were never merged; the rest are this cycle's. Nothing here changes behaviour unless the new mode is switched on.
GPUs on demand (
IMX_GPU_MODE=demand, c22fc57, 4667aba). A campaign no longer holds onegpu runreservation for its whole run. Each GPU command asks the canhazgpu scheduler for the cards it needs and holds them only while it runs:TestJob.gpusdeclares a job's cards; unset, it is the largest ofmin_gpus, the biggestcards_Npytest marker and "takes the GPU lock".run_pytest/reproduceand the module test wrapper ask for one card,run_precommitfor none. A test an agent types intorun_shellis wrapped too; the decision is made per simple command on the command word, because one pattern over the whole line also matchedgrep -rn pytest.rc=0, skipped=True, no pass marker), never a pass. The wait is at most half of the job's timeout, since the runner's timer starts at the spawn.failed to activate bookingwarning that would start a watchdog review of every job); the log keeps one[gpu] …line — the cards granted, or why nothing ran.45m,2h) and caps it at three hours.idle_timeout()rounds the duration up to one unit and caps it atIDLE_MAX_SEC. Before that, a six-hour module test asked for6h15m, was refused, and never ran. The command timeout in seconds is unrestricted.zcode 0.17 and 0.18 (986fd57, 5f4b8d97). 0.17 added a workspace trust gate for project-scoped MCP servers that a headless session cannot pass, so the tool bridge was silently left unconnected; the provider now pre-seeds the session's trust record. 0.18's plan mode demands approval for every MCP tool and nobody approves a headless session, so read-only scopes run
--mode guarded; the session-management tools it added (CreateSession,SendToSession, …) join the disallowed list. The bridge environment carriesIMX_GPU_MODEandIMX_GPU_WAIT.Baseline wheel variant (3b6f28e, 3699845).
rebase.wheel.baseline_variant: the baseline venv installs the last aligned release's wheel under that release's own variant (v0.34.0 publishes cu130 only, main builds cu132). The baseline runtime is kept independent of temporary source trees and candidate launchers.Adapter target (051b7a1, 6ead48e, 4ca3fe5).
adapters/vllm_omni/manifest.yaml:upstream.target_branch: main, wheel variantcu132, baseline variantcu130.From the v0.34.0 cycle (7cdd3fb, c03bf48). Local test jobs adapt container commands to the selected virtualenv (
uv pip install --python "$VIRTUAL_ENV/bin/python", never--system);rebase.testing.local_timeout_multiplier; the API drift guard also covers the output-processor, request-state and profiler base classes and positional-argument capacity.Vocabulary (8e2fa1b). Two core mentions of the target project introduced along the way are gone (
test_repo_vocabulary.pypins both files at zero): the baseline-variant note no longer names the project, and the module test wrapper is matched by its shape,imx-<repo>-pytest.SPEC pages carry dated sections for all of the above:
testing.md,providers/zcode.md,engine/steps/rebase_v3.md,rebase_engine.md.Evidence
Measured against the scheduler on 2026-11-25, one card at a time with an empty command:
--idle-timeoutgpu run45m,7200s,2h,3h,10800s90m,8100sinvalid duration format: 1h30m/2h15m— not released for idleness1h30m10801sidle timeout cannot exceed 3h)--timeoutin seconds was accepted up to 25h.In the running campaign, before the fix: the three module-test invocations with a six-hour timeout (12:34–13:20) ended
rc=1having run nothing, which the runner reported as a silent exit; the preserved log of one shows the refusal.Validation
Offline, on head
f44145f3:test_gpu_demand.py(64, stand-ingpuandpytestexecutables, no card involved).test_repo_vocabulary.py::test_parity_vocabulary_is_contained(fixed by 8e2fa1b) and three parameters oftest_mcp.py::test_child_launch_never_opens_the_post_gate.tools/check_doc_links.py,tools/check_doc_citations.py,tools/check_spec_freshness.py --strict, both knowledge linters: clean.Real execution, in the v0.35.0 campaign since 2026-11-25 12:21, in demand mode with no reservation spanning the run:
TestRunnercommand and the installed wrapper each held exactly one card for about 35 seconds, none before or after.test_nemotron_voicechat_perception_batch) passed 25 tests on one card; the scheduler's queue showed at most one of this campaign's reservations at any time.Notes for review
test_mcp.pyfailures are not from this branch. The test does not redirectPath.home(), so the post-launch sweep reads the real~/.infermatrix-copilot/worktrees; on a host with stale managed worktrees there, its fakePopenrecords the sweep'sgit rev-parseas the last command. It fails identically onmain(75326af7) on such a host and passes on a clean one. Not touched here.release_baseline.yaml.