Repository navigation
Fix: render TUI chat events for canonical session-key aliases - #36100
Octane0411 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3412453e0e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
|
||
| const isSessionMatch = (sessionKey: string) => { | ||
| const current = state.currentSessionKey.trim().toLowerCase(); | ||
| const incoming = sessionKey.trim().toLowerCase(); |
There was a problem hiding this comment.
Guard chat sessionKey type before canonicalizing
handleChatEvent is fed raw evt.payload from the websocket path (src/tui/tui.ts), so malformed chat payloads can still reach this code at runtime even though ChatEvent is typed. The new matcher unconditionally does sessionKey.trim(), which throws when sessionKey is missing or non-string (for example, an unexpected event shape from an older/misbehaving gateway), and that exception stops chat event handling instead of safely ignoring the bad payload as before. Add a runtime typeof sessionKey === "string" check before calling isSessionMatch (or inside it).
Useful? React with 👍 / 👎.
Greptile SummaryThis PR successfully fixes the TUI rendering regression where chat events with legacy session key aliases (e.g., What works well:
Key change: Confidence Score: 4/5
Last reviewed commit: 3412453 |
Summary
Security Impact
Repro+Verification
Testing
pnpm test src/tui/tui-event-handlers.test.tsAI Assisted
Fixes