Skip to content

fix(streaming): don't throw after content delivered when [DONE] missing (Muse Spark) - #187

Merged
ltmoerdani merged 3 commits into
ltmoerdani:mainfrom
Barragek0:patch-2
Aug 22, 2026
Merged

fix(streaming): don't throw after content delivered when [DONE] missing (Muse Spark)#187
ltmoerdani merged 3 commits into
ltmoerdani:mainfrom
Barragek0:patch-2

Conversation

@Barragek0

@Barragek0 Barragek0 commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

📝 What does this change?

Muse Spark on the Responses API delivers content successfully but closes the connection without sending data: [DONE] or finish_reason. The truncated-stream detector from #178 was throwing an error after content was already delivered to VS Code, creating a confusing error popup on an otherwise complete response.

When the engine detects a stream without [DONE]/finish_reason but extractedPartCount > 0, it now logs a [warn] line and returns successfully instead of throwing. The user received their content — the missing termination signals are a gateway quirk, not a failure.

Files changed

File Change
src/transports/engine.ts Added extractedPartCount > 0 branch in truncation check: log warning + emit summary + return (instead of throwing)
docs/issues/79-20260822-issue-muse-spark-stream-completion.md Full issue documentation
CHANGELOG.md Added fix entry under [Unreleased]

🧪 How did you test it?

Tested with muse-spark-1.2-contributor-free, now works as intended.

✅ Checklist

  • npm run compile passes
  • npm run lint passes
  • npm test passes
  • npm run package produces a VSIX
  • I tested it works
  • I updated docs/CHANGELOG if needed

@ltmoerdani
ltmoerdani merged commit b2f1084 into ltmoerdani:main Aug 22, 2026
2 checks passed
@Barragek0
Barragek0 deleted the patch-2 branch August 22, 2026 21:54
ltmoerdani added a commit that referenced this pull request Aug 23, 2026
Fahad090NP added a commit to Fahad090NP/opencode-copilot-chat that referenced this pull request Aug 24, 2026
…arguments (ltmoerdani#184)

ltmoerdani#187 made content-delivered streams without [DONE]/finish_reason return
successfully (Muse Spark). But for tool-calling streams that means a stream
cut mid-arguments flushes a tool call whose truncated JSON silently becomes
{} input via parseToolInput — the tool executes with corrupted input.

- ToolCallAccumulator.hasCompletePendingCalls(): every named pending call
  must carry non-empty, parseable JSON-object arguments
- OpenAiResponseExtractor.hasCompletePendingToolCalls() exposes it
- engine: hasCompletePendingWork option — when it returns false on an
  unterminated stream, throw the truncation error instead of returning
  success (responses adapter wired; other transports unaffected)
- 5 new unit tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants