[bug-001] Persist user messages - drop non-existent workflow column

↗ view on GitHub · Nick Whitehouse · 2026-05-03 · 1271d07c

User messages were never being persisted to chat_messages. The insert
referenced a `workflow` column that doesn't exist in the schema; Supabase
silently rejected the entire insert with PGRST204 ("Could not find the
'workflow' column of 'chat_messages' in the schema cache"), and the result
was unchecked. Affected both POST /chat and POST /projects/:id/chat.

Effect: chats reloaded from the DB only showed assistant rows. Live chats
appeared correct because the frontend keeps message history in memory.

Fix: drop the `workflow` field from the insert in both routes, and surface
any future insert errors via console.error so the next regression isn't
silent. Same defensive logging added to the assistant-message insert.

If per-message workflow attachment ever needs to survive a reload, add a
column in a follow-up migration.

Verified by direct insert against the prod schema:
  with workflow:    PGRST204 (silently swallowed today)
  without workflow: OK

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Repository nwhitehouse/mike
Author Nick Whitehouse <nick.whitehouse@mccarthyfinch.com>
Authored
Parents 6a4ea15e
Stats 2 files changed , +44 , -20
Part of Bug: user messages never persisted (workflow column doesn't exist)

Capture this commit into my fork

Download a Markdown prompt that tells Claude how to port this exact commit into your working tree. Run it via claude -p < capture-commit-1271d07c.md from inside the repo you want the change in.

⬇ Download capture-commit-1271d07c.md