Skip to content

Add managed lifecycle and persistent daemon - #41

Draft
wolfiesch wants to merge 2 commits into
mainfrom
review/installer-daemon
Draft

Add managed lifecycle and persistent daemon#41
wolfiesch wants to merge 2 commits into
mainfrom
review/installer-daemon

Conversation

@wolfiesch

@wolfiesch wolfiesch commented Aug 31, 2026

Copy link
Copy Markdown
Owner

Why

Chrome owns the lifetime of a Native Messaging process, so service-worker suspension, extension reloads, and native-port churn currently tear down Core IPC, runtime state, and in-flight scheduling. The release lifecycle also needs exact managed update, rollback, uninstall, pruning, and crash recovery before the runtime can be treated as durable infrastructure.

What changed

  • installs a persistent per-user agenttab-host daemon plus a small reconnectable agenttab-native relay
  • scopes relay traffic and disconnect cleanup to monotonically increasing connection generations
  • packages, signs, and verifies both executables on every supported release target
  • adds schema-v2 hashed activation receipts with exact file, client-config, Windows registry, and daemon-service ownership
  • adds transactional install/update/rollback/uninstall/prune with durable intent/commit recovery and compare-and-swap restoration
  • serializes installers across processes with canonical state-directory locks and stable process identity
  • rejects symlink targets and unsupported hard-link filesystems before target mutation
  • writes and activates per-user launchd, systemd, or limited Scheduled Task definitions without elevation
  • restarts the restored service on rollback and disables it during managed uninstall
  • retains bounded on-demand daemon startup when the platform service manager is unavailable
  • expands agenttab doctor to distinguish installation, IPC, protocol, host, and extension failures

Review decisions

  • Persistent user daemon: avoids Core churn without a privileged system service or additional approval prompts.
  • Best-effort service activation: a missing or unavailable service manager does not block install or recovery; the native relay remains the fallback.
  • Exact ownership, not broad cleanup: rollback and uninstall restore only resources proven by receipts and preserve later user edits.
  • One-way durable commit boundary: recovery rolls back only before the commit marker; committed transactions are never heuristically reversed.
  • Windows guarantee: process-crash atomicity is covered. Sudden power-loss namespace durability is explicitly not claimed because portable Node does not expose the required Windows directory barrier.
  • Unsupported filesystems: hard-link capability is preflighted before mutation; unsupported exFAT/SMB-style environments fail early rather than weakening recovery.

Validation

Exact-head CI run #175 passed:

  • macOS architecture/runtime gates, including Rust format, test, and release build
  • Linux IPC primitives and complete Rust runtime-core tests
  • Windows IPC primitives and complete Rust runtime-core tests
  • Ubuntu and Windows adapter/transactional-installer portability
  • 76 hosted installer tests, workspace typechecks/builds, protocol/identity/forbidden-surface gates
  • local focused installer/lifecycle/service/transaction suite: 68 passed
  • local packaging and release-archive tests: 5 passed
  • release workflow YAML parse: passed

Why draft

This is a substantial operational architecture change. The low-friction fallback is deliberate, but the persistent-process model, lifecycle semantics, platform service behavior, and explicit Windows durability boundary deserve maintainer review before merge.

Introduce receipt-owned transactional install/update/rollback/uninstall, crash recovery and cross-process locking, plus a persistent Core daemon with a reconnectable native relay and best-effort per-user service management.
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