Skip to content

Implement LIVE=1 smoke test for OpenCode CLI runtime #38

@alexey-pelykh

Description

@alexey-pelykh

Summary

End-to-end smoke test validating the full pipeline with a real OpenCode CLI: message → ChannelBridge → OpenCodeCliRuntime → opencode CLI → NDJSON streaming → AgentDeliveryResult. Gated behind LIVE=1 environment variable. Mirrors the Claude smoke test (#34, PR #35).

Context

The Claude smoke test (PR #35) established the pattern: ChannelBridge → CLI runtime → real subprocess → assertion on result. This test applies the same pattern to OpenCode, additionally exercising OpenCodeMcpConfigManager's setup/teardown lifecycle (opencode.json merge-restore).

CLIs are pre-authenticated on the developer machine — no API key env var checks needed.

Acceptance Criteria

Given the middleware is implemented and ChannelBridge works (PR #33)
When a LIVE=1 smoke test is executed with a pre-authenticated opencode CLI
Then a test message is sent through ChannelBridge → OpenCodeCliRuntime
And a coherent text response is received via NDJSON streaming
And the session ID is captured and a follow-up message resumes the session
And the test is skippable in CI (gated behind LIVE=1 environment variable)

Architecture

File

src/middleware/__smoke__/opencode.live.test.ts

Pattern

Same as claude.live.test.ts (PR #35):

  • describe.skipIf(!LIVE) guard
  • beforeAll: create temp dir, SessionMap, ChannelBridge with provider: "opencode"
  • Test 1: single-turn response (assert payloads, text, sessionId, aborted=false)
  • Test 2: session resumption (same channel/user → same sessionId)
  • afterAll: cleanup temp dir
  • 60s timeout per test

OpenCode-Specific

  • No CLAUDECODE env var unset needed (only Claude has this concern)
  • OpenCode uses OpenCodeMcpConfigManager for opencode.json merge-restore — this is exercised implicitly when MCP config is provided

Related

Dependencies

Estimate

~80 LoC (reuses pattern from claude.live.test.ts)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions