Skip to content

fix: ensure daemon is running#3384

Open
ellie wants to merge 2 commits intomainfrom
ellie/daemon-auto-start
Open

fix: ensure daemon is running#3384
ellie wants to merge 2 commits intomainfrom
ellie/daemon-auto-start

Conversation

@ellie
Copy link
Copy Markdown
Member

@ellie ellie commented Apr 7, 2026

Instead of only ensuring the daemon is running as part of writing history, route all calls through a function that ensures it's running if an error occurs.

This fixes the case where a system boots, no commands run, and the user tries to search history.

Checks

  • I am happy for maintainers to push small adjustments to this PR, to speed up the review cycle
  • I have checked that there are no existing pull requests for the same thing

Instead of only ensuring the daemon is running as part of writing
history, route all calls through a function that ensures it's running if
an error occurs.

This fixes the case where a system boots, no commands run, and the user
tries to search history.
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 7, 2026

Greptile Summary

Extracts ensure_daemon_running into a shared public function and routes all daemon-touching paths (search, history prune, store rebuild) through it, so the daemon is auto-started on first use rather than only on history writes. This fixes cold-boot search failures where no history had been recorded yet.

Confidence Score: 5/5

Safe to merge — no correctness or reliability issues found.

All changes are a focused, well-scoped refactor with no logic errors. The Unimplemented retry variant is intentional (handles legacy protocol mismatches). Event ownership through the retry path is correct.

No files require special attention.

Important Files Changed

Filename Overview
crates/atuin/src/command/client/daemon.rs Extracts ensure_daemon_running as a public function and adds emit_event with autostart retry; clean refactor.
crates/atuin/src/command/client/search/engines/daemon.rs Adds autostart retry on connection failure in full_query; clears stale client before retry.
crates/atuin/src/command/client/history.rs Migrates emit_event call to new daemon_cmd::emit_event that accepts settings.
crates/atuin/src/command/client/store/rebuild.rs Same emit_event migration as history.rs.

Reviews (1): Last reviewed commit: "fix: ensure daemon is running" | Re-trigger Greptile

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.

1 participant