internal/runtime/executor: MetaExecutor.ExecuteStream silently closes with err=nil on clean EOF before terminal response.completed/incomplete event
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
Research direction
Start in internal/runtime/executor/meta_executor_stream.go at ExecuteStream (lines 98, 253-255, 285-296), then compare the post-loop error path with meta_executor_execute.go:312. Reproduce with go test -v -race -count=1 -run TestRepro_MetaExecutorStreamSilentTruncationOnCleanEOF ./internal/runtime/executor. Done means a clean EOF with terminalDelivered == false emits a terminal StreamChunk error (BadGateway) and calls reporter.PublishFailure.
Written by the indexing model from the issue text.
Description
Is it a request payload issue?
- Yes, this is a request payload issue.
- No, it's another issue (
internal/runtime/executor).
Describe the bug
(*MetaExecutor).ExecuteStream (internal/runtime/executor/meta_executor_stream.go:98, 253-255, 285-296) tracks terminalDelivered (set to true only upon receiving response.completed or response.incomplete), but after the scanner.Scan() loop exits it only checks if errScan := scanner.Err(); errScan != nil.
When an upstream HTTP 200 SSE stream closes cleanly (io.EOF, scanner.Err() == nil) before delivering a terminal event, !terminalDelivered is never checked. No error chunk is emitted and reporter.PublishFailure is never called (unlike (*MetaExecutor).Execute at meta_executor_execute.go:312), causing truncated responses to complete as HTTP 200 with err == nil.
Environment & verification scope
- CLIProxyAPI revision:
origin/devat32842348(confirmed onv8.1.2) - OS / Go: Windows 11 amd64,
go1.27.4 - Component:
internal/runtime/executor/meta_executor_stream.go(ExecuteStream)
End-to-End Pipeline Trace (Verified on origin/dev 32842348)
(*MetaExecutor).ExecuteStream(meta_executor_stream.go:98, 253-255, 285-296) readsdata: {"type":"response.output_text.delta",...}and exitsscanner.Scan()on cleanio.EOF(scanner.Err() == nil) withterminalDelivered == false.- Post-loop cleanup skips emitting any error chunk when
scanner.Err() == nil, closingoutcleanly.
Minimal reproduction & Observed vs Expected
go test -v -race -count=1 -run TestRepro_MetaExecutorStreamSilentTruncationOnCleanEOF ./internal/runtime/executor
Observed output (origin/dev 32842348):
=== RUN TestRepro_MetaExecutorStreamSilentTruncationOnCleanEOF
repro_v812_exec_test.go:85: MetaExecutor.ExecuteStream closed with err=<nil> on clean EOF without terminal response.completed/incomplete
--- FAIL: TestRepro_MetaExecutorStreamSilentTruncationOnCleanEOF (0.00s)
| Check / Field | Observed (origin/dev 32842348) |
Expected |
|---|---|---|
Clean EOF with terminalDelivered == false |
out closes with Err == nil |
Emits terminal StreamChunk{Err: ...} and calls reporter.PublishFailure |
Suggested minimal fix
In (*MetaExecutor).ExecuteStream (meta_executor_stream.go:285-296), when scanner.Err() == nil && ctx.Err() == nil && !terminalDelivered, emit a terminal StreamChunk{Err: statusErr{code: http.StatusBadGateway, msg: "upstream stream closed before terminal event"}} and record failure.
What ran / Not run
- Ran: Hermetic
go test -v -race -count=1 -run TestRepro_MetaExecutorStreamSilentTruncationOnCleanEOF ./internal/runtime/executoragainstorigin/dev(32842348). - Not run: Live upstream Meta stream.
- Dominant language
- Go
- Stars
- 58.8k
- Forks
- 9k
- Avg merge
- 14h 20m
- Merged PRs (30d)
- 67
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from router-for-me/CLIProxyAPI
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
router-for-me/CLIProxyAPI#7976 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
router-for-me/CLIProxyAPI#7975 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
router-for-me/CLIProxyAPI#7974 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
router-for-me/CLIProxyAPI#7973 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
router-for-me/CLIProxyAPI#7972 ·
Maintainers usually reply within 1 day
All issues in router-for-me/CLIProxyAPI
Similar issues
-
A failed hydrate call can be dropped when the row's wait is ready tooPossibly taken @turbot-agent-fleet claimed this today. Openagent:ready
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
turbot/steampipe-plugin-sdk#1018 · 2 comments ·
Maintainers usually reply within 1 day
-
enhancement needs-review
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
uselagoon/lagoon-cli#501 · 1 reaction ·
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
Difficulty 1/5 Under an hour Newbie friendliness 62/100
slavakurilyak/awesome-ai-agents#1026 ·