团队决议:由 Swarm 运行时(非 AM)拉起专家 agent 池并执行每用户限额。 代码: - orchestrator/agent_launcher.py(新):plan_launch_specs(纯,按 min(池大小, MAX_AGENTS_PER_USER −已连) 限额 + 组装每 agent env)、resolve_model_key(override→azkv secret_ref 解析(部署 SecretResolver/dev HEICODE_SECRET_<name>)→OPENAI_API_KEY 兜底,解析不到不伪造)、可插拔后端 launch()(none 默认/subprocess/command 模板,fail-soft)、stop_launched。 - orchestrator/main.py:create 播种后调 launch_swarm_agents(仅去中心化、非 Manager 显式 agent; 从 create x-user-id 取 user_id;key 服务端解析,不入 create 体);stop_swarm_run 调 stop_launched。 文档:runtime-contract §3.3 由「AM 拉起(提案待确认)」改为「Swarm 拉起 + 限额(已定)」, 更新 env 来源列(key=Swarm 从 secret_ref 解析、AGENT_ID/CAPABILITIES=Swarm launcher、 HEICODE_USER_ID=从 create 透传)+ 后端/限额/解析约束;security-boundary §6 增 Swarm 拉起 + 服务端解析 key(不上 argv/日志)说明。 测试:scripts/test-agent-launcher.py(限额封顶、env 组装、key 解析优先级、command 模板、 none no-op)接入 CI。e2e/contract 回归通过(默认 backend=none,行为不变)。 影响范围:仅 agent_swarm(orchestrator + docs + 测试 + CI)。默认 backend=none 不自动拉起、 向后兼容;密钥仅服务端 env 注入、不入 create 体/回调/日志/argv(满足 §3.1 + security-boundary)。 不改 Manager↔Swarm 契约鉴权/计费账本/审批链。 Refs #16 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
152 lines
5.2 KiB
YAML
152 lines
5.2 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: ["**"]
|
|
pull_request:
|
|
branches: ["**"]
|
|
|
|
jobs:
|
|
guardrails:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
# Defense in depth: fail if secrets or heavy/generated dirs were ever committed.
|
|
- name: Block secrets & node_modules
|
|
run: |
|
|
if git ls-files | grep -E '(^|/)\.env($|\.)|(^|/)secrets/|\.pem$|\.key$|\.p12$|\.pfx$|(^|/)id_rsa$|(^|/)id_ed25519$'; then
|
|
echo "::error::Secret-like files are tracked — remove them and rotate any exposed credential."; exit 1
|
|
fi
|
|
if git ls-files | grep -E '(^|/)node_modules/'; then
|
|
echo "::error::node_modules is tracked — it must be gitignored."; exit 1
|
|
fi
|
|
|
|
- name: Required standards files present
|
|
run: |
|
|
for f in CLAUDE.md PROJECT_STANDARD.md README.md; do
|
|
test -f "$f" || { echo "::error::Missing required file: $f"; exit 1; }
|
|
done
|
|
|
|
tests:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.13"
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r orchestrator/requirements.txt -r agent/requirements.txt
|
|
|
|
# Hermetic: in-memory store, planner forced offline by the tests — no model key needed.
|
|
- name: Manager contract test
|
|
env: { REDIS_FAKE: "1" }
|
|
run: python scripts/test-runtime-contract.py
|
|
|
|
- name: Workflow mechanism smoke test
|
|
env: { REDIS_FAKE: "1" }
|
|
run: python scripts/test-merge-smoke.py
|
|
|
|
- name: End-to-end workflow test
|
|
env: { REDIS_FAKE: "1" }
|
|
run: python scripts/test-workflow-e2e.py
|
|
|
|
- name: Per-user agent cap (MAX_AGENTS_PER_USER)
|
|
env: { REDIS_FAKE: "1" }
|
|
run: python scripts/test-max-agents-per-user.py
|
|
|
|
- name: Swarm agent launcher (plan/limit/key-resolve) (#16)
|
|
run: python scripts/test-agent-launcher.py
|
|
|
|
- name: Manager event-contract test
|
|
env: { REDIS_FAKE: "1" }
|
|
run: python scripts/test-contract-events.py
|
|
|
|
- name: Audit / lineage trace (replayable) (#17)
|
|
env: { REDIS_FAKE: "1" }
|
|
run: python scripts/test-audit-trace.py
|
|
|
|
- name: Benchmark metric formulas (v2.1)
|
|
env: { REDIS_FAKE: "1" }
|
|
run: python scripts/test-benchmark-metrics.py
|
|
|
|
- name: Benchmark collector
|
|
env: { REDIS_FAKE: "1" }
|
|
run: python scripts/test-benchmark-collector.py
|
|
|
|
- name: Baseline comparison
|
|
env: { REDIS_FAKE: "1" }
|
|
run: python scripts/test-baseline-comparison.py
|
|
|
|
- name: Code sandbox (in-pod test runner)
|
|
run: python scripts/test-sandbox.py
|
|
|
|
- name: Security boundary enforcement (secret/workspace/sandbox) (#19)
|
|
env: { REDIS_FAKE: "1" }
|
|
run: python scripts/test-security-boundary.py
|
|
|
|
- name: Quality instrumentation (Group B)
|
|
env: { REDIS_FAKE: "1" }
|
|
run: python scripts/test-quality.py
|
|
|
|
- name: Decision-engine pheromone library (τ)
|
|
env: { REDIS_FAKE: "1" }
|
|
run: python scripts/test-decision-engine.py
|
|
|
|
- name: Dispatch scoring formulas
|
|
env: { REDIS_FAKE: "1" }
|
|
run: python scripts/test-dispatch-score.py
|
|
|
|
# --- decentralized swarm flow (the only flow; primitives are unconditional) ---
|
|
- name: Swarm seeder (#6)
|
|
run: python scripts/test-swarm-seed.py
|
|
|
|
- name: Swarm self-selection dispatch
|
|
env: { REDIS_FAKE: "1" }
|
|
run: python scripts/test-swarm-dispatch.py
|
|
|
|
- name: Swarm autonomous task generation (#7)
|
|
env: { REDIS_FAKE: "1", AGENT_PROPOSAL_BUDGET: "3" }
|
|
run: python scripts/test-swarm-autonomous.py
|
|
|
|
- name: Swarm task competition (#8)
|
|
env: { REDIS_FAKE: "1" }
|
|
run: python scripts/test-swarm-competition.py
|
|
|
|
- name: Swarm cross-review (#11)
|
|
env: { REDIS_FAKE: "1" }
|
|
run: python scripts/test-swarm-cross-review.py
|
|
|
|
- name: Swarm convergence (#12)
|
|
env: { REDIS_FAKE: "1" }
|
|
run: python scripts/test-swarm-convergence.py
|
|
|
|
- name: Swarm health guard
|
|
env: { REDIS_FAKE: "1" }
|
|
run: python scripts/test-swarm-guard.py
|
|
|
|
# Pure-module unit tests for the swarm primitives (formulas/policies, infra-free).
|
|
- name: Swarm primitive modules (unit)
|
|
env: { REDIS_FAKE: "1" }
|
|
run: |
|
|
python scripts/test-autonomous-tasks.py
|
|
python scripts/test-task-competition.py
|
|
python scripts/test-cross-review.py
|
|
python scripts/test-convergence.py
|
|
|
|
# --- benchmark baseline runners + suite smoke (Group C, #21) ---
|
|
# HEICODE_SANDBOX_ISOLATED: the runners grade generated code in the fail-closed sandbox; the
|
|
# CI runner is ephemeral/isolated, so confirm isolation here (see security-boundary §8.1).
|
|
- name: Benchmark runners (Group C)
|
|
env: { HEICODE_SANDBOX_ISOLATED: "1" }
|
|
run: python scripts/test-benchmark-runners.py
|
|
|
|
# Offline = pipeline validation only (deterministic, no real G_E). Guards against regressions.
|
|
- name: Benchmark suite smoke (offline)
|
|
env: { HEICODE_SANDBOX_ISOLATED: "1" }
|
|
run: python scripts/run-benchmark-suite.py --taskset coding-set-1
|