Engine Testing
This page summarizes how to build, run, and validate Tandem Engine behavior across unit tests, smoke tests, and security checks.
Quickstart (engine + tauri dev)
Windows (PowerShell) from tandem/:
pnpm installpnpm engine:stop:windowscargo build -p tandem-aiNew-Item -ItemType Directory -Force -Path .\src-tauri\binaries | Out-NullCopy-Item .\target\debug\tandem-engine.exe .\src-tauri\binaries\tandem-engine.exe -Forcepnpm tauri devmacOS/Linux (bash) from tandem/:
pnpm installpkill tandem-engine || truecargo build -p tandem-aimkdir -p src-tauri/binariescp target/debug/tandem-engine src-tauri/binaries/tandem-enginepnpm tauri devQuick commands
cargo build -p tandem-aicargo run -p tandem-ai -- serve --host 127.0.0.1 --port 39731cargo test -p tandem-server -p tandem-core -p tandem-aiAPI token validation
Start a token-gated engine:
cargo run -p tandem-ai -- serve --host 127.0.0.1 --port 39731 --state-dir .tandem --api-token tk_test_tokenThen verify public health + gated routes:
curl -s http://127.0.0.1:39731/global/health | jq .curl -i -s http://127.0.0.1:39731/config/providerscurl -s http://127.0.0.1:39731/config/providers -H "X-Agent-Token: tk_test_token" | jq .Automated test layers
Rust unit/integration tests:
cargo test -p tandem-server -p tandem-core -p tandem-aiMission/routine focused tests:
cargo test -p tandem-server mission_ -- --nocapturecargo test -p tandem-server routines_ -- --nocapturecargo test -p tandem-server routine_policy_ -- --nocapturecargo test -p tandem-server routines_run_now_ -- --nocaptureAgent Team spawn policy tests:
cargo test -p tandem-orchestrator agent_team:: -- --nocapturecargo test -p tandem-server agent_team_spawn -- --nocaptureJSON-first contract tests:
cargo test -p tandem test_parse_task_list_strict -- --nocapturecargo test -p tandem test_parse_validation_result_strict_rejects_prose -- --nocaptureSidecar runtime contract tests:
cargo test -p tandem sidecar::tests::recover_active_run_attach_stream_uses_get_run_endpoint -- --nocapturecargo test -p tandem sidecar::tests::test_parse_prompt_async_response_409_includes_retry_and_attach -- --nocapturecargo test -p tandem sidecar::tests::cancel_run_by_id_posts_expected_endpoint -- --nocaptureMCP runtime regression tests:
cargo test -p tandem-runtime mcp::tests::extract_auth_challenge_from_result_payload -- --nocapturecargo test -p tandem-runtime mcp::tests::normalize_mcp_tool_args_maps_clickup_aliases -- --nocapturecargo test -p tandem-runtime mcp::tests -- --nocaptureManual MCP smoke checklist:
- Connect an MCP server and verify tools appear in
/tool. - Trigger an auth-gated tool and verify
mcp.auth.requiredappears in stream/events. - Complete authorization and retry the same tool (without restarting engine).
- Force refresh/disconnect failure and verify stale MCP tools are not left active.
- In web quickstart, verify run failures render in chat (no blank-response failure state).
Engine smoke tests
Windows:
./scripts/engine_smoke.ps1macOS/Linux:
bash ./scripts/engine_smoke.shOptional overrides:
HOSTNAME=127.0.0.1 PORT=39731 STATE_DIR=.tandem-smoke OUT_DIR=runtime-proof bash ./scripts/engine_smoke.shGitHub Project intake contract check
When validating the new coder GitHub Project flow, test the engine contract first before relying on desktop UI.
- Ensure a GitHub-capable MCP server is connected and its project tools are visible.
- Bind a coder project to a GitHub Project.
- Read the inbox and confirm the resolved schema fingerprint and TODO mapping.
- Intake one issue-backed TODO item.
- Confirm the returned coder run exposes
github_project_refandremote_sync_state.
Example curl flow:
TOKEN="tk_test_token"HOST="http://127.0.0.1:39731"PROJECT_ID="repo-123"
curl -s "$HOST/coder/projects/$PROJECT_ID/bindings" \ -H "X-Agent-Token: $TOKEN" | jq .
curl -s -X PUT "$HOST/coder/projects/$PROJECT_ID/bindings" \ -H "X-Agent-Token: $TOKEN" \ -H "Content-Type: application/json" \ -d '{ "github_project_binding": { "owner": "acme-inc", "project_number": 7, "repo_slug": "acme-inc/tandem" } }' | jq .
curl -s "$HOST/coder/projects/$PROJECT_ID/github-project/inbox" \ -H "X-Agent-Token: $TOKEN" | jq .
curl -s -X POST "$HOST/coder/projects/$PROJECT_ID/github-project/intake" \ -H "X-Agent-Token: $TOKEN" \ -H "Content-Type: application/json" \ -d '{ "project_item_id": "PVT_ITEM_123", "source_client": "engine_contract_test" }' | jq .SDK parity checks:
pnpm --dir packages/tandem-client-ts buildpython -m compileall packages/tandem-client-py/tandem_clientShared Engine Mode
Desktop and TUI default to shared engine mode:
- default port
39731 - clients attach to the same engine when available
- set
TANDEM_ENGINE_PORTto override for both desktop and TUI
Disable shared mode (legacy single-client behavior):
$env:TANDEM_SHARED_ENGINE_MODE="0"