Skip to content

feat(server): add explicit Native daemon and durable recovery - #274

Draft
wangtsiao wants to merge 2 commits into
7df-lab:mainfrom
wangtsiao:feat/native-background-daemon
Draft

wangtsiao wants to merge 2 commits into
7df-lab:mainfrom
wangtsiao:feat/native-background-daemon

Conversation

@wangtsiao

@wangtsiao wangtsiao commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add an opt-in Unix process owner for the existing Native runtime, independent of Desktop/TUI lifetime:

  • devo daemon start|run|status|stop|attach, authenticated readiness, explicit ownership, attach-only failure when absent, and SIGTERM/SIGINT teardown.
  • Use only the authenticated internal loopback listener. Ignore public listener configuration for daemon mode. Protect metadata with atomic owner-only writes, no-follow checks, and numeric-loopback validation.
  • Refuse the legacy server/shutdown wire method in the daemon itself, including from older Desktop bundles. Explicit stop uses daemon/shutdown and waits for owner-lock release.
  • Stop new admissions and drain admitted RPCs, including requests whose client already disconnected and listener-error paths. Reserve control capacity when all 16 data-client slots are occupied.
  • Rebuild the journal index before starting scheduling. Strictly check durable journals before retiring missing-session work; uncertain/corrupt journal recovery preserves the job/outbox for retry.
  • Preserve interval phase, coalesce missed slots, and bound pending outbox delivery to one occurrence per job.

This is independent of #269. It does not change Desktop queue UI or subagent execution semantics.

Validation

Passed on Linux:

  • Singleton/file protection/probe/endpoint tests: 10.
  • Schedule/outbox/recovery tests: 28.
  • Transport tests: 20.
  • Gated real-RPC test: stop waits for an admitted request after its client disconnects.
  • CLI process tests: 4, covering concurrent detached start, attach/disconnect, full client capacity, old shutdown wire rejection, crash + empty DB + actual journal admission + restart reconciliation, and SIGTERM.
  • Concurrent detached start repeated three additional times.
  • CLI command parser test.
  • cargo clippy --locked -p devo-server -p devo-cli --all-targets -- -D warnings.
  • Final process tests and targeted clippy rerun after strengthening the restart acknowledgement assertion.
  • cargo fmt --all --check and git diff --check.

Full server library run: 557 passed, 2 ignored, 3 failed. The failures are existing plain-folder/worktree expectations in unmodified code. This container exposes a synthetic /tmp/.git ancestor: the filesystem-only repository detector treats temporary directories as repositories while Git rejects them. Those local checks are not reported as passing. The full workspace Test job subsequently passed in CI on the exact PR head below.

Exact head b89bc44d9ab1e26380808d7a59cb114b6b7473c0 is green:

Boundaries

  • Unix only for daemon commands. Windows fails closed pending owner-only ACL support.
  • No service installation, automatic restart, login startup, upgrade handover, or 24/7 availability claim.
  • Desktop RRULE automations remain Electron-owned. Migration to one Native scheduler is separate work.
  • Existing same-user processes and agent tools can access DEVO_HOME. The control token is not a sandbox or approval boundary against hostile same-user tools.
  • Durable admission/deduplication does not provide exactly-once external tool side effects. No approval presets or unattended privileges are changed.

Design, Prime source comparison, operating limits, and follow-up work: docs/native-background-daemon.md.

Draft for review; do not merge automatically.

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