fix(worktree): propagate config errors and ensure cleanup on early exit (#4701, #4702)#4720
Merged
Conversation
#4701: handle_worktree_command now propagates config parse errors via `?` with an error message including the config file path, instead of silently falling back to the default config (which has worktree.enabled=false). #4702: add WorktreeCleanupGuard RAII struct in zeph-subagent that ensures wm.remove runs on both normal return and early exit via `?`. Uses Handle::try_current() in Drop to safely spawn the cleanup task; logs an error if no runtime is active without panicking. Note: panic=abort in the release profile means Drop does not run on panics in release builds. Closes #4701, Closes #4702
52aabb8 to
bb1c63d
Compare
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
worktree: handle_worktree_command silently falls back to default config on parse error #4701:
handle_worktree_commandnow propagates config parse errors instead of silently falling back to the default config. Previously,Config::load(&path).unwrap_or_default()swallowed parse errors and returned a default config withworktree.enabled = false, producing a confusing "worktree subsystem is disabled" error even when the user's config setenabled = true. Now the error is surfaced with the config file path included.bug(subagent): worktree not removed when run_agent_loop panics #4702: Added
WorktreeCleanupGuardRAII struct inzeph-subagentto ensurewm.removeruns on both normal return and early exit via?. TheDropimpl usesHandle::try_current()to safely spawn the cleanup task; logstracing::error!if no runtime is active without panicking. Note:panic = "abort"in the release profile meansDropdoes not run on panics in production — the guard protects against early-return paths.Test plan
cargo +nightly fmt --checkpassescargo clippy --workspace -- -D warningspassescargo nextest run --workspace --lib --binspasses (713+ tests including 4 new regression tests)invalid_config_returns_error_not_defaulttest insrc/commands/worktree.rsverifies worktree: handle_worktree_command silently falls back to default config on parse error #4701worktree_cleanup_guard_testsmodule incrates/zeph-subagent/src/manager.rsverifies bug(subagent): worktree not removed when run_agent_loop panics #4702: cleanup on normal drop, log-without-panic outside runtime, and spawn-with-runtimeCloses #4701
Closes #4702