Skip to content

fix(container): emit SSE done event on stream end - #17

Merged
mariuspruvot merged 1 commit into
mainfrom
worktree-fix+sse-done-event
Apr 18, 2026
Merged

fix(container): emit SSE done event on stream end#17
mariuspruvot merged 1 commit into
mainfrom
worktree-fix+sse-done-event

Conversation

@mariuspruvot

Copy link
Copy Markdown
Owner

Summary

  • The SSE stream endpoint now emits an explicit event: done frame when the container exits (docker logs end)
  • Also calls mark_completed() to transition the session to COMPLETED in the DB
  • Previously the frontend had no reliable signal that the session was over -- with the per-turn entrypoint loop (PR fix(container): multi-turn FIFO persistence #16), the container stays alive between turns, so the SSE connection no longer closes after the first response

Changes

File What
apps/api/src/helprs/modules/container/router.py _event_stream() yields event: done + calls mark_completed() after stream ends
apps/api/tests/modules/container/test_router.py 2 new tests: done event emitted + session marked COMPLETED. Also fixed FakeDockerClientForRouter (newline-terminated logs, write_to_container), registered set_session_factory in fixture

Test plan

  • 7/7 router tests pass (including 2 new)
  • 227/230 full suite pass (3 pre-existing failures unrelated)
  • Ruff clean
  • Manual e2e: verify frontend receives done event and shows "Session completed"

The SSE stream endpoint now yields an `event: done` frame after docker
logs end, and marks the session COMPLETED in the DB via mark_completed().
Previously the frontend relied on the SSE connection closing (which no
longer happens between turns with the per-turn entrypoint loop).
@helprs-local-mariuspruvot

Copy link
Copy Markdown

helPRs session created for this PR.

Skill: challenge-me | Open session

@mariuspruvot
mariuspruvot merged commit 46e0c1e into main Apr 18, 2026
8 of 10 checks passed
@mariuspruvot
mariuspruvot deleted the worktree-fix+sse-done-event branch April 18, 2026 21:54
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.

1 participant