fix(worktree): log creation steps and stop swallowing errors#3201
Conversation
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
|
Reviews (1): Last reviewed commit: "add verbosity to worktree creation path" | Re-trigger Greptile |
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Pure observability and error-propagation improvement — adds optional structured logging to worktree operations, surfaces actual error messages instead of swallowing them, and captures previously-ignored warning arrays. No functional behavior changes, no breaking API changes, no security issues.
New commits pushed (delta classified non_trivial_delta) — stamphog approval dismissed; re-review running automatically.
Problem
Worktree creation fails silently and it's getting worse (reported internally by Paul, also hit by Phil and Daniel). A task gets created, provisioning dies somewhere in the middle and nothing says where: several paths swallowed errors entirely or reduced them to a generic message, so the logs have no trail to debug from.
Changes
WorktreeManagernow takes an optional logger and logs every creation step: inputs, resolved name/path/ref, write-lock wait and acquisition (a stuck lock previously queued forever with zero output), the exactgit worktree addcommand with duration and exit code, and finalize. All workspace-server call sites pass their scoped logger, and provisioning output is mirrored into the main log since the renderer stream drops data when no view is subscribed.Stopped suppressing errors along the path: post-checkout hook failures and link/include warnings were silently discarded and are now logged and emitted to provisioning output,
fetchRefreports the git error behind fetch fallbacks,listWorktreesand the delete fallbacks log why they fell back, and the workspace setup retry prompt now shows the real error instead of "Please try again".No behavior changes beyond error messages; failures still propagate the same way.
How did you test this?
pnpm typecheck(22/22 packages), unit tests for@posthog/git(310),@posthog/workspace-server(624) and@posthog/core(2128) all pass. Updated one core test that pinned the old generic setup error message.biome lint packages/corereports no restricted imports.Automatic notifications