# PR #40306 完整报告

- 仓库：`vllm-project/vllm`
- 标题：[ROCm][CI] Fix `trust_remote_code` AttributeError in EAGLE3 acceptance length test
- 合并时间：2026-04-25 10:59
- 原文链接：http://prhub.com.cn/vllm-project/vllm/pull/40306

---

# 执行摘要

- 一句话：修复 EAGLE3 测试中缺失 trust_remote_code 属性错误
- 推荐动作：建议合并，修复简单直接，经过 approve。

# 功能与动机

测试 `test_eagle3_acceptance_length` 因 `trust_remote_code` 属性缺失而失败，影响 ROCm CI 流程。PR body 明确描述了问题：`get_samples` 读取 `args.trust_remote_code` 时抛出 AttributeError。

# 实现拆解

1. **修复属性缺失**：在 `tests/v1/spec_decode/test_acceptance_length.py` 的 `get_mt_bench_prompts` 函数中，向 `SimpleNamespace` 添加 `trust_remote_code=False` 属性。
2. **放宽平台条件**：将 `@pytest.mark.skipif` 中的 `is_cuda()` 改为 `is_cuda_alike()`，使测试能在 ROCm 等 CUDA 兼容平台上运行。

关键文件：
- `tests/v1/spec_decode/test_acceptance_length.py`（模块 测试；类别 test；类型 test-coverage）: 修复测试中 SimpleNamespace 缺少 trust_remote_code 属性导致 AttributeError，并放宽平台检查条件。

关键符号：get_mt_bench_prompts

## 关键源码片段

### `tests/v1/spec_decode/test_acceptance_length.py`

修复测试中 SimpleNamespace 缺少 trust_remote_code 属性导致 AttributeError，并放宽平台检查条件。

```python
# 修改前：SimpleNamespace 缺少 trust_remote_code 属性，导致 get_samples 中访问 args.trust_remote_code 时出现 AttributeError。
args = SimpleNamespace(
    dataset_name="hf",
    dataset_path="philschmid/mt-bench",
    num_prompts=num_prompts,
    seed=42,
    no_oversample=False,
    endpoint_type="openai-chat",
    input_len=None,
    output_len=DEFAULT_OUTPUT_LEN,
    sharegpt_output_len=DEFAULT_OUTPUT_LEN,
    hf_name=None,
    hf_split="train",
    hf_subset=None,
    hf_output_len=DEFAULT_OUTPUT_LEN,
    no_stream=True,
    disable_shuffle=False,
    skip_chat_template=False,
    trust_remote_code=False,  # 新增：显式禁用远端代码执行，避免 AttributeError
)

```
```python
# 修改前：@pytest.mark.skipif(not current_platform.is_cuda(), ...) # 仅限 CUDA

# 修改后：放宽为 CUDA 兼容平台（如 ROCm）
@pytest.mark.skipif(
    not current_platform.is_cuda_alike(),
    reason="This test is only supported on CUDA-alike platforms.",
)

```

# 评论区精华

无人工评论，机器人自动审核通过。

- 暂无高价值评论线程

# 风险与影响

- 风险：风险极低。仅修改测试文件，添加一个配置项并放宽平台条件，不影响生产代码。
- 影响：影响范围仅限于测试 `test_eagle3_acceptance_length`。修复后该测试可在 ROCm 及 CUDA 平台正确运行，提升了 CI 对 AMD GPU 的覆盖。
- 风险标记：暂无

# 关联脉络

- 暂无明显关联 PR