Skip to content

fix(embedded): recover from daemon crashes transparently#1193

Merged
nicoloboschi merged 1 commit into
mainfrom
fix/embedded-daemon-crash-recovery
Apr 22, 2026
Merged

fix(embedded): recover from daemon crashes transparently#1193
nicoloboschi merged 1 commit into
mainfrom
fix/embedded-daemon-crash-recovery

Conversation

@nicoloboschi

Copy link
Copy Markdown
Collaborator

Summary

  • HindsightEmbedded._ensure_started() had a sticky short-circuit: once _started=True, it never checked daemon liveness. If the daemon crashed, all subsequent calls failed with connection refused.
  • Now calls manager.is_running() (HTTP GET /health) on each invocation and transparently restarts the daemon when it's unresponsive.
  • Simplifies __getattr__ by removing the redundant wrapper closure that doubled the health-check overhead.

Test plan

  • New test_embedded_daemon_crash_recovery — starts client, stops daemon to simulate crash, verifies next operation restarts it
  • Run full hindsight-all embedded test suite for regressions: cd hindsight-all && uv run pytest tests/test_embedded.py -v

_ensure_started() had a sticky short-circuit: once _started=True it
never verified the daemon was still alive. If the daemon crashed, all
subsequent calls failed with connection refused.

Now _ensure_started() calls manager.is_running() (HTTP health check)
each time and transparently restarts the daemon if it's unresponsive.
Also simplifies __getattr__ by removing the redundant wrapper closure.
@nicoloboschi
nicoloboschi merged commit 59f9a2b into main Apr 22, 2026
44 checks passed
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