agent-tests
Skill213 starsChanged 2 months agoMITView on GitHub
MUST READ before calling RunAgentTests or touching agent-tier test infrastructure -- these tests spawn real AI clients (Claude Code, Codex) and SPEND SUBSCRIPTION USAGE; never run casually. Tier model, async runner rationale, auth/isolation rules.
- Reads credentials
In this repository30 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- web/llms-full.txtllms.txt
- web/llms.txtllms.txt
- add-mcp-toolSkill
- briefSkill
- build-uiSkill
- collabSkill
- create-extensionSkill
- create-operatorSkill
- debug-operatorSkill
- externalize-operatorSkill
- glsl-shadersSkill
- manage-annotationsSkill
- mcp-tools-referenceSkill
- merge-divergent-toxSkill
- movie-exportSkill
- multi-instanceSkill
- multi-session-etiquetteSkill
- operator-gotchasSkill
- parameter-designSkill
- pop-networksSkill
- publish-specimenSkill
- releaseSkill
- run-testsSkill
- specimen-authoringSkill
- td-api-referenceSkill
- td-recoverySkill
- testingSkill
- visual-aestheticsSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 23
Tier 1 (
test_agent_contract): no LLM. An out-of-process stdlib MCP client (agent_clients/mcp_contract_client.py) spawns the EXACT bridge … - Very specific: line 98
Never run RunAgentTests() casually: it spends the user's subscription usage and takes minutes.
- Very specific: line 101
Prefer Tier 1 alone (RunAgentTests(suite_name='test_agent_contract')) for transport/contract diagnosis -- it is free and deterministic.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Agent-Tier Tests (AI-client connectivity)
The AGENT tier verifies that real AI clients -- Claude Code, Codex, and a
deterministic MCP contract client -- can reach and correctly use Envoy's MCP
tools end to end. Like destructive-tests.md, this is a dev-only convention
for the Embody test harness -- it has NO shipped template counterpart.
The tier model
- Suites inherit
AgentTestCase(which carriesAGENT = True). They are EXCLUDED fromRunTests/RunTestsSync/RunTestsDeferred*AND fromRunDestructiveTestsby_discoverTestSuites' tier filter. Do not remove that guard: a normal full run must never spawn AI clients or burn subscription usage silently. - They run ONLY via
op.unit_tests.RunAgentTests(suite_name=None, test_name=None, delay_frames=30)-- fire-and-forget; pollGetResults(). - Two layers:
- Tier 1 (
test_agent_contract): no LLM. An out-of-process stdlib MCP client (agent_clients/mcp_contract_client.py) spawns the EXACT bridge command from.mcp.jsonand checks handshake, tool inventory vs theEXPECTED_ENVOY_TOOLSmanifest, and a curated call sequence. This is the cheap, deterministic half -- run it first when diagnosing. - Tier 2 (
test_agent_smoke_claude/test_agent_smoke_codex): a real agent on scripted micro-tasks, verified against LIVE TD state (probe op exists with the exact run token), never the agent's prose alone.
- Tier 1 (
Why the runner is async (do not "simplify" it)
Envoy drains MCP requests on TD's MAIN thread (max 5 per frame). A test that
blocks the main thread while an agent subprocess makes MCP calls deadlocks
the very tools under test until every call times out. So RunAgentTests
launches subprocesses non-blocking (stdout/stderr to temp FILES -- an unread
PIPE deadlocks the child at ~64KB; stdin always DEVNULL -- codex exec hangs
probing a silent stdin pipe on Windows, openai/codex#20919) and polls them
via a run(delayFrames=N) chain using the STRING-EXPRESSION form, so a
mid-run extension reinit cannot strand the state machine on a stale instance.
Timeouts kill the whole process TREE (the CLIs spawn the bridge as a child).
Auth and billing (subscription only)
AgentTestCase.launchEnv()stripsANTHROPIC_API_KEY,ANTHROPIC_AUTH_TOKEN,OPENAI_API_KEY,CODEX_API_KEYfrom the child env: a set API key silently OVERRIDES subscription auth and bills per token. With them absent,claude -puses the stored Pro/Max OAuth login andcodex execthe ChatGPT login.- Missing CLI -> loud SKIP (
requireCli). Codex suites gate oncodex login status(exit 0 = logged in) before any billed task. - Claude exit codes worth knowing: 100 = not logged in, 101 = MCP server
unreachable (with
--strict-mcp-config), 102 = tool permission denied in-pmode (no TTY -> no prompt -> immediate deny). Codex exec exit codes are NOT documented as task success -- judge by--output-last-message+ TD state.
Isolation choices (keep them)
- Smoke agents run from a NEUTRAL temp cwd: no CLAUDE.md / AGENTS.md / project settings, so the agent does the micro-task, not session rituals.
- Claude:
--mcp-config <envoy-only json>+--strict-mcp-config+ per-task--allowedToolsallowlists + a standing--disallowedToolsdenylist (execute_python, run_tests, delete_op, import_network, restart_td, launch_td, switch_instance). - Codex: inline
-c mcp_servers.envoy.*overrides (Codex does not read.mcp.json; the user's~/.codex/config.tomlis never touched), with-c approval_policy="never"(the exec subcommand rejects-aon installed builds) +default_tools_approval_mode="auto"so MCP calls are not auto-cancelled,--sandbox read-only(MCP servers spawn OUTSIDE the sandbox), and a real.exewhen the npm.cmdshim is what PATH probing finds. delete_opis NOT part of any Tier-2 smoke task: a peer session's recent writes can gate it mid-test (multi-session destructive gate). Tier 1 covers delete_op and treats a MULTI-SESSION GATE refusal as operational-with-gate.- Each spawned client registers as its own Envoy session via
EMBODY_SESSION_LABEL(agent-test-tier1,claude-smoke,codex-smoke), soget_sessions/_peerstraffic is attributable.
Maintenance
- Envoy tool surface changed -> update
EXPECTED_ENVOY_TOOLSintest_agent_contract.pyin the SAME commit. The inventory check fails on drift in either direction. Remember tools register on the MCPServer instance at Envoy START -- restart Envoy before believing a mismatch. - Model pins live at the top of the smoke suites (
CLAUDE_SMOKE_MODEL,CODEX_SMOKE_MODEL). The Codex model list rotates with releases; update deliberately, never blindly. - The runner machinery itself is unit-tested in
test_agent_runner.py(normal tier): tier gating, job lifecycle, timeout kill, verdict classification, Filecleanup storage roundtrip. Update it when touching the agent runner.
For the AI agent
- Never run
RunAgentTests()casually: it spends the user's subscription usage and takes minutes. Run it when asked, before releases, or when MCP-facing code changed. - Prefer Tier 1 alone (
RunAgentTests(suite_name='test_agent_contract')) for transport/contract diagnosis -- it is free and deterministic. - The spawned agents appear as peer sessions; expect
_peersadvisories during a run and do not treat the smoke agents' touches as a human peer.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

