Skip to content

fix(worktree): propagate config errors and ensure cleanup on early exit (#4701, #4702)#4720

Merged
bug-ops merged 1 commit into
mainfrom
4701-4702-worktree-bugs
May 30, 2026
Merged

fix(worktree): propagate config errors and ensure cleanup on early exit (#4701, #4702)#4720
bug-ops merged 1 commit into
mainfrom
4701-4702-worktree-bugs

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented May 30, 2026

Summary

  • worktree: handle_worktree_command silently falls back to default config on parse error #4701: handle_worktree_command now 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 with worktree.enabled = false, producing a confusing "worktree subsystem is disabled" error even when the user's config set enabled = true. Now the error is surfaced with the config file path included.

  • bug(subagent): worktree not removed when run_agent_loop panics #4702: Added WorktreeCleanupGuard RAII struct in zeph-subagent to ensure wm.remove runs on both normal return and early exit via ?. The Drop impl uses Handle::try_current() to safely spawn the cleanup task; logs tracing::error! if no runtime is active without panicking. Note: panic = "abort" in the release profile means Drop does not run on panics in production — the guard protects against early-return paths.

Test plan

Closes #4701
Closes #4702

@github-actions github-actions Bot added bug Something isn't working size/M Medium PR (51-200 lines) rust Rust code changes labels May 30, 2026
#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
@bug-ops bug-ops enabled auto-merge (squash) May 30, 2026 01:36
@bug-ops bug-ops force-pushed the 4701-4702-worktree-bugs branch from 52aabb8 to bb1c63d Compare May 30, 2026 01:36
@bug-ops bug-ops merged commit 68822f3 into main May 30, 2026
32 checks passed
@bug-ops bug-ops deleted the 4701-4702-worktree-bugs branch May 30, 2026 01:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working rust Rust code changes size/M Medium PR (51-200 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(subagent): worktree not removed when run_agent_loop panics worktree: handle_worktree_command silently falls back to default config on parse error

1 participant