Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions adapters/vllm_omni/manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ upstream:
kind: fork_tracking
repo_path: ${VLLM_UPSTREAM_REPO}
remote: origin
# v0.33.0 alignment campaign (2026-10-28): vLLM cut releases/v0.33.0 on
# 2026-10-26 (tip 4135590ffe = v0.33.0rc0, cu130 wheel published), so the
# wheel pick and commit assignment target the release branch, not main.
# Pinned to the rc0 commit by the launcher's force_upstream_commit; re-pin
# to the tag commit once v0.33.0 final is tagged.
target_branch: releases/v0.33.0
# v0.35.0 preparation campaign (2026-11-23): vLLM has not cut a
# releases/v0.35.0 branch yet, so the wheel pick and commit assignment
# target main (tip eff4de9be3c, 2026-11-23). vllm-omni main 9b753874d is
# aligned to vLLM v0.34.0 final (62d4bc3c7e). Flip to the release branch
# once vLLM cuts it, as the v0.33.0 and v0.34.0 campaigns did.
target_branch: main

# Repo-specific slice of the SHARED, human-curated knowledge base (the vendored
# community docs at the repo-root `knowledge/` = settings.knowledge_dir;
Expand Down Expand Up @@ -232,7 +232,15 @@ rebase:
wheel:
package: vllm
index_url_template: "https://wheels.vllm.ai/{commit}/{variant}/{package}/"
variant: cu130
# vLLM main moved its default CUDA build from 13.0 to 13.2 in 3996083d37
# (#55387, 2026-11-10): wheels for main commits are published under cu132
# only ("the cu129 and cu130 subdirectories no longer get new builds").
# PyPI's torch==2.14.0 stays +cu130; only vLLM's own kernels are built
# with 13.2. Release branches up to v0.34.0 publish cu130.
variant: cu132
# The baseline runtime (test loop) installs the wheel vllm-omni main was
# last aligned to, vLLM v0.34.0 final, which is published under cu130 only.
baseline_variant: cu130
arch: x86_64
import_check_modules: [vllm._C_stable_libtorch, vllm._C]
ops_namespace: _C
Expand Down
15 changes: 13 additions & 2 deletions adapters/vllm_omni/rebase/api_drift_guard.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ def find_spec(fullname, path, target=None):
("vllm.v1.worker.gpu_model_runner", "GPUModelRunner", "vllm_omni.worker.gpu_ar_model_runner", "GPUARModelRunner"),
("vllm.v1.core.sched.scheduler", "Scheduler", "vllm_omni.core.sched.omni_ar_scheduler", "OmniARScheduler"),
("vllm.v1.core.sched.scheduler", "Scheduler", "vllm_omni.core.sched.omni_generation_scheduler", "OmniGenerationScheduler"),
("vllm.v1.engine.output_processor", "RequestState", "vllm_omni.outputs.output_processor", "OmniRequestState"),
("vllm.v1.engine.output_processor", "OutputProcessor", "vllm_omni.outputs.output_processor", "MultimodalOutputProcessor"),
("vllm.profiler.wrapper", "WorkerProfiler", "vllm_omni.profiler.omni_torch_profiler", "OmniTorchProfilerWrapper"),
]


Expand Down Expand Up @@ -276,9 +279,17 @@ def _check_inheritance() -> list[str]:
):
continue
missing.append(pname)
if missing:
positional_kinds = (inspect.Parameter.POSITIONAL_ONLY, inspect.Parameter.POSITIONAL_OR_KEYWORD)
base_positional = [p.name for p in base_sig.parameters.values() if p.kind in positional_kinds]
omni_positional = [p.name for p in omni_sig.parameters.values() if p.kind in positional_kinds]
omni_has_var_positional = any(
p.kind == inspect.Parameter.VAR_POSITIONAL for p in omni_sig.parameters.values()
)
lost_positional = [] if omni_has_var_positional else base_positional[len(omni_positional):]
if missing or lost_positional:
msg = (
f"MISMATCH {omni_cls_name}.{name}(): missing params {missing}\n"
f"MISMATCH {omni_cls_name}.{name}(): missing params {missing}; "
f"incompatible positional params {lost_positional}\n"
f" Base : {base_sig}\n"
f" Omni : {omni_sig}"
)
Expand Down
28 changes: 24 additions & 4 deletions doc/architecture/SPEC/engine/steps/rebase_v3.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# engine/steps/rebase_v3.py —— 规范

<!-- verified-against: 2026-10-29 -->
<!-- verified-against: 2026-11-25 -->

`LOC ~2204 · step 库(v3 rebase 装配层) · refactor-status: oversized`
`LOC ~2660 · step 库(v3 rebase 装配层) · refactor-status: oversized`

## 职责
把 `rebase_engine` 包接进 executor:locked playbook `repo-rebase-v3` 的全部
Expand Down Expand Up @@ -132,7 +132,9 @@ harness 会话通过 MCP tool bridge 拿到同一套工具面,plan gate 在派
`upstream_commit` 重新确保 scratch。
- baseline venv(`ensure_baseline_venv`):硬链接克隆 campaign venv 并换入
baseline commit 的 wheel,让"omni main 对上次对齐的 wheel 是否也失败"可问;
任何失败返回 None,保留保守的回归判定。
使用发布 wheel(若配置 URL)或非 editable 安装,删除临时源码后再验证导入;
克隆的 console/activation 脚本通过原子替换改为 baseline 路径,不能写穿硬链接
修改 campaign。缓存复用也必须通过导入检查。任何失败返回 None,保留保守的回归判定。

## 操作者重跑与本地超时预算(2026-10-29)

Expand All @@ -142,9 +144,14 @@ harness 会话通过 MCP tool bridge 拿到同一套工具面,plan gate 在派
`run_test_loop`:记录过的 timeout/watchdog infra 再跑一次,已通过的 job 不重跑。
普通 resume 下 infra 仍然粘滞。
- `rebase.testing.local_timeout_multiplier`(默认 1,须为 >= 1 的数,否则 BLOCKED)
只放大本地 `TestJob.timeout_sec`;构建出的 manifest 保留 CI 的
放大本地 `TestJob.timeout_sec` 和命令行首的直接 `timeout DURATION`;构建出的 manifest 保留 CI 的
`timeout_in_minutes`(shell golden 不变)。vllm-omni 取 3:Ready 的 20 分钟 CPU
Simple step 在共享 rebase 主机上通过 53–88% 用例、零失败时就被杀。
- 本地已配置虚拟环境时,将行首 `uv pip install --system` 改为
`uv pip install --python "$VIRTUAL_ENV/bin/python"`。候选与基线各自使用
`_target_test_env` 选定的虚拟环境;不修改 CI manifest,也不向系统 Python 安装依赖。
- API drift guard 覆盖输出处理器、请求状态及 profiler 基类;除参数名外还检查位置参数容量,
防止将上游可按位置传递的可选参数改成仅关键字参数后仍误报兼容。

## 信号中断的模块:BLOCKED 收口、resume 重跑(2026-10-28)

Expand All @@ -158,3 +165,16 @@ done;`_v3_wave_gate` 把 interrupted 与 failed 同等视为"wave-1 未完成"
rebase 的模块不是 wave 2 的基础)。测试:`test_assembly.py::
test_v3_module_rebase_reruns_interrupted_and_blocks_on_interrupt`、
`test_run_shutdown.py::test_wave_gate_treats_interrupted_as_not_done`。

## agent 测试工具的卡数与会话卡数(2026-11-25)

campaign 改为按命令向调度器取卡之后(`testing` 规范的"按命令向调度器申请 GPU"),
经本文件启动的 GPU 命令各自声明要几张:

- `run_pytest`/`reproduce`(`_run_tests`)以 `TestJob(min_gpus=0, gpu_lock=True,
gpus=1)` 运行,向调度器要 1 张卡。返回值新增 `skipped` 与 `skip_reason`;
`passed` 只在 `rc == 0 and not skipped` 时为真——调度器没给卡的运行没有通过。
- `run_precommit` 以 `gpus=0` 运行,不申请。
- 两处 `ModuleRunConfig` 的 `cuda_devices` 改取 `testing.gpu_demand.session_devices()`:
有 `CUDA_VISIBLE_DEVICES` 就用它,否则保留历史缺省 `0,1`;按需模式下会话不持有
卡,取空串,不再把 `0,1` 写进桥的环境。
37 changes: 34 additions & 3 deletions doc/architecture/SPEC/providers/zcode.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# providers/zcode.py —— 规范

<!-- verified-against: 2026-10-27 -->
<!-- verified-against: 2026-11-25 -->

`harness transport(Z.AI / GLM 订阅) · refactor-status: ok`

Expand All @@ -12,11 +12,12 @@
`ZCodeFailure`;额度、限流、认证和暂时不可用分别表达。未知失败保留现有 RuntimeError
行为;分类器不把提示、原始事件或提供方错误正文暴露给 RFC 服务。

headless `zcode --prompt=... --output-format stream-json --mode plan --cwd <临时目录>
headless `zcode --prompt=... --output-format stream-json --mode <mode> --cwd <临时目录>
--disallowed-tools=<非读工具>`;工具桥写进临时目录的 `.zcode/config.json`;从事件流解析
`result.response`、`result.usage`、`session.updated.modelId` 和 `tool.updated`(`kind:
scheduled`)。prompt 超过 100,000 字节时写成文件并 `--attach`(zcode 没有 stdin 通道,
argv 单参数上限 128KiB)。
argv 单参数上限 128KiB)。`--mode` 按调用选:一次性调用用 `plan`(不带桥);agent 会话里
只读作用域用 `guarded`、会改动的作用域用 `yolo`(0.18 起,见下文)。

## 公开契约
`ZCodeTransport`(`auth_gap`、`run_session`、`complete`)、`spec = PROVIDERS["zcode"]`。
Expand Down Expand Up @@ -84,3 +85,33 @@ stdlib + `.base` + `..agent_loop.AgentOutcome` + `..llm` 的类型与 `ModelMism
`subscription_billing` 仅在实际选中的 provider 为已知 OAuth coding plan 时为 True;自定义 provider
或 settings 中的 API provider override 返回 False。它描述计费模式,不声称调用花费为零。
`kb init --subscription-generator` 通过此声明显式使用订阅生成器,保留未报告的 USD 与 token 用量。

## zcode 0.17 与 0.18(2026-11-11、2026-11-24)

- **项目级 MCP server 的信任登记(0.17)。** 0.17 给项目作用域的 MCP server 加了
工作区信任门(`createWorkspaceMcpTrust`),无头 prompt 过不去:工具桥被静默留成
未连接,每个模块 agent 都只能读、随后阻塞(run-20261111-160314)。`_write_mcp_config`
写完会话配置后调用 `_seed_workspace_mcp_trust`,把本会话的信任记录追加进宿主的
`~/.zcode/security/workspace-mcp-trust-v1.json`(flock 串行、幂等,并清掉会话目录
已不存在的记录)。记录的 `declarationDigest` 是对规范化后的
`{version, workspaceIdentity, workingDirectory, serverName, sourcePaths, config}`
做 sha256——键排序、紧凑分隔符、非 ASCII 原样;其中 `config` 是该 server 去掉
`enabled`/`source` 后的执行字段,`env` 缺省为 `{}`、`cwd` 缺省为工作目录。摘要
的算法若在将来的版本里变化,就**失败关闭**:桥保持未连接,引擎的桥存活检查拦住
该模块。0.17.1 上实测过(桥被拉起、工具调用往返)。
- **只读作用域跑 `--mode guarded`,不再是 `plan`(0.18)。** 0.18 的 plan 模式要求
每个 MCP 工具都经审批,而无头会话无人审批:只读作用域经工具桥的读取被拒
("Plan mode requires approval for MCP tools that are not read-only")。拒绝列表
剥掉之后,plan 与 guarded 留下同一批原生工具(全是读),guarded 只对危险命令
保留询问。给桥工具标 `readOnlyHint` 在 plan 模式下不起作用:那里的 MCP 能力一律
是 `needsApproval`。一次性调用(`complete()`)仍用 plan,它不带桥。
- **会话管理工具加入 `_DISALLOWED`(0.18)。** `CreateSession`、`ForkSession`、
`InterruptSession`、`ListSessions`、`ReadSession`、`RenameSession`、`SendToSession`、
`WaitSessions` 能触达宿主的其他会话。宿主安装的插件 server(`mcp__plugin_*`)在
每种模式下都列在工具清单里,仍留在审计白名单之外,与之前相同。
- **桥进程的环境带上 `IMX_GPU_MODE` 与 `IMX_GPU_WAIT`。** 桥自己会启动 GPU 命令
(agent 的 shell 与测试工具),campaign 按命令向调度器取卡时它需要知情。
`IMX_GPU_HELD` 有意不传:它只在已持有卡的命令树内部为真。

0.18.0 上的实测(2026-11-24):一次性调用服务于钉住的模型;只读会话经桥读文件;
会改动的作用域经桥写文件。信任登记沿用 0.17 的算法,0.18 仍然连得上桥。
43 changes: 41 additions & 2 deletions doc/architecture/SPEC/rebase_engine.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# rebase_engine/ —— 规范

<!-- verified-against: 2026-10-29 -->
<!-- verified-against: 2026-11-25 -->

`LOC ~7500(26 个模块) · repo-rebase-v3 的原生 rebase 引擎 · refactor-status: ok`
`LOC ~9530(30 个模块) · repo-rebase-v3 的原生 rebase 引擎 · refactor-status: ok`

## 职责
父级 rebase agent 机制的仓库中立移植(PR0..PR7 分片落地):repo-rebase-v3
Expand Down Expand Up @@ -88,6 +88,9 @@ runner/LLM/CI client 全部可注入 —— 每个模块都能离线测试。
取锁(父级 parity)。
- wheel:每个 uv 调用 `--python` 显式指向**声明的目标 venv** —— 启动
shell 的 venv 状态绝不影响装到哪;只有 import 验证失败才重试。
- baseline venv:克隆后的 launcher/activation 路径必须独立且重复修复幂等;
baseline 包优先安装冻结 wheel,否则非 editable 安装源码。临时 worktree
删除后须再次从 venv 目录验证 import;缓存也须验证实际 import,不能只信版本元数据。
- CI 创建受守卫:durable op 记录先于 API 调用,恢复按 op id 精确匹配,
**不确定时绝不重复创建**。
- 每个被 monitor 的 CI round 持久化实际 monitor 时长,供 run metrics 从 durable
Expand Down Expand Up @@ -256,3 +259,39 @@ GPU 进程执行 SIGINT→SIGTERM→SIGKILL 阶梯。`module_pytest.py` 现在
收口而不是推进到下一个兄弟;substate 短路**只**接受 done/skipped,所以
`--resume` 重跑 interrupted 模块、跳过 done;`_v3_wave_gate` 把 interrupted
与 failed 同等视为未完成。

## 按需 GPU:agent shell、测试包装器与提示词(2026-11-25)

campaign 不再从头到尾持有一份外层预约,每条 GPU 命令向调度器申请自己需要的卡
(`testing` 规范的"按命令向调度器申请 GPU")。本包里三处与之相接:

- **`run_shell`。** `handle_run_shell` 先决定这条命令要不要卡,再把执行交给
`_run_shell`(原有的 Popen、后代快照与超时逻辑未变)。按需模式(读本进程环境的
`IMX_GPU_MODE`)下,它把模式写进子进程环境,使命令启动的 `imx-omni-pytest`
自己去申请;`testing.gpu_demand.shell_needs_gpu` 判定会起测试或 CUDA 代码的命令,
用 `scheduler_wrap` 向调度器要 1 张卡(等待上限是工具超时的一半),并给子进程设
`IMX_GPU_HELD=1`,命令启动的东西不再申请。等待到期时返回
`{"exit_code": 1, "gpu_unavailable": true, "stderr": "Not run: …"}`;其余失败
在 stderr 前附上调度器的错误文本。2026-11-24/25 的 campaign 里,agent 的 1039 次
工具调用有 882 次走 `run_shell`(计划评审之前 `run_pytest` 是锁住的),其中绝大多数
是 `git`、`grep` 与读取,不受影响。
- **`module_pytest.py`。** 包装器的 `TestJob` 带 `gpus=1`:测试可能用到卡,如同它
过去在外层预约下运行时那样。包装器仍返回结果自己的 rc(既有契约,由
`test_module_pytest_outcomes.py` 钉住),所以跳过时把
`imx-omni-pytest: skipped — <原因>` 同时写到 stdout 和 stderr。
- **提示词。** `build_module_prompt(..., cuda_devices=prompt_devices(config.cuda_devices))`:
按需模式下 `CUDA_DEVICES` 替换成"由调度器按命令设置(本会话不持有卡)"。模板里的
"Use only env from this prompt: `CUDA_VISIBLE_DEVICES={CUDA_DEVICES}`" 不再让
agent 以为自己握有 0、1 两张卡。

测试在 `test_gpu_demand.py`(agent shell、模块测试包装器)。

## 基线运行时的 wheel variant(2026-11-23)

`wheel.ensure_baseline_venv` 装基线 commit 的 wheel 时,variant 改为
`spec.baseline_variant or spec.variant`;`WheelSpec.from_manifest` 读可选的
`rebase.wheel.baseline_variant`,未声明时行为不变。vLLM 在 3996083d37 把 main 的
默认 CUDA 构建从 13.0 换到 13.2:main 只发布 `cu132` wheel,而作为基线的 v0.34.0
final 只有 `cu130`。按目标的 variant 去取,测试循环用来区分既有失败与回归的基线
运行时就建不出来,退回到让基线也跑在 campaign 的 venv 上。vllm-omni adapter 把
`baseline_variant` 设为 `cu130`。测试:`test_rebase_release_target.py`。
Loading
Loading