ADR 0033: End-to-End Gateway Simulator Without Live Channels
Proposed
2 min read
This is a migrated reference document from the original Anvio source repo. Content is preserved as-is; canonical documentation lives in the sections above in the sidebar.
Original path: docs/adr/0033-end-to-end-gateway-simulator.md
Status
Proposed
Context
slaude ships bun run sim: the same createGateway used in production, wired to an in-memory transport, so engagement, approvals and replies can be verified with no Slack workspace. Its CI relies on it heavily (299 test files vs Anvio's 126 spec files).
Anvio has a narrower piece of this:
packages/harness/src/simulation/transport.ts(SimulationTransport,runSimulationScenario) andanvio harness simulatereplayInboundEnvelopes throughHarnessGateway.handleInbound.- That only exercises the inbound gate (
InboundGateResult). It does not run the agent turn, tool calls, approval prompts and their resolution, outbound formatting (formatForChannel), or session resume. - End-to-end checks today require real channel credentials or ad-hoc mocks per test.
Decision
Grow the existing simulator into a full-turn harness rather than adding a second one:
SimulatedChannelAdapterinpackages/channelsimplementing the normal adapter interface, recording outbound messages, edits, uploads and approval prompts in memory, and accepting scripted inbound events (messages, button clicks / approval responses).- Platform wiring.
createPlatform(\{ channels: 'simulated' \})registers only the simulated adapter, so the realChannelHub, harness, runtime and tool gateway run unchanged. - Deterministic model. A
scriptedmodel provider inpackages/modelsreturns canned responses and tool calls from the scenario file, so scenarios need no API key and are reproducible in CI. - Scenario format. YAML under
tests/simulation/*.scenario.yamlwithsteps(inbound event or approval response) andexpect(engagement state, outbound text after channel formatting, approval requested/resolved, tool executed).anvio harness simulate --scenario <file>runs one;tests/integrationruns all.
Consequences
- Engagement (ADR 0032), approvals and channel formatting become testable end-to-end at Level 1 with no credentials.
- The scripted model provider must stay out of production routing: it is registered only when the platform is created in simulation mode.
- Scenario files become a contract for harness behaviour; changing approval or engagement semantics requires updating them, which is intended.
- Live-channel quirks (rate limits, Slack
mrkdwnedge cases, webhook auth from ADR 0021) remain untested by the simulator and still need adapter-level unit tests.
Alternatives considered
- Mock each adapter per test. Rejected: that is the status quo and drifts from production wiring.
- Record/replay real Slack traffic. Rejected for now: needs credentials and leaks workspace data into fixtures.
Reconciliation note (2026-10-25)
Still Proposed. Implemented: SimulatedChannel (packages/channels/src/simulated-channel.ts), anvio harness simulate, and the E2E suite in tests/integration/e2e/. Acceptance is left to the owners. Original decision text above is unchanged.
Last updated on