Skip to content

fix(channels): stop dispatch when journal write fails - #7040

Merged
houko merged 3 commits into
mainfrom
fix/message-journal-record-errors
Aug 13, 2026
Merged

houko merged 3 commits into
mainfrom
fix/message-journal-record-errors

Conversation

@houko

@houko houko commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • make initial message-journal recording report whether the WAL entry became durable
  • abort text and multimodal dispatch when the write-ahead record cannot be persisted
  • send a retryable user-facing response instead of processing an unrecoverable message
  • add a regression test proving failed writes do not enter the in-memory recovery index

Tests

  • CARGO_TARGET_DIR=/tmp/librefang-sidecar-delete/target cargo test -p librefang-channels record_reports_failure_and_does_not_index_unpersisted_entry --lib
  • CARGO_TARGET_DIR=/tmp/librefang-sidecar-delete/target cargo test -p librefang-channels message_journal::tests --lib
  • CARGO_TARGET_DIR=/tmp/librefang-sidecar-delete/target cargo clippy -p librefang-channels --all-targets -- -D warnings
  • cargo fmt --all -- --check
  • git diff --check

Out of scope

  • terminal outcome updates and periodic compaction retain their existing best-effort logging behavior

Evan and others added 2 commits August 13, 2026 07:25
Reflow the record() doc comment to one sentence per line per the project's prose-wrapping rule; content is unchanged.

@houko houko left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No changelog.d/ fragment was added for this behavior change (dispatch now aborts when the journal write fails, instead of proceeding on an unrecoverable write). Sibling same-day PRs in this batch (#7036, #7038, #7039) each include one under changelog.d/fixed/ or changelog.d/changed/. Worth adding changelog.d/fixed/7040-message-journal-record-errors.md per the format in changelog.d/README.md, or confirming it's intentionally omitted.


Generated by Claude Code

@houko houko left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated daily review pass: found the PR missing its changelog.d fragment (fixed directly, see db1c74b) and one moderate-confidence test-coverage gap left as an inline comment. Everything else (commit messages, prose wrapping, lock/deadlock safety, error-handling idiom consistency) checked out.


Generated by Claude Code

next_retry_after: None,
};
j.record(entry).await;
if !j.record(entry).await {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The record() return-value contract is well covered at the MessageJournal level (record_reports_failure_and_does_not_index_unpersisted_entry in message_journal.rs), but neither dispatch_message nor dispatch_with_blocks has a test that exercises this abort path directly — i.e. that a failing record() actually short-circuits before the typing indicator / lifecycle reactions / router dispatch, and that the user-facing retry message goes out.

There's no existing ChannelAdapter mock in this test module (only MockHandle for ChannelBridgeHandle), so adding one is nontrivial — flagging rather than fixing directly. Worth a small mock adapter + a MessageJournal::open() pointed at a pre-created directory (same trick as the message_journal.rs test) to assert the router/agent is never invoked when the journal write fails, for both call sites.


Generated by Claude Code

houko commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

Correction from this automated review pass: two commits it pushed here (88efe0e, db1c74b) are themselves authored as Claude <noreply@anthropic.com>, which is the exact no-AI-attribution violation CLAUDE.md's commit-msg hook targets. This happened because the review environment's global git identity was misconfigured (not something the review logic checked for on its own commits before pushing). A maintainer should reauthor/squash those commits before merge.


Generated by Claude Code

@github-actions github-actions Bot added area/channels Messaging channel adapters size/M 50-249 lines changed labels Aug 13, 2026
@houko
houko merged commit 94219a0 into main Aug 13, 2026
36 checks passed
@houko
houko deleted the fix/message-journal-record-errors branch August 13, 2026 04:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/channels Messaging channel adapters size/M 50-249 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants