Fix a "Response failed" crash for plugin CLI runtime chats (grok/droid/cursor) whose sessions expose top-level `messages` and stream via `onText` without a pi-shaped `session.state`.
- Read messages/errorMessage null-safely from `session.state`, falling back to top-level `session.messages` when state is absent, in both the room responder and streaming response extraction paths
- Keep `state.errorMessage` optional so successful streams from state-less sessions no longer throw TypeErrors, while pi/openclaw/hermes provider errors still surface correctly
- Add regression tests covering state-less plugin CLI sessions in chat-manager.test.ts
- Add changeset for the fix
Files changed:
.changeset/fn-7765-grok-cli-chat-crash.md | 7 ++
packages/dashboard/src/__tests__/chat-manager.test.ts | 90 ++++++++++++++++++++++
packages/dashboard/src/chat.ts | 35 ++++++---
3 files changed, 121 insertions(+), 11 deletions(-)
Fusion-Task-Id: FN-7765
Fusion-Task-Lineage: 80e33a97-e971-4aec-a4cf-29d97c5c5e62
Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>