Agent SkillsasJEI/vscode › agent-host-e2e-tests

agent-host-e2e-tests

GitHub

指导编写和维护 Agent Host 端到端测试。涵盖添加跨提供商测试、使用 CapiReplayProxy 录制或重新录制 YAML 固定装置、处理 SDK 升级后的重录,以及诊断回放缓存未命中和解决非确定性测试问题。

.github/skills/agent-host-e2e-tests/SKILL.md asJEI/vscode

触发场景

需要为 Agent Host 添加新的端到端测试用例 SDK 或 CLI 升级导致现有测试固定装置失效需重新录制 排查端到端测试中的回放失败或非确定性错误 维护 AHP 协议的测试基础设施

安装

npx skills add asJEI/vscode --skill agent-host-e2e-tests -g -y
更多选项

非标准路径

npx skills add https://github.com/asJEI/vscode/tree/main/.github/skills/agent-host-e2e-tests -g -y

不安装直接使用

npx skills use asJEI/vscode@agent-host-e2e-tests

指定 Agent (Claude Code)

npx skills add asJEI/vscode --skill agent-host-e2e-tests -a claude-code -g -y

安装 repo 全部 skill

npx skills add asJEI/vscode --all -g -y

预览 repo 内 skill

npx skills add asJEI/vscode --list

SKILL.md

Frontmatter
{
    "name": "agent-host-e2e-tests",
    "description": "Use when writing, recording, updating, or troubleshooting the agent host end-to-end tests under src\/vs\/platform\/agentHost\/test\/node\/protocol (black-box tests that drive the whole agent host over the AHP protocol, using a CapiReplayProxy record\/replay system for Claude\/Copilot\/Codex). Covers adding a cross-provider test, re-recording fixtures after an SDK bump, gating non-deterministic or platform-specific tests, and diagnosing replay cache misses."
}

Agent host end-to-end tests

These tests run the whole agent host end-to-end (real server, real bundled provider SDK/CLI, real AHP protocol) while replaying recorded model traffic from committed YAML fixtures — deterministic and tokenless.

Before doing anything, read the architecture + troubleshooting reference: src/vs/platform/agentHost/test/node/protocol/README.md

It documents the mental model, the fixture format, every config flag, and a symptom→cause→fix troubleshooting table. This skill is only the workflows; the README is the source of truth for how it works.

Non-negotiable rules

  1. Replay is default and strict. No env var → serves committed fixtures, no token, no network. An unrecorded request is a hard cache miss that fails the run.
  2. A fixture's filename is derived from the test title (${provider}-${slug}.yaml). Renaming a test orphans its fixture — re-record after any rename.
  3. Recording needs a real token (GITHUB_TOKEN or gh auth token) and talks to real CAPI. Only run it intentionally, with trivial/read-only prompts in temp dirs.
  4. Never hand-write or hand-edit fixture contents (especially not secrets/paths). Fixtures are always produced by recording; normalization/redaction is the proxy's job.
  5. Gate, don't fight. If a behavior can't replay deterministically, gate the test (see Workflow C) instead of loosening timeouts or the strict check.

Workflow A — Add a cross-provider test

  1. Add a test(...) inside defineAgentHostE2ETests in agentHostE2ETestHelpers.ts. Drive it with dispatchTurn(...) + client.waitForNotification(...); assert on AHP notifications, never on wall-clock timing.
  2. Keep the prompt minimal and deterministic (fewer model turns → smaller, more robust fixtures).
  3. Record fixtures for every enabled provider (Workflow B).
  4. Review the diff (Workflow B step 3), then run the test in plain replay mode to confirm it's green, then commit the test + fixtures together.

Provider-specific assertions go in that provider's *.integrationTest.ts after the defineAgentHostE2ETests(config) call.

Workflow B — Record / re-record fixtures

Re-record when you add a test, or when a bundled SDK/CLI bump changes its wire behavior (new endpoint, different turn count, changed tool schema).

  1. Ensure a token is available: gh auth token (or export GITHUB_TOKEN).
  2. Record per provider:
    AGENT_HOST_REPLAY_RECORD=1 ./scripts/test-integration.sh --run \
      src/vs/platform/agentHost/test/node/protocol/claudeAgentHostE2E.integrationTest.ts
    
    Repeat for copilotAgentHostE2E / codexAgentHostE2E as needed.
  3. Review git diff on the fixtures: no local usernames/absolute paths, no tokens, no unreleased model ids. If something leaked, the fix is to extend normalization/redaction in capiReplayProxy.ts (_normalize + the *_RE redactors) and re-record — not to edit the fixture.
  4. Run plain replay (no env var) to confirm green, then commit.

If an SDK now hits a new ancillary/bootstrap endpoint (a probe, not a real model turn), add it to capiStubs.ts (served, not recorded) instead of recording it — see how /models/session is handled.

Workflow C — When a test can't replay deterministically

Real-time streaming, mid-turn aborts, and POSIX-specific local execution (shell tools, pwd, git worktrees) don't replay reliably. Gate them precisely so you keep coverage where it works:

  • Record-only (no deterministic replay at all): (RECORD ? test : test.skip)('…') — see can abort a running turn.
  • Subagent fixtures stale after an SDK bump: re-record them (AGENT_HOST_REPLAY_RECORD=1 …). Subagent flows are the most SDK-version-sensitive (parent + child share one /v1/messages sequence), but replay reliably once re-recorded, so no gating is needed.
  • POSIX-only (fails on Windows): gate with !isWindows, or a per-provider flag like shellPermissionReplayUnstableOnWindows when only one provider diverges. See the worktree and shell-permission tests.

Always add a comment explaining why the gate exists.

Verifying & troubleshooting

  • Run a single provider in replay: ./scripts/test-integration.sh --run <path> (no env var).
  • Filter to one test: add --grep "<test title fragment>".
  • For any failure (cache miss, missing fixture, per-OS timeout, leaked PII, subagent staleness, accidental real-CAPI contact), go to the Troubleshooting section of the README — it maps each symptom to its cause and fix.

版本历史

  • ce4db66 当前 2026-07-19 08:56

同 Skill 集合

.agents/skills/launch/SKILL.md
.github/skills/accessibility/SKILL.md
.github/skills/add-policy/SKILL.md
.github/skills/agent-host-logs/SKILL.md
.github/skills/author-contributions/SKILL.md
.github/skills/auto-perf-optimize/SKILL.md
.github/skills/azure-pipelines/SKILL.md
.github/skills/chat-customizations-editor/SKILL.md
.github/skills/chat-perf/SKILL.md
.github/skills/code-oss-logs/SKILL.md
.github/skills/component-fixtures/SKILL.md
.github/skills/cpu-profile-analysis/SKILL.md
.github/skills/design-philosophy/SKILL.md
.github/skills/fix-ci-failures/SKILL.md
.github/skills/fix-errors/SKILL.md
.github/skills/heap-snapshot-analysis/SKILL.md
.github/skills/hygiene/SKILL.md
.github/skills/integrated-browser/SKILL.md
.github/skills/integration-tests/SKILL.md
.github/skills/memory-leak-audit/SKILL.md
.github/skills/otel/SKILL.md
.github/skills/sessions/SKILL.md
.github/skills/smoke-tests/SKILL.md
.github/skills/symbolicate-crash-dump/SKILL.md
.github/skills/tool-rename-deprecation/SKILL.md
.github/skills/unit-tests/SKILL.md
.github/skills/update-screenshots/SKILL.md
.github/skills/ux-css-layout/SKILL.md
.github/skills/ux-theming/SKILL.md
.github/skills/vscode-dev-workbench/SKILL.md
extensions/copilot/.agents/skills/anthropic-sdk-upgrader/SKILL.md
extensions/copilot/.agents/skills/launch/SKILL.md
src/vs/sessions/skills/act-on-feedback/SKILL.md
src/vs/sessions/skills/code-review/SKILL.md
src/vs/sessions/skills/commit/SKILL.md
src/vs/sessions/skills/create-draft-pr/SKILL.md
src/vs/sessions/skills/create-pr/SKILL.md
src/vs/sessions/skills/fix-ci/SKILL.md
src/vs/sessions/skills/generate-run-commands/SKILL.md
src/vs/sessions/skills/merge/SKILL.md
src/vs/sessions/skills/sync-upstream/SKILL.md
src/vs/sessions/skills/sync/SKILL.md
src/vs/sessions/skills/troubleshoot/SKILL.md
src/vs/sessions/skills/update-pr/SKILL.md
src/vs/sessions/skills/update-skills/SKILL.md
extensions/copilot/.agents/skills/github-copilot-upgrader/SKILL.md

元信息

文件数
0
版本
ce4db66
Hash
e7906dd1
收录时间
2026-07-19 08:56

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-07-20 14:17
浙ICP备14020137号-1 $访客地图$