II.
Page JSON
Structured · livepage:docs-adapters-babysitter-integrations-testing
Test Strategy — Agent-Adapter Babysitter Integration json
Inspect the normalized record payload exactly as the atlas UI reads it.
{
"id": "page:docs-adapters-babysitter-integrations-testing",
"_kind": "Page",
"_file": "wiki/docs/adapters-babysitter-integrations/testing.md",
"_cluster": "wiki",
"attributes": {
"nodeKind": "Page",
"sourcePath": "docs/adapters-babysitter-integrations/testing.md",
"sourceKind": "repo-docs",
"title": "Test Strategy — Agent-Adapter Babysitter Integration",
"displayName": "Test Strategy — Agent-Adapter Babysitter Integration",
"slug": "docs/adapters-babysitter-integrations/testing",
"articlePath": "wiki/docs/adapters-babysitter-integrations/testing.md",
"article": "\n# Test Strategy — Agent-Adapter Babysitter Integration\n\n## Test Layers\n\n### 1. SDK Unit Tests\n\n**Discovery tests** (`packages/babysitter-sdk/src/harness/__tests__/externalAgentDiscovery.test.ts`):\n- Returns `{ available: false }` when adapters not importable\n- Returns agent list when adapters module available (mock adapter-registry)\n- Caches results for 60s, respects `force: true`\n- Handles timeout gracefully (returns empty on timeout)\n- Falls back to CLI (`adapters doctor --json`) when module import fails\n\n**Task type tests** (`packages/babysitter-sdk/src/tasks/__tests__/kinds.test.ts`, `defineTask.test.ts`, `serializer.test.ts`):\n- `externalAgentTask()` helper produces correct TaskDef shape\n- `agent.responderType: \"agent\"` metadata preserved through defineTask → build → TaskDef\n- `adapter` field required when `agent.responderType` is `\"agent\"`\n- `fallbackType: \"internal\"` flag preserved\n- `humanTask()` emits `breakpoint.responderType: \"human\"`\n- `autoTask()` emits `agent.responderType: \"auto\"`\n\nRuntime effect-routing tests are part of the tasks-adapter follow-up work. The SDK\nunit tests only validate task definition shape, validation, and serialization.\n\n### 2. Agent-Platform Unit Tests\n\n**Effect resolution tests** (`packages/genty/platform/src/harness/internal/createRun/orchestration/__tests__/externalAgentEffect.test.ts`):\n- External agent effect routes to adapterBridge\n- Returns error when adapters not available and `fallbackType` is not set\n- Falls back to internal when adapters not available and `fallbackType: \"internal\"` is set\n- Adapter not installed → clear error message with install hint\n- Adapter not authenticated → clear error message\n- Agent timeout → error with partial output\n- Cost events journaled on successful dispatch\n- Result value is the agent's text output\n\n**CLI orchestration tests** (`packages/genty/platform/src/harness/internal/createRun/orchestration/__tests__/index.test.ts`):\n- `resolveAndPostEffect` routes external agent tasks correctly\n- adapters CLI fallback when module not importable\n- Timeout handling for slow external agents\n\n**Validation tests** (`packages/genty/platform/src/harness/internal/createRun/planProcess/__tests__/validation.test.ts`):\n- Processes with external agent tasks pass validation\n- Warning (not error) when adapters not detected but process uses external tasks\n- Conformance repair includes external agent task format\n\n**Prompt tests** (`packages/genty/platform/src/harness/internal/createRun/planProcess/__tests__/phase.test.ts`):\n- External agents section included in prompt when discovery returns agents\n- External agents section absent when discovery returns empty\n- Raw text session template includes external agent instructions\n\n### 3. Integration Tests\n\n**E2E with mock adapters** (`packages/genty/platform/src/harness/__tests__/e2e-external-agent.test.ts`):\n- Process defines external agent task → dispatches → mock agent returns → process completes\n- Process with `fallbackType: \"internal\"` → mock adapters unavailable → falls back to agent-core\n- Cost tracking flows through journal\n\n**Live-stack addition** (`.github/workflows/live-stack.yml`):\n- Add genty scenario with external agent dispatch (genty calls claude-code for a subtask)\n- Requires both genty and claude-code to be available in CI\n- Validates journal has COST event from external dispatch\n\n### 4. Process Library Tests\n\n**Process template tests** (`library/__tests__/`):\n- Processes using external agent tasks validate correctly\n- Process conformance repair handles external agent format\n\n## Test Fixtures\n\n### Mock adapters adapter registry\n```typescript\nconst mockRegistry = {\n list: () => [\n { name: \"claude\", displayName: \"Claude Code\", installed: true, authenticated: true },\n { name: \"codex\", displayName: \"Codex\", installed: true, authenticated: false },\n ],\n installed: () => [\"claude\"],\n};\n```\n\n### Mock adapters client\n```typescript\nconst mockAmuxClient = {\n run: (options) => ({\n events: (async function*() {\n yield { type: \"text_delta\", text: \"Mock response\" };\n yield { type: \"done\", cost: 0.01 };\n })(),\n result: Promise.resolve({ success: true, output: \"Mock response\" }),\n }),\n};\n```\n\n## CI Configuration\n\n- Unit tests: run on every PR (no external dependencies needed)\n- Integration tests: run with `LIVE_STACK_EXTERNAL_AGENT=1` env var\n- Live-stack: add external agent scenario to dispatch matrix when both genty and claude-code are available\n\n## Coverage Targets\n\n| Area | Target |\n|------|--------|\n| SDK discovery | 90% — all paths including fallback and timeout |\n| Task types | 100% — type safety is critical |\n| Effect resolution | 85% — mock adapterBridge, cover error paths |\n| Validation | 80% — cover external task acceptance |\n| E2E | 1 happy path + 1 fallback path |\n",
"documents": []
},
"outgoingEdges": [],
"incomingEdges": [
{
"from": "page:docs-adapters-babysitter-integrations",
"to": "page:docs-adapters-babysitter-integrations-testing",
"kind": "contains_page"
}
]
}