Repository navigation
feat(up): one journaled apply of a versioned runtime blueprint - #126
Conversation
#109) `hanzo up` resolves a blueprint (schema hanzo.ai/runtime-blueprint/v1), keys it by the sha256 of its canonical JSON, and applies its steps through one journal in ~/.hanzo/lifecycle/apply.json: - a step done under the same key that still observes ready is left alone, so a repeated `hanzo up` acts on nothing; - a failed step, or one a killed process left running, is where the next `hanzo up` resumes; a done step that stopped holding is repaired; - an act whose observation stays false is failed, not done (`hanzo up --ai-only` printed "ready" with the router inactive); - `hanzo up rollback` applies the last blueprint that completed and deletes nothing; one apply per machine (try_lock). `hanzo up plan [--json]` shows the machine, digest, steps with journal status, every download, the privileges needed and any blocker. The machine is read, never assumed (lifecycle/platform.rs): OS, arch, $SHELL, WSL, euid, /dev/kvm and cloud-hypervisor. A blocked runtime is refused before any download, reusing vm.rs's preflight text. The KUBECONFIG line is spelled for the shell that is there instead of `export` for everyone. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01P5YBdxxi7GdeYNnGHaf4Lw
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…gs red Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01P5YBdxxi7GdeYNnGHaf4Lw
…nest privileges From the independent review on #126: - `cloud` and `app:*` run on every apply: up::up is the warm-cluster reconciler (re-pin, hanzod upstream, --link). Skipping a "ready" cloud dropped all of it, --link included. Only `engine` is skipped when it still answers. - A step gets patience to become ready (engine 20s) instead of one 300ms probe straight after a systemctl restart. - The refusal and the apply lock come before the state file or hanzod are touched. - The rollback target is the last OTHER blueprint that ever completed, journaled with this release's vm/checkpoint, refused where the cwd manifest would change it. - A corrupt or foreign journal is replaced with a note, not a hard error; a journal whose steps differ starts over instead of panicking; saves fsync before the rename. - `hanzo up plan` names every service-manager act (k3s.service via --no-ask-password, the router user unit) instead of claiming none. - nu gets a literal string, so a Windows path is not read as escapes. - the --ai-only --native runtime step accepts a running hanzo-vm supervisor, as up::start does. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01P5YBdxxi7GdeYNnGHaf4Lw
… to itself Second review on #126: the lock lived for the whole TUI session, so a second terminal's `hanzo up` was refused while the dashboard was open. The state file is now read under the lock too. A rollback no longer leaves the applied blueprint as its own rollback target. LLM.md states that a failed --native runtime step no longer starts the engine anyway. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01P5YBdxxi7GdeYNnGHaf4Lw
Independent red review (separate agent, read the diff cold)Round 1, on b10ef10: 2 blockers, 8 should-fix, several nits. All addressed in 911f31c.Blockers
Should-fix
Nits fixed: nu quoting (Windows paths) and fsync before rename. Round 2, on 911f31c: 1 new should-fix, plus nits. Addressed in ccb899e.
Round 3, on ccb899e: clean.Gaps stated, not fixed
Gates run locally
Generated by Claude Code |
Part of #109 · epic hanzo-inc/app#562 · contract hanzoai/hips#33
Why "Part of" and not "Fixes": #109's acceptance list includes 8 GB reference-hardware performance evidence and an airplane-mode restart run. Both need a reference machine. The epic says to close only with verified evidence, so this PR does not auto-close the issue.
What changes
hanzo up(every mode except--local) is one journaled apply of a blueprint:lifecycle/provision.rs, schemahanzo.ai/runtime-blueprint/v1).hanzo.config.jsonis folded in byup::with_app_manifest, which is now one implementation with two readers.~/.hanzo/lifecycle/apply.json, fsync then atomic rename after each transition).running, is where the next run starts.cloudandapp:*run on every apply, because their acts are the reconcilers (re-pin, hanzod upstream,--link).engineis left alone while it still answers.hanzo up rollbackapplies the most recent other blueprint that ever completed, through the same apply. It deletes nothing;hanzo resetstays the only destructive verb.hanzo up plan [--json]changes nothing. It prints:The machine is read, never assumed (
lifecycle/platform.rs).$SHELL, WSL, euid,/dev/kvmandcloud-hypervisor.vm.rs's existing preflight text.Bugs fixed (each with a test that fails before the fix)
hanzo up --ai-onlyprinted "✓ AI-only environment ready" with the router inactive. It now names what did not answer.export KUBECONFIG=…was printed to every shell, which is wrong for PowerShell, cmd, nu and fish. It is now spelled for the shell that is there, or said in words if the shell is unknown.$SHELLpath was not recognised.main'sclippy -D warningslane was red on a dead test-only import.Evidence
Proved (run here, Linux x86_64):
test:lane is green:make testwith an empty read-only HOME, then an empty writable HOME, which stayed empty.cargo clippy --locked --all-targets -- -D warningsis clean.hanzo upwas refused with the fix printed, and nothing was downloaded.--ai-only:Built but not proved:
hanzo up planprints that warning on those machines./dev/kvm. The acts are the unchangedup::up/up::start.LocalOsand theenv_upordering have no test of their own.Not done:
sh -capp spawn on Windows, andengine::uprelying on systemd (so--ai-onlyon macOS fails honestly).Rollout / rollback
hanzo upafter upgrade starts a fresh journal.apply.json, and deleting that file is harmless.🤖 Generated with Claude Code
https://claude.ai/code/session_01P5YBdxxi7GdeYNnGHaf4Lw