Skip to content

fix(open-interpreter): terminate disconnected stream workers - #2818

Open
tang-vu wants to merge 1 commit into
Osmantic:mainfrom
tang-vu:fix/open-interpreter-disconnect-workers
Open

fix(open-interpreter): terminate disconnected stream workers#2818
tang-vu wants to merge 1 commit into
Osmantic:mainfrom
tang-vu:fix/open-interpreter-disconnect-workers

Conversation

@tang-vu

@tang-vu tang-vu commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • terminate the Open Interpreter streaming subprocess when a client disconnects
  • escalate to kill() if the child ignores the bounded termination wait
  • close subprocess pipes and remove the temporary runner on every exit path
  • keep SSE payload framing stable while removing subprocess newlines

Why this matters

POST /chat/stream starts a Python worker for every stream. When a browser, proxy, or client disconnects after receiving a chunk, Starlette closes the generator, but the old implementation only removed the runner file and left the worker alive. Repeated disconnects could accumulate interpreter processes, CPU/memory use, and in-flight model work until the optional service became unhealthy.

Overlap check

Searched open and closed upstream PRs for open interpreter stream subprocess cleanup, open-interpreter, disconnect, and the changed production file extensions/library/services/open-interpreter/server.py. PR #403 hardened authentication and container execution but does not manage streaming child lifecycles. No open or closed PR covers disconnect cleanup.

Test plan

  • python -m pytest -q ods/extensions/library/services/open-interpreter/tests/test_server.py (3 passed)
  • python -m py_compile ods/extensions/library/services/open-interpreter/server.py

The regression tests exercise the stream generator boundary: closing after the first SSE event terminates the live worker and removes the runner; normal completion does not terminate an exited worker; an unresponsive worker is killed.

Generated with Codex.

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