Skip to content

Conversation

@ryantm
Copy link
Contributor

@ryantm ryantm commented Oct 22, 2025

Why

  • We have a problem with the connection between agent and container sometimes hanging.
  • When I run our agent tests with debugging levels to the max it does not seem to trigger over many runs.
  • I passed this hypothesis of messages not flushing to Claude and it suggested using this buffered message sender we already have.
  • Note, since I haven't reproduced the original hanging problem locally, I cannot confirm that this fix fixes that. Right now our best way to confirm that is to ship this change to CI and see if the hangs stop.

What changed

  • Use the buffered message sender from river v2 in v1

Test plan

  • Tests still pass locally.
  • I tried connecting this version of the package to my local agent setup and it works fine

@ryantm ryantm requested a review from a team as a code owner October 22, 2025 23:28
@ryantm ryantm requested review from Monkatraz and removed request for a team October 22, 2025 23:28
@macroscopeapp
Copy link

macroscopeapp bot commented Oct 22, 2025

Route all replit_river.session.Session outbound messages through the v2 buffered_message_sender background task to replace immediate sends in v1

This change starts a background buffered sender in Session and removes immediate send paths, routing all enqueued messages through the v2 sender.

  • Start Session._start_buffered_message_sender to schedule buffered_message_sender with session-specific callbacks in session.py
  • Remove direct send logic from Session.send and Session.replace_with_new_websocket, relying on the background task in session.py
  • Drop imports and exception handling tied to immediate send paths in session.py

📍Where to Start

Start with the Session._start_buffered_message_sender helper in session.py, then review its callbacks and how Session.send now only enqueues into the buffer.


Macroscope summarized 701e02b.

Why
===
* We have a problem with the connection between agent and container
somtimes hanging.
* When I run our agent tests with debugging levels to the max it does
not seem to trigger over many runs.
* I passed this hypothesis of messages not flushing to Claude and it
suggested using this buffered message sender we already have.

What changed
===
* Use the buffered message sender from river v2 in v1

Test plan
===
* Tests still pass locally.
* I tried connecting this version of the package to my local agent
setup and it works fine
@ryantm ryantm force-pushed the rtm1022messagebuffer branch from 7bcdffc to 701e02b Compare October 22, 2025 23:30
@ryantm
Copy link
Contributor Author

ryantm commented Oct 23, 2025

This did not fix the problem after testing in CI.

@ryantm ryantm closed this Oct 23, 2025
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