Skip to content

Store a chat message with its edges or not at all - #4243

Merged
mstomar125 merged 2 commits into
mainfrom
issue-4239-chat-edges
Nov 5, 2026
Merged

mstomar125 merged 2 commits into
mainfrom
issue-4239-chat-edges

Conversation

@mstomar125

@mstomar125 mstomar125 commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Closes #4239

What changed

  • append_message (daemon chat_messages.rs) no longer falls back to create_node_with_parent when create_node_with_relationships fails. The transaction's error is returned, so the message and its wrote / resolved / pending-delete edges are stored together or not at all. A skipped edge to a node that no longer exists still stores the message, as before.
  • Caller handling: append_assistant_message now returns AppendFailure::NotStored (the reply was not stored) or AppendFailure::StatusNotWritten (the reply is stored, the idle status is not). Only NotStored posts a notice in the chat ("This turn's reply could not be saved. Changes it made may already have been applied, so check before repeating them."), with no edges and no outcome. StatusNotWritten posts nothing and just resets idle. The database error stays in the log. The same handling now covers the delete-confirmation reply, which previously only reset idle.

Tests

  • a_message_whose_edges_cannot_be_written_is_not_stored (store level; a trigger refuses the edge).
  • a_turn_whose_reply_cannot_be_stored_says_so_in_the_chat (full turn with a stub engine; the notice is the only assistant message, no database detail, idle).
  • a_status_write_failure_after_a_stored_reply_posts_no_notice (turn level and direct call returns StatusNotWritten).
  • a_delete_confirmation_whose_reply_cannot_be_stored_says_so_in_the_chat.
  • Mutation checks: fallback restored, status failure posting the notice, deletion arm silent, turn arm silent: each makes the matching test fail; all reverted.
  • Ran: fmt, clippy (-D warnings -D clippy::unused-async) on nodespace-daemon, local_agent_service tests (116), chat_messages (8), bound_chat (17); pre-push gate.

🤖 Generated with Claude Code

mstomar125 and others added 2 commits November 5, 2026 11:42
append_message no longer falls back to storing the message without its
edges when the transactional create fails: the error is returned and
nothing is written. When a turn's reply cannot be stored, the turn now
posts a visible error message in the chat instead of ending silently.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
append_assistant_message now says which part failed: the reply not being
stored, or the idle status not being written after a stored reply. Only the
first posts a notice. The delete-confirmation reply gets the same notice.
The notice no longer carries the database error (kept in the log) and says
the turn's changes may already have been applied.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@mstomar125
mstomar125 force-pushed the issue-4239-chat-edges branch from c5244c5 to 8377aea Compare November 5, 2026 10:42
@mstomar125
mstomar125 merged commit 98cf85e into main Nov 5, 2026
@mstomar125
mstomar125 deleted the issue-4239-chat-edges branch November 5, 2026 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Store a chat message with its edges or not at all: remove the fallback that stores it without them

1 participant