fix: enums, daemon cwd crash, L0 cleanup after gc/killall - #18
Merged
Conversation
- Set stable cwd ($HOME) for all subprocess spawns so the daemon doesn't crash openclaw/Node.js when the inherited cwd is a deleted worktree. - chdir daemon grandchild to $HOME immediately after double-fork. - Add gc_orphaned_l0() to remove L0 orchestrator entries that have no remaining children after gc or killall. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…tatus enums Add `src/types/mod.rs` with three enums (`Backend`, `Orchestrator`, `WorkerStatus`) that carry serde, `FromStr`, and `Display` impls. Worker struct fields are now typed instead of `String`, so invalid values are caught at compile time. Existing `state.json` files deserialise without changes thanks to the same lowercase string representation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
🧪 Coverage Report
📄 Coverage by file
|
When killing or GC-ing nested workers, parent worktrees were removed before their children, causing git worktree remove failures for any nested .worktrees paths. Sort workers deepest-first (L3 → L2 → L1) before processing. Also bump version to 0.0.9. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.worktrees/<name>), subprocesses likeopenclaw system eventcrashed on startup because Node.js requires a valid cwd. Fixed by settingcurrent_dir($HOME)on all subprocess spawns inrun_out()andchdir($HOME)in the daemon's double-fork grandchild.gcorkillallremoved all child workers, the L0 orchestrator entry stayed instate.json, makingorca listshow a stale "orc" entry. Addedgc_orphaned_l0()that removes L0 entries with no remaining children."running","claude", etc.) with type-safe enums throughout the codebase. Serde representations remain backwards-compatible with existingstate.jsonfiles. Aliases like"cc"→Backend::Claudeare handled in deserialization.Test plan
cargo fmt --checkpassescargo clippy -- -D warningspassescargo nextest run— 643 tests passorca listshows clean state🤖 Generated with Claude Code