You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Store a chat message with its edges or not at all: remove the fallback that stores it without them #4239
A chat message is stored together with the record of what its turn wrote, looked up and asked to delete. When that record cannot be written, the daemon stores the message without it and carries on. The decision is that a reply never exists without the record of its writes, because that record is what keeps the next turn from repeating them.
Problem Statement
In packages/daemon/src/services/chat_messages.rs, when create_node_with_relationships fails, the code logs a warning ("storing it without them, so the record of what its turn did is lost") and calls create_node_with_parent with the same params. The message then exists with no wrote, resolved-entity or delete edges. The next turn cannot see what the turn did and can repeat the writes. The decision (AI chats are core subtypes, and messages are nodes) states that the message and its edges are written in one transaction.
Proposed Solution
Remove the fallback: when the message cannot be stored with its edges, the store fails and the caller sees the error, so nothing is written.
A skipped edge whose target no longer exists stays as it is (the message is stored, and the edge is not recorded).
Documentation
None to change: the decision already states the intended behaviour. Update the node-types reference only if a type's rules change; this issue changes none.
Architecture Impact
Daemon only (chat_messages.rs). No wire type, schema or seed changes, so no shape record entry.
Acceptance Criteria
A message whose edges cannot be written is not stored, and the error reaches the caller
A skipped edge to a deleted node still stores the message
A test fails with the current fallback and passes without it
The caller of the store handles the error without losing the user's turn
Code passes bun run quality:fix; bun run test:changed passes
Technical Specifications
Reference Files
packages/daemon/src/services/chat_messages.rs - the fallback in the store function
Activity
mstomar125 commentedon Nov 5, 2026
Picking this up (sweep drain).