Skip to content

Streaming passthrough: per-turn latency causes agent timeouts on long coding tasks #92

Description

@veerareddyvishal144

Evidence

Terminal-bench A/B (22 tasks, same model gpt-5.6-sol, same pi agent):

Leg Passed Notes
Direct to Azure 17/22 (77%) $6.77
Through Lynkr 8/21 (38%) 5× AgentTimeoutError, ~3× token burn from slow retried episodes

Direct strictly dominated (no task passed via Lynkr that failed direct). By contrast, ITSMBench (shorter turns) shows through-Lynkr statistically equal to direct after #91 — so the remaining gap is latency-bound, not correctness-bound.

Cause

The Azure Responses path is called with stream: false: Lynkr buffers the full upstream completion (including long reasoning phases), converts formats (Responses → ChatCompletions → Anthropic → OpenAI), then synthesizes SSE to the client. On long compute-heavy tasks the added seconds-per-turn accumulate past agent harness timeouts (1500s in terminal-bench's case).

Proposed fix

True streaming passthrough for OpenAI-native clients on OpenAI-native upstreams: request stream: true upstream and transform events in flight (the SSE transformer already exists for the Anthropic direction), skipping the buffer-and-convert round trip. Preserve the empty-completion guard and cache-key behavior from #91.

Acceptance test

Re-run the 22-task terminal-bench A/B (harness + configs documented in #91): through-Lynkr pass rate within noise of direct, zero AgentTimeoutError attributable to proxy latency.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions