Skip to content

Add reusable test fixtures for E2E testing with real AI SDK pipeline #20206

Closed as not planned

Description

@rmk40

Problem

Several tests need to exercise the real AI SDK streamText pipeline (not TestLLM mocks) against a fake HTTP server. Currently, llm.test.ts has its own inline fake server and SSE helpers, and any new test that needs the same infrastructure has to duplicate ~200 lines of boilerplate.

There is also no shared layer stack for tests that need the full SessionPrompt pipeline (tool registration via ToolRegistry, resolveTools, processor event handling) with a real LLM layer.

Proposal

Add two reusable test fixtures:

  1. test/fixture/anthropic.ts — Fake Anthropic HTTP server (Bun.serve({port:0})) with lifecycle management (start/stop/reset) and SSE response helpers (toolResponse, textResponse, sse, waitRequest, deferred).

  2. test/fixture/prompt-layers.ts — Full SessionPrompt Effect layer stack with real LLM.defaultLayer and no-op stubs for MCP/LSP/FileTime. Exports a single env layer that testEffect(env) can consume.

These fixtures unblock E2E tests for tool execution, metadata propagation, permission handling, and any other scenario that needs the complete prompt pipeline without mocking the LLM.

Context

Needed for the regression test in #20184 and reusable for future E2E tests.

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 31, 2026
  2. github-actions commented on Mar 31, 2026

    @github-actions
    Contributor

    This issue doesn't fully meet our contributing guidelines.

    What needs to be fixed:

    • No issue template was used. This appears to be a feature request, but it does not use the Feature Request template (title must start with [FEATURE]: and must include the required verification checkbox confirming the feature doesn't already exist)

    Please edit this issue to address the above within 2 hours, or it will be automatically closed.

    If you believe this was flagged incorrectly, please let a maintainer know.

  3. added a commit that references this issue on Mar 31, 2026
    6d82489
  4. github-actions commented on Mar 31, 2026

    @github-actions
    Contributor

    This issue has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

    Feel free to open a new issue that follows our issue templates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions