feat(middleware): implement LIVE=1 smoke test for Claude CLI runtime#35
Merged
alexey-pelykh merged 1 commit intomainfrom Feb 26, 2026
Merged
Conversation
…34) Add a two-case live smoke test gated behind LIVE=1 that validates the full middleware pipeline: message → ChannelBridge → ClaudeCliRuntime → claude -p → NDJSON streaming → AgentDeliveryResult. - Single-turn "2+2" response with assertions on payloads, text, sessionId, aborted flag, and durationMs - Session resumption verifying the same sessionId is reused Also fix CLIRuntimeBase to support configurable NDJSON stream selection: Claude CLI emits stream-json output on stderr (not stdout), so add a protected ndjsonStream getter overridden in ClaudeCliRuntime. Co-Authored-By: Claude Opus 4.6 <[email protected]>
7d6025f to
831f5da
Compare
This was referenced Feb 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
claude -p --output-format stream-json→ NDJSON streaming → AgentDeliveryResultLIVE=1environment variable so CI skips it by defaultCLAUDECODE,CLAUDE_CODE_ENTRYPOINT,CLAUDE_CODE_MAX_OUTPUT_TOKENS) inbeforeAllto prevent nesting rejectionBug fix: Claude CLI NDJSON stream source
During smoke test development, discovered that
claude -p --output-format stream-jsonemits NDJSON to stderr, not stdout. Added a configurablendjsonStreamgetter toCLIRuntimeBase(defaults to"stdout") and overrode to"stderr"inClaudeCliRuntime. The non-NDJSON stream is captured as diagnostics.Closes #34
Test plan
pnpm checkpasses (format + typecheck + lint)pnpm vitest run src/middleware/— all 367 unit tests passpnpm vitest run --config vitest.live.config.tsfinds the test and skips it withoutLIVE=1LIVE=1 pnpm vitest run --config vitest.live.config.ts src/middleware/__smoke__/claude.live.test.tsruns both tests with a real Claude CLI (must be run from a normal terminal, not from within Claude Code due to nesting restrictions)🤖 Generated with Claude Code