Skip to content

kb init(afd-plugin): deepen - #270

Merged
tzhouam merged 1 commit into
mainfrom
kb/init-afd-plugin-deepen
Sep 30, 2026
Merged

tzhouam merged 1 commit into
mainfrom
kb/init-afd-plugin-deepen

Conversation

@tzhouam

@tzhouam tzhouam commented Sep 30, 2026

Copy link
Copy Markdown
Collaborator

kb init stage deepen for afd-plugin (vllm-project/afd-plugin).

  • Upstream pin: 9cae2d2ddaae7e1752fc12ead577d59540b17f27
  • Knowledge base: 4ad86818c0ac0883e99bd8ce0ecb6667855e8b8e
  • Model spend (accounted): $27.59

Human-merged. Rules were screened by the docs redundancy filter, checked at the pin, and given an advisory verdict; fail rules are already removed.

rule page verdict
AFD-I15 repos/afd-plugin/components/model-integration/rules.md unsure
AFD-I21 repos/afd-plugin/components/model-integration/rules.md unsure
AFD-I22 repos/afd-plugin/components/model-integration/rules.md unsure
AFD-I24 repos/afd-plugin/components/model-integration/rules.md pass
AFD-I25 repos/afd-plugin/components/model-integration/rules.md unsure
AFD-I26 repos/afd-plugin/components/model-integration/rules.md unsure
AFD-I28 repos/afd-plugin/components/model-integration/rules.md unsure
AFD-I29 repos/afd-plugin/components/model-integration/rules.md unsure
AFD-I30 repos/afd-plugin/components/model-integration/rules.md pass
AFD-I34 repos/afd-plugin/components/attention-runtime/rules.md unsure
AFD-I36 repos/afd-plugin/components/attention-runtime/rules.md unsure
AFD-I37 repos/afd-plugin/components/attention-runtime/rules.md unsure
AFD-I38 repos/afd-plugin/components/attention-runtime/rules.md unsure
AFD-I39 repos/afd-plugin/components/attention-runtime/rules.md unsure
AFD-I40 repos/afd-plugin/components/attention-runtime/rules.md unsure
AFD-I42 repos/afd-plugin/components/attention-runtime/rules.md unsure
AFD-I43 repos/afd-plugin/components/attention-runtime/rules.md unsure
AFD-I45 repos/afd-plugin/components/ffn-runtime/rules.md unsure
AFD-I46 repos/afd-plugin/components/ffn-runtime/rules.md unsure
AFD-I47 repos/afd-plugin/components/ffn-runtime/rules.md unsure
AFD-I48 repos/afd-plugin/components/ffn-runtime/rules.md unsure
AFD-I50 repos/afd-plugin/components/ffn-runtime/rules.md unsure
AFD-I51 repos/afd-plugin/components/ffn-runtime/rules.md unsure
AFD-I54 repos/afd-plugin/components/ffn-runtime/rules.md unsure
AFD-I55 repos/afd-plugin/components/ffn-runtime/rules.md unsure
AFD-I58 repos/afd-plugin/components/connectors/rules.md unsure
AFD-I59 repos/afd-plugin/components/connectors/rules.md unsure
AFD-I62 repos/afd-plugin/components/connectors/rules.md pass
AFD-I63 repos/afd-plugin/components/connectors/rules.md unsure
AFD-I64 repos/afd-plugin/components/connectors/rules.md unsure
AFD-I65 repos/afd-plugin/components/connectors/rules.md unsure
AFD-I66 repos/afd-plugin/components/connectors/rules.md pass
Dropped rules
  • AFD-I20: advisory judge: fail {"faithful": "规则称 get_experts_layer_indices 直接返回 range(num_hidden_layers),但代码返回 tuple(range(int(self.config.num_hidden_layers)))(deepseek_v4.py:L446-L447)。所给片段也未显示 MegaMoE 的拒绝检查,无法支持该项描述(deepseek_v4.py:L325-L345)。", "non_contradictory": "所示现有规则中没有与新增的 V4 权重归属、角色构造或层索引要求冲突的条款;AFD-I25 对 V4 包装类属性的要求也与其
  • AFD-I27: advisory judge: fail {"faithful": "forward_context.py:L37-L68 支持在 finally 恢复符号、每次创建 context 调用一次 installer,以及避免在编译路径查找 provider;L18-L34 支持使用 dict.get 和静态类型注解。但 installer 是任意回调,证据未保证它“只修改 additional_kwargs”;也未证明所有模型包装都读取该键,或 set_forward_context 的调用方式。因此整条规则不能判为完全忠实。", "non_contradictory": "所示 AFD-I15、I20–I26、I28–I31 均未对这
  • AFD-I31: advisory judge: fail {"faithful": "model_utils.py:L16-L46 supports the deepcopy, architecture rewrite, and prefixed-name behavior. But the rule describes the generated AFD classes as empty subclasses; deepseek_v4.py:L476-L480 shows AFDDeepseekV4ForCausalLM defines class attributes. The cited evidence also does not estab
  • AFD-I32: advisory judge: fail {"faithful": "The cited code shows each scope restoring the fields it changes, not every AFD field at every listed save/restore point. For example, V1 execute_model restores only _afd_is_graph_replaying (attention_model_runner.py:L357-L362). The requirement to add every new field to all points goe
  • AFD-I33: advisory judge: fail {"faithful": "The V2 replay claim has the order wrong: attention_model_runner_v2.py:L190-L202 sets _afd_suppress_metadata_send = True before calling send_dp_metadata, while the proposed rule says V2 sends first and then sets suppress. The cited V1 and V2 capture snippets support their respective
  • AFD-I35: advisory judge: fail {"faithful": "所引 attention_metadata.py:L90-L117 显示,多 ubatch 路径直接构造 payload,忽略传入的 dp_metadata;L119-L144 也允许非 None 的 AFDDPMetadata,不能据此断言 DP>1 必须传 vLLM DPMetadata。证据还不足以支持每次 send 前都必须先 stage pending metadata。", "non_contradictory": "AFD-I33 明确要求 ubatch capture 分支保持 _afd_pending_metadata = None,并由 AFDU
  • AFD-I41: advisory judge: fail {"faithful": "证据 L46-L84 显示 consume 只核对 (num_reqs, num_tokens)。如果两个 descriptor 的这两个值相同,交换其顺序不会报错;新增规则声称 descriptor 顺序改变时会报错,表述过于绝对。其余关于调用顺序、FULL 校验和 assert_complete 位置的描述分别有 L113-L137、L358-L391 支持。", "non_contradictory": "所示规则没有与该规则冲突;AFD-I33 要求先发送再置 suppress,AFD-I38 要求在 finally 中恢复符号,与 L113
  • AFD-I44: advisory judge: fail {"faithful": "所引 GPU L308–L321、L351–L364 和 NPU L499–L516 支持先更新控制面、再进入 graph,并在调用 _ffn_forward 时传 update_connector_state=False。但证据未证明“重复更新会让控制面状态与 Attention 侧不同步”这一后果。", "non_contradictory": "所列规则没有要求在 capture 内更新控制面。AFD-I46 说明 REPLAY 不执行该更新,与本规则的 capture 要求不冲突。", "actionable": "审查者可以检查新增的 captur
  • AFD-I49: advisory judge: fail {"faithful": "GPU 的“每次 recv 后都要”说法遗漏了 if forward_context is not None 条件;只有条件成立时才执行所述赋值(ffn_model_runner.py:L223-L228)。其余主要说法有 ffn_model_runner.py:L194-L199 和 npu/ffn_model_runner.py:L298-L301、L315-L351 支持。", "non_contradictory": "与所示相邻规则没有冲突。AFD-I46 说明 graph replay 不执行 _ffn_forward 的 Python 代码;本
  • AFD-I52: advisory judge: fail {"faithful": "所引 GPU 代码支持 daemon 线程、线程内 set_device、synchronize 和异常记录(ffn_worker.py:L159-L179、L211-L218);NPU 片段支持线程内 set_device 和 synchronize(npu/ffn_worker.py:L164-L174、L190-L196)。但证据未展示 NPU 线程名称、start/stop 中的上抛调用,或 synchronize 与下一次 recv 的顺序;“线程内的异常只记入 _ffn_loop_error”也与 AFD-I53 所述关闭期间 NPU 异常记为 debu
  • AFD-I53: advisory judge: fail {"faithful": "The cited NPU worker shows event.set() → connector.close() → join() → parent shutdown, and the GPU runner closes its connector in finally before the worker joins. The evidence does not establish the title’s general claim that runner shutdown is repeatable: only the NPU runner shows an
  • AFD-I56: advisory judge: fail {"faithful": "The cited topology code supports the opposite rank layouts, but the async formula uses expert_count, which defaults to ffn_size when num_routed_experts is None—not always num_routed_experts // ffn_size (async_cam.py:L843-L875). The evidence also does not establish that a shared helper
  • AFD-I57: advisory judge: fail {"faithful": "The cited code supports the stage-keyed enqueue, conditional FIFO dequeue, and send-side conversion and validation. But a later recv only takes a stale queued item if it omits at least one of context, topk_ids, or topk_weights; the rule states this as an unconditional outcome. The exce
  • AFD-I60: advisory judge: fail {"faithful": "async_cam.py:L800-L832 支持先检查日志开关、默认只描述张量属性,以及受 metadata_values 控制的读值;L746-L765 支持 layered_gmm_enabled 时传入 False。但“日志关闭时零开销”不准确:调用参数仍会求值,函数调用和环境变量检查也有开销。", "non_contradictory": "未见与所示规则冲突。AFD-I58 所述 .cpu() 读取发生在另一处,不属于本规则限定的 _log_cam_op_values。", "actionable": "可用于审查未来改动是否把张量读值放到日志开关检查之
  • AFD-I61: advisory judge: fail {"faithful": "AFD-I61 says close() resets all derived fields, but async_cam.py:L286-L329 shows init assigning group_name and close() leaving it unchanged. The supplied excerpts also do not establish the claimed initial field values or that every data plane method checks initialization.", "non_contra
  • AFD-I67: advisory judge: fail {"faithful": "camp2p.py:L917-L936 supports direct stage indexing, fallback for explicit None, and token-count grouping, but TP expansion and grouping are conditional. L780-L787 shows that update_state_from_dp_metadata assigns the list; it does not establish that every stage must pass through that me

Coverage:

Routes come from the adapter manifest (review_routes); kb init writes no _routes.yaml and suggests the entries it lacks on the checklist. "after" counts those suggestions as if the adapter PR were merged.

metric before after
PR-weighted, routed 81.5% 81.5%
PR-weighted, rule-bearing 14.8% 74.4%

Hot paths without rules:

  • afd_plugin/v1/worker/ascend/ffn_model_runner.py (20 PRs)
  • afd_plugin/v1/worker/ascend/attention_model_runner.py (15 PRs)
  • afd_plugin/v1/worker/ascend/ffn_worker.py (12 PRs)
  • afd_plugin/compat/ascend/runtime.py (10 PRs)
  • afd_plugin/v1/worker/dbo.py (9 PRs)
  • afd_plugin/v1/worker/cuda_graph.py (8 PRs)
  • afd_plugin/v1/worker/ascend/attention_worker.py (7 PRs)
  • afd_plugin/compat/ascend/ops.py (6 PRs)
  • afd_plugin/compat/ascend/feature_validation.py (5 PRs)
  • afd_plugin/compat/ascend/profiler.py (5 PRs)
  • afd_plugin/v1/worker/npu/npu_ubatch_wrapper.py (5 PRs)
  • afd_plugin/compat/npu/forward_context.py (4 PRs)
  • afd_plugin/v1/worker/ascend/forward_context.py (4 PRs)
  • afd_plugin/v1/worker/ascend/npu_ubatch_wrapper.py (4 PRs)
  • afd_plugin/v1/worker/ascend/ubatch_utils.py (4 PRs)
  • afd_plugin/v1/worker/npu/forward_context.py (4 PRs)
  • afd_plugin/compat/ascend/forward_context.py (3 PRs)
  • afd_plugin/compat/npu/ops.py (3 PRs)
  • afd_plugin/v1/worker/ascend/pcp_debug.py (3 PRs)
  • afd_plugin/compat/ascend/runtime_config.py (2 PRs)
  • afd_plugin/compat/profiler.py (2 PRs)
  • afd_plugin/v1/worker/_optional.py (2 PRs)
  • afd_plugin/v1/worker/ascend/ubatching.py (2 PRs)
  • afd_plugin/v1/worker/npu/pcp_debug.py (2 PRs)
  • afd_plugin/v1/worker/npu/ubatch_utils.py (2 PRs)
  • afd_plugin/v1/worker/npu/ubatching.py (2 PRs)
  • afd_plugin/compat/npu/profiler.py (1 PRs)
  • afd_plugin/v1/worker/npu/mla_graph.py (1 PRs)

Not done (budget or caps):

  • module afd_plugin/v1/worker/ (owner execution-platforms): reserving $5.9247 would exceed the budget (spent $27.5859 of $30.00)
  • module afd_plugin/ (owner plugin-boundary): reserving $5.9247 would exceed the budget (spent $27.5859 of $30.00)
  • module afd_plugin/connectors/gpu/ (owner connectors): reserving $5.9247 would exceed the budget (spent $27.5859 of $30.00)
  • module afd_plugin/compat/npu/ (owner compatibility): reserving $5.9247 would exceed the budget (spent $27.5859 of $30.00)
  • module afd_plugin/ (owner connectors): reserving $5.9247 would exceed the budget (spent $27.5859 of $30.00)
  • module afd_plugin/compat/npu/ (owner execution-platforms): reserving $5.9247 would exceed the budget (spent $27.5859 of $30.00)
  • module afd_plugin/model_executor/ (owner model-integration): reserving $5.9247 would exceed the budget (spent $27.5859 of $30.00)
  • module afd_plugin/ (owner compatibility): reserving $5.9247 would exceed the budget (spent $27.5859 of $30.00)
  • module afd_plugin/ (owner execution-platforms): reserving $5.9247 would exceed the budget (spent $27.5859 of $30.00)

Notes:

  • deepen stopped: budget exhausted with 9 hot group(s) left; target not reached (74% < 85%); hottest files without rules: afd_plugin/v1/worker/ascend/ffn_model_runner.py (20), afd_plugin/v1/worker/ascend/attention_model_runner.py (15), afd_plugin/v1/worker/ascend/ffn_worker.py (12), afd_plugin/compat/ascend/runtime.py (10), afd_plugin/v1/worker/dbo.py (9)
  • 2 hot group(s) skipped: their owner already bears rules

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f7b1ee07bd

ℹ️ 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".


# afd_plugin/v1/worker 审查规则:AFD 事务元数据、控制面发送与 runner 生命周期

## AFD-I34 — `install_afd_metadata_on_forward_context` 只在 pending 为空时新建事务,顺序和子 context 判定不能改

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Point the owner routes at the new rule pages

For reviews touching any of these four owners, Direct still routes to the sibling architecture.md files (for example, adapters/afd_plugin/manifest.yaml:116-163), whose quick-map status is unavailable and which do not link these new component rules. Because the review workflow opens only the returned exact route and then stops navigation, all 31 rules added here are skipped, despite the reported rule-bearing coverage increase; update the manifest routes to the corresponding rules.md pages or make the routed pages deliver these rules.

AGENTS.md reference: knowledge/AGENTS.md:L16-L16

Useful? React with 👍 / 👎.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-30T19:39:25.985190Z f7b1ee0 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@tzhouam tzhouam closed this Sep 30, 2026
@tzhouam tzhouam reopened this Sep 30, 2026
@tzhouam
tzhouam merged commit 32e062e into main Sep 30, 2026
1 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant