Skip to content

fix(worktree): log creation steps and stop swallowing errors#3201

Merged
charlesvien merged 2 commits into
mainfrom
fix/worktree-creation-verbosity
Jul 6, 2026
Merged

fix(worktree): log creation steps and stop swallowing errors#3201
charlesvien merged 2 commits into
mainfrom
fix/worktree-creation-verbosity

Conversation

@charlesvien

Copy link
Copy Markdown
Member

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

WorktreeManager now 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 exact git worktree add command 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, fetchRef reports the git error behind fetch fallbacks, listWorktrees and 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/core reports no restricted imports.

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

@trunk-io

trunk-io Bot commented Jul 6, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

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

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit d8c0495.

@greptile-apps

greptile-apps Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "add verbosity to worktree creation path" | Re-trigger Greptile

Comment thread packages/git/src/worktree.ts Outdated
@charlesvien charlesvien added the Stamphog This will request an autostamp by stamphog on small changes label Jul 6, 2026
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
github-actions[bot]
github-actions Bot previously approved these changes Jul 6, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@github-actions github-actions Bot dismissed their stale review July 6, 2026 18:53

New commits pushed (delta classified non_trivial_delta) — stamphog approval dismissed; re-review running automatically.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pure observability and error-propagation improvement. Logging is additive with a noop fallback, all new parameters are optional, and the resolved inline concern about a misleading user-visible "Waiting..." message was addressed by removing it entirely.

@charlesvien charlesvien enabled auto-merge (squash) July 6, 2026 18:55
@charlesvien charlesvien merged commit 6629ffb into main Jul 6, 2026
24 checks passed
@charlesvien charlesvien deleted the fix/worktree-creation-verbosity branch July 6, 2026 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Stamphog This will request an autostamp by stamphog on small changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant