[codex] Preserve PR materialization failure chains#3443
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
ApprovabilityVerdict: Approved This PR improves error handling by preserving both failure causes when PR branch materialization fails. The changes are limited to error paths with a new additive error type and corresponding test coverage - a straightforward, low-risk improvement. You can customize Macroscope's approvability policy. Learn more. |
Co-authored-by: codex <codex@users.noreply.github.com>
4b64df7 to
4734fe1
Compare
Dismissing prior approval to re-evaluate 4734fe1
Summary
Testing
Note
Low Risk
Scoped to PR thread preparation error reporting and contracts; behavior on success is unchanged, with clearer failure diagnostics on dual-fetch errors.
Overview
When preparing a PR worktree thread, both the repository-head fetch and the pull-request-ref fallback can fail; callers now get a single
GitPullRequestMaterializationErrorinstead of only the fallbackGitCommandError.The new contract error carries cwd, PR number, head repo/branch, and local branch name, with an
AggregateErrorcause that lists both underlying git failures (primary ascause.cause).GitManagerServiceErrorincludes this type so UI/RPC can pattern-match it.Related logging in upstream configuration and setup-script failures is switched to structured
Effect.logWarningpayloads rather than interpolated strings.Reviewed by Cursor Bugbot for commit 4734fe1. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Preserve both branch materialization failures in
GitPullRequestMaterializationErrorGitPullRequestMaterializationErrorto packages/contracts/src/git.ts, a structured error carryingcwd,pullRequestNumber,headRepository,headBranch,localBranch, and acausefield.fetchPullRequestBranchfail inmaterializePullRequestHeadBranch, the error now wraps both failures in anAggregateError(withprimaryCauseas its own cause) rather than surfacing only the fallback error.Effect.logWarningcalls inconfigurePullRequestHeadUpstreamandpreparePullRequestThread.GitCommandErrorinstances are preserved in theAggregateErrorcause chain.GitManagerServiceErrornow includesGitPullRequestMaterializationError; consumers that pattern-match this union need to handle the new variant.Macroscope summarized 4734fe1.