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
12 changes: 9 additions & 3 deletions .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,26 @@ CLAUDE_CODE_ATTREBUTION_HEADER=0

# Repos: JSON map of repo name -> local path (machine-specific; .env is gitignored,
# which is why absolute paths belong HERE and never in a committed file).
REPO_PATHS={"vllm-omni": "/path/to/vllm-omni"}
REPO_PATHS={"vllm-omni": "/path/to/vllm-omni", "afd-plugin": "/path/to/afd-plugin"}
DEFAULT_REPO=vllm-omni

# alias -> "owner/repo" GitHub identity, used to route pasted GitHub URLs to a
# configured repo. Optional when the checkout's origin remote already points at
# that owner/repo; without either, URL commands cannot route to the alias
# (`doctor` warns about this).
REPO_FULL_NAMES={"vllm-omni": "vllm-project/vllm-omni"}
REPO_FULL_NAMES={"vllm-omni": "vllm-project/vllm-omni", "afd-plugin": "vllm-project/afd-plugin"}

# MCP defaults to DEFAULT_REPO only. Add afd-plugin explicitly when this server
# should expose its read-only knowledge/review workflows.
MCP_REPO_ALLOWLIST=["vllm-omni", "afd-plugin"]

# Fallback used by adapters/<repo>/manifest.yaml when no .env is in reach; the
# manifest references these as ${VLLM_OMNI_REPO} / ${VLLM_UPSTREAM_REPO} so the
# manifest references these as ${VLLM_OMNI_REPO} / ${VLLM_UPSTREAM_REPO} /
# ${AFD_PLUGIN_REPO} so the
# committed manifest stays portable. REPO_PATHS above takes precedence.
VLLM_OMNI_REPO=/path/to/vllm-omni
VLLM_UPSTREAM_REPO=/path/to/vllm
AFD_PLUGIN_REPO=/path/to/afd-plugin

# Push safety: pushes are dry-run unless this is 1
ALLOW_PUSH=0
Expand Down
95 changes: 95 additions & 0 deletions adapters/afd_plugin/manifest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Human-reviewed adapter for vllm-project/afd-plugin.
name: afd_plugin
status: active
created_by: human
schema_version: 1
capabilities: [orchestrator.external]

repo:
path: ${AFD_PLUGIN_REPO}
full_name: vllm-project/afd-plugin
aliases: [afd-plugin, afd_plugin, vllm-project/afd-plugin]
default_branch: main
language: python

knowledge:
source: vllm-project/afd-plugin
repo_subdir: repos/afd-plugin
briefing_docs:
- repos/afd-plugin/rules.md
- repos/afd-plugin/_index.md

modules:
compat:
local_paths: [afd_plugin/compat/]
wave: 1
risk: high
config_validation:
local_paths: [afd_plugin/config.py, afd_plugin/validation.py, afd_plugin/config_utils.py]
wave: 1
risk: high
connectors_distributed:
local_paths: [afd_plugin/connectors/, afd_plugin/distributed/]
wave: 1
risk: high
workers_runners:
local_paths: [afd_plugin/v1/worker/, afd_plugin/model_executor/]
wave: 1
risk: high
native_backends:
local_paths: [csrc/gpu/, csrc/npu/]
wave: 1
risk: high
tests:
local_paths: [tests/unit/, tests/e2e/]
wave: 2

review_routes:
- prefix: afd_plugin/compat/
owner: compat
doc: repos/afd-plugin/rules.md
- prefix: afd_plugin/config.py
owner: config-validation
doc: repos/afd-plugin/rules.md
- prefix: afd_plugin/validation.py
owner: config-validation
doc: repos/afd-plugin/rules.md
- prefix: afd_plugin/config_utils.py
owner: config-validation
doc: repos/afd-plugin/rules.md
- prefix: afd_plugin/connectors/
owner: connectors-distributed
doc: repos/afd-plugin/rules.md
- prefix: afd_plugin/distributed/
owner: connectors-distributed
doc: repos/afd-plugin/rules.md
- prefix: afd_plugin/v1/worker/
owner: workers-runners
doc: repos/afd-plugin/rules.md
- prefix: afd_plugin/model_executor/
owner: workers-runners
doc: repos/afd-plugin/rules.md
- prefix: csrc/gpu/
owner: native-backends
doc: repos/afd-plugin/rules.md
- prefix: csrc/npu/
owner: native-backends
doc: repos/afd-plugin/rules.md
- prefix: tests/unit/
owner: tests
doc: repos/afd-plugin/rules.md
- prefix: tests/e2e/
owner: tests
doc: repos/afd-plugin/rules.md

validation:
test_manifest_sources: [.github/workflows/]
precommit: true

ci:
provider: github_actions

push:
default_remote: origin
protected_branches: [main, master]
allowed: false
22 changes: 22 additions & 0 deletions adapters/vllm_omni/manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ repo:
# takes precedence; this is only the fallback when no .env is in reach. Never
# hardcode a machine-specific absolute path in this committed file.
path: ${VLLM_OMNI_REPO}
full_name: vllm-project/vllm-omni
aliases: [vllm-omni, vllm_omni]
default_branch: main
rebase_branch: dev/vllm-align
language: python
Expand Down Expand Up @@ -66,6 +68,26 @@ modules:
local_paths: [benchmarks/]
wave: 2

review_routes:
- prefix: vllm_omni/config/
owner: config
doc: repos/vllm-omni/components/configuration/rules.md
- prefix: vllm_omni/core/
owner: scheduler
doc: repos/vllm-omni/components/scheduler/rules.md
- prefix: vllm_omni/entrypoints/
owner: serving
doc: repos/vllm-omni/components/serving/rules.md
- prefix: vllm_omni/model_executor/
owner: model-executor
doc: repos/vllm-omni/components/model-executor/rules.md
- prefix: vllm_omni/models/
owner: models
doc: repos/vllm-omni/models/_index.md
- prefix: vllm_omni/diffusion/
owner: diffusion
doc: repos/vllm-omni/components/diffusion/rules.md

validation:
test_manifest_sources: [.buildkite/]
precommit: true
Expand Down
2 changes: 1 addition & 1 deletion knowledge/SCHEMA.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ contradictions: [相对路径] # 可选:与本页冲突的页面

新标签必须先加入此表再使用(防止标签蔓延):

- 归属:`general`、`vllm-omni`
- 归属:`general`、`vllm-omni`、`afd-plugin`
- 工作主题:`review`、`ci`、`docs`、`git`、`debug`、`benchmark`、`environment`、
`remote`、`agents`、`planning`、`dev`、`rebase`
- 代码/模型轴:`components`、`models`、`diffusion`、`model-executor`、`serving`、
Expand Down
3 changes: 2 additions & 1 deletion knowledge/repos/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: "仓库经验入口"
created: 2026-07-10
updated: 2026-07-10
type: index
tags: [vllm-omni]
tags: [vllm-omni, afd-plugin]
sources: []
---

Expand All @@ -24,4 +24,5 @@ sources: []
| 仓库 | 上游地址 | 查看哪里 |
|---|---|---|
| vLLM-Omni | `vllm-project/vllm-omni` | [vllm-omni](vllm-omni/_index.md) |
| afd-plugin | `vllm-project/afd-plugin` | [afd-plugin](afd-plugin/_index.md) |
| Jianghan roleplay data pipeline | 私有项目 | [jianghan-roleplay-data-pipeline](jianghan-roleplay-data-pipeline/_index.md) |
34 changes: 34 additions & 0 deletions knowledge/repos/afd-plugin/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
title: "afd-plugin"
created: 2026-08-05
updated: 2026-08-05
type: index
tags: [afd-plugin]
sources: ["vllm-project/afd-plugin:AGENTS.md", "vllm-project/afd-plugin:README.md", "vllm-project/afd-plugin:pyproject.toml", "vllm-project/afd-plugin:.github/workflows/cpu-only-ci.yml"]
---

# afd-plugin

- 上游仓库:`vllm-project/afd-plugin`
- 默认分支:`main`
- 适用范围:AFD 插件的兼容 patch、配置校验、connector/distributed、worker/runner、GPU/NPU native backend、单测和硬件 E2E review
- 仓库自己的 `AGENTS.md`、`CLAUDE.md`、`.agents/skills/run-e2e/SKILL.md`、CI 和脚本保持权威;这里仅保存 InferMatrixCopilot 的最小路由规则

## 什么时候查这里

- 当前 Git 仓库、GitHub URL 或 PR 目标是 `vllm-project/afd-plugin`。
- 需要判断 AFD PR 的 changed files 应读哪些仓库专属 review 规则。

## 不放什么

- 不放 vLLM-Omni 的模型、远端、benchmark 或 rebase 经验。
- 不复制 AFD 仓库完整 README、AGENTS 或 E2E skill;运行细节以目标仓库当前文件为准。
- 不记录本机 checkout 路径、硬件账号、模型 cache 或凭据。

## 当前入口

| 遇到什么 | 查看哪里 | 说明 |
|---|---|---|
| 开始任何 afd-plugin review、issue answer 或仓库初始化 | [硬门禁](rules.md) | AFD 仓库级默认规则 |
| 需要跨仓库 review 基础方法 | [general review](../../general/review/_index.md) | 通用审查入口 |

40 changes: 40 additions & 0 deletions knowledge/repos/afd-plugin/rules.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
title: "afd-plugin 硬门禁"
created: 2026-08-05
updated: 2026-08-05
type: rule
tags: [afd-plugin, review, config, distributed, model-executor]
sources: ["vllm-project/afd-plugin:AGENTS.md", "vllm-project/afd-plugin:README.md", "vllm-project/afd-plugin:pyproject.toml", "vllm-project/afd-plugin:.github/workflows/cpu-only-ci.yml", "vllm-project/afd-plugin:.agents/skills/run-e2e/SKILL.md"]
---

# afd-plugin 硬门禁

只在当前任务明确属于 `vllm-project/afd-plugin` 时应用本页。先按 [afd-plugin 入口](_index.md) 确认仓库身份,再结合 [通用 review 入口](../../general/review/_index.md) 做常规审查。

## 1. 仓库身份和权威来源

- AFD-1a:review 或 issue 回答前必须确认目标是 canonical `vllm-project/afd-plugin`,不能把 vLLM-Omni 的知识树、模型规则、远端策略或 rebase 假设带入 AFD。
- AFD-1b:AFD 仓库自己的 `AGENTS.md`、`CLAUDE.md`、`.agents/skills/run-e2e/SKILL.md`、CI workflow 和仓库脚本是权威来源;InferMatrixCopilot 只做只读路由、提示和证据组织。
- AFD-1c:默认路径保持只读;不能自动发 PR 评论、push、改 protected branch,不能要求 AFD runtime 行为因为本 adapter 初始化而改变。

## 2. 兼容范围和插件边界

- AFD-2a:兼容结论必须精确写当前声明的 runtime:vLLM `0.19.1`;Ascend NPU baseline 是 vLLM-Ascend `0.19.1rc1`、CANN/NNAL `8.5.1`、torch/torch-npu `2.9.0`。不得推断更宽版本范围。
- AFD-2b:AFD 通过 `vllm.general_plugins` entry point、`VLLM_PLUGINS`、`additional_config["afd"]`、自动 worker 选择、plugin-owned model wrapper 和窄 compatibility shim 生效;不得建议新增独立 `--afd-config` 之类的公开入口。
- AFD-2c:`additional_config["afd"]` 之外的 connector 私有字段必须进入 `connector_extra_config`,并由对应 connector parser 校验;未知 AFD 顶层字段应暴露为错误,而不是静默透传。
- AFD-2d:没有 `additional_config["afd"]` 时必须保持非 AFD 路径隔离;非 AFD 请求、worker、模型和上游 vLLM 行为不能被 AFD patch 或自动选择污染。

## 3. Patch、connector 和 worker review

- AFD-3a:`afd_plugin/compat/` patch 必须 upstream-first:复制目标 tag 的上游函数,保持函数签名和返回类型,使用 `# ### PATCH START` / `# ### PATCH END` 标出 AFD 差异,并写清 patch reason、功能变化和移除或 upstream 计划。
- AFD-3b:不得用宽泛 `getattr`、`hasattr`、`Any`、`object` 或 `_original_*` delegation 掩盖上游 API 漂移;只有 AGENTS 明确允许的例外才可使用,并必须在 patch 注释说明原因。
- AFD-3c:`afd_plugin/connectors/`、`afd_plugin/distributed/` 改动必须审 rank 布局、attention/ffn 数量约束、同步/异步语义、端口/host、进程组生命周期、资源 cleanup 和跨 role 同步失败路径。
- AFD-3d:`afd_plugin/v1/worker/`、`afd_plugin/model_executor/` 改动必须审自动 worker 选择、role-specific runner、Attention/FFN 组件加载边界、scheduler-driven FFN fail-fast、CUDA/ACL graph 模式和 DBO/ubatch 条件。
- AFD-3e:`csrc/gpu/`、`csrc/npu/` 改动必须区分 CUDA 与 Ascend CANN/ACLNN toolchain;NPU op 构建只能在明确 Ascend 环境或显式 `AFD_BUILD_ASCEND_OPS=1` 下作为证据。

## 4. 验证和证据

- AFD-4a:CPU-safe 默认检查是 `uv run pytest`、`uv run pytest -q tests/unit -m "not gpu and not vllm_runtime"`、`uv run ruff check .`、`uv run ruff format --check .`;它们不能证明 GPU/NPU runtime、模型精度或性能。
- AFD-4b:GPU/NPU E2E 必须通过 AFD 仓库 `.agents/skills/run-e2e/SKILL.md` 或仓库测试入口运行,记录 backend、设备数、模型路径、vLLM/vLLM-Ascend/CANN/torch 版本、拓扑、connector、graph/DBO/async 配置和 skipped 原因。
- AFD-4c:性能、精度或硬件支持 claim 必须给可复现证据:硬件型号、软件版本、driver/toolchain、rank 拓扑、命令、日志或 pytest node id;CPU import/config smoke 不能替代硬件证据。
- AFD-4d:changed files 没有命中 adapter route 时,必须把 unmatched path 明确留给 host reviewer 继续人工审,不得把它当作已覆盖。
33 changes: 31 additions & 2 deletions src/infermatrix_copilot/adapters/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,25 @@ def repo_path(self) -> str:
(`${VAR}` / `~`) instead of hardcoding one machine's absolute layout."""
return expand_path(self.manifest.get("repo", {}).get("path", ""))

@property
def aliases(self) -> set[str]:
"""Names that may identify this adapter at the boundary.

The manifest's canonical `name` remains the primary id, but callers may
receive dashed aliases, GitHub `owner/repo` strings, or explicit aliases
declared in `repo.aliases`. Matching is case-insensitive.
"""
repo = self.manifest.get("repo", {}) or {}
values = {self.name, self.name.replace("_", "-")}
values.update(str(alias) for alias in repo.get("aliases", []) or [])
if repo.get("full_name"):
values.add(str(repo["full_name"]))
return {value.casefold() for value in values if value}

def matches_name(self, name: str) -> bool:
"""Return true when `name` is this adapter's canonical name or alias."""
return str(name).casefold() in self.aliases

@property
def protected_branches(self) -> list[str]:
"""Branches a push may never target (defaults to `["main"]`) — read by the
Expand All @@ -129,6 +148,15 @@ def module_for_path(self, path: str) -> str | None:
return module
return None

@property
def review_routes(self) -> list[dict]:
"""Changed-file review routes declared by the manifest.

Each item is data only, typically `{prefix, doc, owner}`. Runtime code
validates scope before reading the referenced docs.
"""
return list(self.manifest.get("review_routes") or [])

@property
def high_risk_modules(self) -> list[str]:
"""Modules declared `risk: high` — feeds the patch-review trigger."""
Expand Down Expand Up @@ -284,7 +312,7 @@ def resolve(self, *, name: str | None = None, repo_path: str | None = None) -> R
adapters = self.all()
if name:
for p in adapters:
if p.name == name:
if p.matches_name(name):
return p
raise AdapterError(f"no adapter named {name!r}")
if repo_path:
Expand All @@ -301,7 +329,8 @@ def _git(repo: Path, *args: str) -> str:
"""Run `git <args>` in `repo` and return its stripped stdout — the read-only
git helper the deterministic fingerprint uses."""
out = subprocess.run(["git", *args], cwd=str(repo), capture_output=True,
text=True, encoding="utf-8", errors="replace", timeout=30)
text=True, encoding="utf-8", errors="replace", timeout=30,
check=False)
return out.stdout.strip()


Expand Down
Loading
Loading