Skip to content

feat(daemon): bounded-backoff crash recovery and local hanzod build docs (#24) - #26

Merged
zeekay merged 1 commit into
hanzoai:mainfrom
tranhoangtu-it:feat/hanzod-crash-recovery-backoff-24
Nov 29, 2026
Merged

zeekay merged 1 commit into
hanzoai:mainfrom
tranhoangtu-it:feat/hanzod-crash-recovery-backoff-24

Conversation

@tranhoangtu-it

Copy link
Copy Markdown
Contributor

Closes #24
/claim #24

Summary

  • Added a periodic lifecycle supervisor (Lifecycle::spawn_supervisor + SupervisorGuard, wired into both main.rs and lib.rs with clean shutdown) and POST /v1/lifecycle/reconcile endpoint (reconciler.rs + backoff.rs).
  • Implemented crash detection (crashed status + last_exit surfaced in /v1/lifecycle/status, doctor, and ps) across runtime, platform services, and managed app processes (AppProcessObs, Engine::refresh_liveness, and real OS child tracking in SystemExecutor via proc::bg_tokio_cmd).
  • Implemented bounded exponential crash recovery backoff (BackoffPolicy / BackoffTracker with initial, max, and reset_after healthy reset) that clears automatically on explicit stop, down, start, and reset actions.
  • Documented local hanzod build prerequisites, test commands, and runtime verification in README.md.
  • Kept daemon/src/lifecycle/reconciler.rs (958 lines) and all newly added/edited Rust files under 1,000 lines with LF line endings and zero edits to Cargo.lock or vendor/.

Verification

Automated tests (cargo test --locked)

  • cargo test --locked -p hanzod --lib lifecycle -> ok. 9 passed; 0 failed (including killed_workload_reconciles_with_bounded_backoff and system_executor_recovers_killed_os_child_process)
  • cargo test --locked -p hanzod --lib proc::tests::no_unguarded_command_new_in_daemon_src -> ok. 1 passed; 0 failed
  • cargo test --locked -p steward -p zaphttp -> ok. 5 passed (steward) + ok. 5 passed (zaphttp)
  • cargo build --locked -p hanzod --bin hanzod -> compiled cleanly (dev profile)

Local hanzod boot & endpoint probe (isolated HANZO_DATA_DIR, HANZOD_TARGET_RUNNER=0)

VERSION: hanzod 0.5.2 (dev=hanzo-gen harness=hanzo-gen/0.2.0 chain=steward engine=managed)
GET /healthz -> 200 {"ok":true}
GET /v1/hanzod -> 200 (16 routes running, surfaces: desktop..identity)
GET /v1/lifecycle/status -> 200 (desired-state-reconciler running, ps table & caches intact)
POST /v1/lifecycle/reconcile (unauth HTTP) -> 401 (auth guard active; socket Via::Socket route verified in lifecycle tests)

Signed-off-by: Trần Hoàng Tú <tuth@ominext.com>
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-28T08:33:03.900691Z
We couldn’t complete this review. Comment @codex review to try again.
d195041 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@zeekay

zeekay commented Nov 29, 2026

Copy link
Copy Markdown
Member

Clean end-to-end implementation for #24, @tranhoangtu-it — completes SystemExecutor::app_children spawning/observation (proc::bg_tokio_cmd argv execution without shell interpolation, paired with existing desired == "stopped" termination), refreshes Engine child liveness via try_wait(), adds exponential BackoffTracker with healthy cooldown and operator-action reset, wires the 1s supervisor in both main.rs and lib.rs, and verifies real OS SIGKILL crash recovery. Verified hanzod lifecycle & daemon tests green. Merging!

@zeekay
zeekay merged commit bce76f2 into hanzoai:main Nov 29, 2026
1 check 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.

[Intern] Local hanzod daemon lifecycle & child-process crash recovery tests

3 participants