release: explicitly close chat workflow writable (#607)

Merged
SW
5mo ago
+107-8

Summary

Releases #607 to main. Follow-up to #604 that closes the second half of the same bug: pre-#607 the chat-workflow's SSE response held its HTTP connection open until Vercel Workflow's runtime garbage-collected the run (~2 min observed), so the AI SDK chat hook stayed in `submitted` and the Stop button stayed visible.

Fix adds a closeChatStream "use step" invoked from runAgentWorkflow's finally alongside the existing clearChatActiveStream step, mirroring open-agents' Promise.all([clearActiveStream, sendFinish.then(closeStream)]) pattern.

Test plan

  • Unit tests โ€” 3154 โ†’ 3159 passing (+3 closeChatStream cases, +2 runAgentWorkflow cases)
  • Manual probe on PR #607's preview (results in this comment) โ€” curl exits in 503ms with full stream + [DONE] (was 2+ min). Post-stream probe shows isStreaming: false within 3s.
  • Confirm Send button reverts within ~1s in the open-agents UI

๐Ÿค– Generated with Claude Code


Summary by cubic

Explicitly closes the chat SSE writable at the end of the workflow so the HTTP connection ends promptly and the UI un-sticks. Fixes chats stuck in submitted with the Stop button visible for minutes.

  • Bug Fixes
    • Added closeChatStream "use step" to call writable.close() and swallow already-closed errors.
    • Updated runAgentWorkflow to run Promise.all([clearChatActiveStream, closeChatStream]) in finally for immediate, parallel cleanup.
    • Added unit tests for closeChatStream and success/error paths in runAgentWorkflow.