add-test
Add a new integration test to PilotSwarm test suite. Tests verify end-to-end flows through PilotSwarmClient, duroxide orchestration, and the Copilot SDK.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Add a new integration test to PilotSwarm test suite. Tests verify end-to-end flows through PilotSwarmClient, duroxide orchestration, and the Copilot SDK.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
The order of operations for changing a live agent safely — diagnose, patch, publish, converge, verify, roll back. Use whenever you are about to modify an agent package that something is already running on.
Deploy PilotSwarm to AKS using the repo's canonical scripts and checks. Use when refreshing secrets, building/pushing the worker image, rolling out to AKS, or verifying provider/model changes in the live cluster.
Reset remote PilotSwarm state for AKS safely. Use when wiping the PilotSwarm database/blob state, clearing stale orchestration history, or recovering from namespace drift and replay/nondeterminism issues.
Use when bringing up a fresh, isolated PilotSwarm environment (`mysandbox`, `myenv2`, etc.) via the npm Bicep/GitOps orchestrator at `deploy/scripts/deploy.mjs`. Covers `new-env` scaffolding, EDGE_MODE × TLS_SOURCE selection, the `all` aggregate, per-service redeploys with `--steps`, force-redeploy semantics, verification, and teardown. Strictly separate from the legacy bash path operated by `scripts/deploy-aks.sh`.
Use after deploying a PilotSwarm stamp with VPN_GATEWAY_ENABLED=true when an operator needs the Azure VPN client profile (azurevpnconfig.xml). Wraps deploy/scripts/auth/Get-VpnClientProfile.ps1 — downloads the gateway-issued profile zip via 'az network vnet-gateway vpn-client generate' and extracts it under the gitignored deploy/envs/local/<env>/vpn-client/ folder. The XML is the same for every user (no per-user credentials), and end users still authenticate with their own Entra ID at connect time.
How to compute model latency and estimated $ cost from PilotSwarm observability data. Read this before reporting that a model is "slow" or "expensive" — most apparent slowness is orchestration overhead, not model inference, and most cost numbers are guesses unless they reference a real published price card.
| name | add-test |
| description | Add a new integration test to PilotSwarm test suite. Tests verify end-to-end flows through PilotSwarmClient, duroxide orchestration, and the Copilot SDK. |
Integration tests live in packages/sdk/test/local/ as individual .test.js files (or in subdirectories like sub-agents/). They require a running PostgreSQL database and a GitHub token (in .env). Tests use vitest with describe/it.
packages/sdk/test/local/ following this pattern:import { describe, it, beforeAll } from "vitest";
import { createTestEnv, preflightChecks } from "../helpers/local-env.js";
import { withClient } from "../helpers/local-workers.js";
import { assert, assertNotNull } from "../helpers/assertions.js";
const TIMEOUT = 120_000;
async function testMyFeature(env) {
await withClient(env, async (client) => {
const session = await client.createSession();
console.log(" Sending: prompt text");
const response = await session.sendAndWait("prompt text", TIMEOUT);
console.log(` Response: "${response}"`);
assertNotNull(response, "Should get a response");
});
}
describe.concurrent("My Feature", () => {
beforeAll(async () => { await preflightChecks(); });
it("My Test Case", { timeout: TIMEOUT }, async () => {
const env = createTestEnv("my-feature");
try { await testMyFeature(env); } finally { await env.cleanup(); }
});
});
Add to the vitest config — the file will be auto-discovered if it matches test/local/**/*.test.js. Ensure the vitest config includes the path.
Run the test:
cd packages/sdk
npx vitest run test/local/my-feature.test.js # run just this file
npx vitest run test/local/my-feature.test.js -t "My Test" # filter by test name
./scripts/run-tests.sh --suite=my-feature # via the runner script
withClient(env, fn) — spins up a co-located worker + client pair, auto-forwards setSessionConfig. Use for most tests.registerTools), create them manually outside withClient.let toolCalled = false flag, assert it's true after the prompt.session.on() or session.getMessages(), add a setTimeout delay for polling.waitThreshold: 0 in client opts to force durable timers even for short waits.createCatalog(env) and validateSessionAfterTurn(env, sessionId) from test/helpers/cms-helpers.js.client.createSession() without overriding systemMessage. The default agent prompt should be sufficient. If it isn't, fix the product, not the test.retry to test configs. Fix the root cause.describe.concurrent() for file-level parallelism within the vitest runner.TIMEOUT constant (120s default) for sendAndWait.test/helpers/assertions.js.describe/it from vitest.console.log(" ...") for debuggability.env via createTestEnv() for schema isolation.packages/sdk/test/local/ — all test filespackages/sdk/test/helpers/ — shared helpers (assertions, fixtures, local-env, local-workers, cms-helpers)packages/sdk/vitest.config.js — vitest configurationscripts/run-tests.sh — shell runner for all suites