-
Notifications
You must be signed in to change notification settings - Fork 0
feat(transport): transport SSOT phase 0 foundation #431
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,13 +17,14 @@ import { eventBus } from './lib/event-bus-singleton'; | |
| import { getPreferredModel } from './lib/model-preference'; | ||
|
|
||
| /** | ||
| * Transport selector — set localStorage 'mitzo:transport' to 'sse' to use | ||
| * SSE + HTTP POST instead of WebSocket. Default is 'ws'. | ||
| * Transport selector — SSE + HTTP POST is the default transport (Transport SSOT P0). | ||
| * This is an intentional flip from WS-default per the transport-ssot design doc. | ||
| * Set localStorage 'mitzo:transport' to 'ws' to fall back to WebSocket. | ||
| * | ||
| * Toggle from console: localStorage.setItem('mitzo:transport', 'sse'); location.reload(); | ||
| * Revert: localStorage.removeItem('mitzo:transport'); location.reload(); | ||
| * Force WS: localStorage.setItem('mitzo:transport', 'ws'); location.reload(); | ||
| * Revert SSE: localStorage.removeItem('mitzo:transport'); location.reload(); | ||
| */ | ||
| const useSSE = typeof window !== 'undefined' && localStorage.getItem('mitzo:transport') === 'sse'; | ||
| const useSSE = typeof window !== 'undefined' && localStorage.getItem('mitzo:transport') !== 'ws'; | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 regressions: Flipping the default transport from WS to SSE is a behavioral change that affects all clients on upgrade. Users with |
||
|
|
||
| const sseConfig: SseConnectionConfig | undefined = useSSE | ||
| ? { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -292,6 +292,15 @@ export function parseServerMessage( | |
| callbacks.onSessionRenamed?.(msg.name as string); | ||
| break; | ||
|
|
||
| case 'session_state_changed': | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔵 style: The session_state_changed case is a silent no-op with a comment referencing 'Phase 1'. Consider logging via console.debug or a callbacks hook so the event is observable during development, and to validate the message is actually received.
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 missing_tests: The new
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔵 style: The |
||
| // P0: log for observability, no UI action yet (Phase 1 will bind to running state) | ||
| console.debug('[mitzo] session_state_changed', { | ||
| sessionId: msg.sessionId, | ||
| state: msg.state, | ||
| internalState: msg.internalState, | ||
| }); | ||
| break; | ||
|
|
||
| case 'message_start': | ||
| result.messagesActions.push({ | ||
| type: 'MESSAGE_START', | ||
|
|
||
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.
🟡 regressions: Changing the default transport from WS to SSE is a user-visible behavioral change. Any client with no
mitzo:transportlocalStorage key will silently switch from WebSocket to SSE on upgrade. If SSE has gaps (e.g., the parser only logssession_state_changedrather than acting on it), this could regress existing users. Ensure the SSE path has been validated end-to-end before merging, or gate behind a more explicit opt-in.