-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: Multi tab support! #5370
Feat: Multi tab support! #5370
Conversation
#elif event.source == EventSource.USER and isinstance( | ||
# event, CmdOutputObservation | ||
#): | ||
elif event.source == EventSource.USER: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please tell, why was this necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there are multiple tabs / users attached to a session, then we need to make sure that each of the tabs gets input from one user as output - otherwise they only see responses rather than the prompts that generated them - so we now echo all events where the source is USER
rather than just CmdOutputObservation
instances.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may need to double check that this works as expected in all cases, for example, the lines below:
- exclude ipython obs
- send error obs as AGENT
I know I meant most obs to be ENV source rather than USER, so if they're ENV and nothing unwanted is USER, these should work fine (tm), but it's worth a quick check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean, you're saying that this change should only refer to actual "user messages", that is, from a person. The change does all events with source USER though, which may be more than that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh this logic has gotten pretty messy. We're doing a lot of monkeypatch-y things with the events we send down.
IMO the logic should just be self.send(event_to_dict(event))
in all cases, except maybe for a few little exceptions. (e.g. we had an exception here for user messages before, because those were being handled on the FE)
To Engel's point we should probably make sure that commands sent from the FE don't appear double
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or that the error observation is on "agent" side of the chatbox, not the "user" side. 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tofarr just make sure that user interactions w/ the terminal behave as expected, and we can merge this. Would love to simplify this logic a bit in the future
@@ -56,6 +56,7 @@ describe("Empty state", () => { | |||
content: "Hello", | |||
imageUrls: [], | |||
timestamp: new Date().toISOString(), | |||
secondaryId: crypto.randomUUID(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of doing this, can we just show the message when it comes back to us on the websocket?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated the PR with this change - we now have a pending
flag (On the client only), and when a message from the server is received, any pending
message on the client is removed.
O Nice, this is the exact kind of experience we needed. In fact, we expect to have multiple browser from different computers connected to the same sock-io session underneath. |
Co-authored-by: Robert Brennan <accounts@rbren.io>
Multiple tabs can now connect to the same session
This is not a big functional change right now, but paves the way for future changes where we could potentially have a share session url / multiple users connect to the same session.
To run this PR locally, use the following command: