fix(sessions): auto-update other clients when a session is renamed#2798
Open
anuj7511 wants to merge 1 commit into
Open
fix(sessions): auto-update other clients when a session is renamed#2798anuj7511 wants to merge 1 commit into
anuj7511 wants to merge 1 commit into
Conversation
Add migration 0024 so a rename fires the sessions_cdc_update trigger.
Collaborator
|
Thanks for contributing to Agent Orchestrator. This PR is being picked up by the current external contributor on-call pair: If someone is already working on this, please continue as usual. For faster context or live questions, you can also join the AO Discord. Join the session here: Come by if you want to see what is being built, ask questions, or just hang around with the community. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Renaming a session did not emit a live update on the CDC/SSE event stream.
RenameSessionupdates onlydisplay_name(+updated_at), but thesessions_cdc_updatetrigger'sWHENguard did not includedisplay_name,so the update wrote no
change_logrow — and therefore nosession_updatedevent ever reached
GET /api/v1/events.Root cause
The trigger (introduced in
0001, later extended by0017/0019) fires onlywhen one of the watched columns changes:
display_nameis not in that list. Migrations0017and0019added thepreview_*columns to this same trigger for exactly this fan-out reason;rename was left out.
Impact
The initiating desktop window happens to refetch on its own (the sidebar
invalidates its workspace query after a successful rename), which masks the
bug there. But any client relying on the CDC stream keeps showing the old
name until an unrelated event forces a refetch — e.g. a second desktop
window, the Connect Mobile client, or every connected client when the
rename comes from
ao session rename(which does no client-side invalidation).Fix
New migration
0024_session_rename_cdc.sqldrops and recreatessessions_cdc_updatewithOR OLD.display_name <> NEW.display_nameadded tothe guard and
displayNameadded to the JSON payload (mirroring howpreviewUrl/previewRevisionare carried).display_nameisNOT NULL, so aplain
<>comparison is complete. Per the repo's hard rule I added a newmigration rather than editing a merged one; the
Downreverts to the0019trigger.
Reproduction
GET /api/v1/events(e.g.
curl -N http://127.0.0.1:3001/api/v1/events).ao session rename <id> <name>.session_updatedframe is delivered with the new
displayName.