Skip to content

fix(composer): ignore delayed PR/MR lookups after you change the form - #26954

Merged
OrcaWin merged 1 commit into
mainfrom
nwparker/fence-review-base-10-09
Oct 11, 2026
Merged

OrcaWin merged 1 commit into
mainfrom
nwparker/fence-review-base-10-09

Conversation

@nwparker

@nwparker nwparker commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

When you pick a GitHub PR or GitLab MR in the New Workspace composer, Orca looks up its base branch in the background. If you change your mind before that lookup finishes (pick a different issue, change the base, switch project or folder), the old answer could still arrive and overwrite what you chose. Now an old answer is ignored once you've moved on.

What Changed

  • Before: GitLab MR lookups had no check at all, so a late reply replaced your current base, push target and note (or showed an error for a source you'd already dropped). A raw #123 lookup started by pressing Create could also overwrite a name you edited while it ran.
  • After: the composer's existing "which PR selection is current" marker now covers GitLab MRs and raw GitHub submit lookups too. A reply only updates the form while its selection is still the current one. Changing the source, base, repository, folder project or Start-from clears it; editing the name or branch clears a pending raw lookup.
  • A Create that already started still gets the result it asked for; only the stale form update is skipped.
  • Switching a project to another host keeps a GitLab MR's base as before; only a GitHub PR re-resolves on the new host (unchanged).

Why

There was already one marker for GitHub PR lookups. Extending it to the other lookups fixes all of them in one place, including switches between providers, instead of adding a separate flag per provider. Renderer-only; no wire, storage or host changes.

Linked Issue

Follow-up to #26937 (no separate issue).

Visual Proof

Before/after captures from the original PR description are still accurate for the GitLab MR case: choose MR !2, switch to another issue and base, then let the MR lookup finish. Before: the MR's base replaces your choice. After: your choice stays.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated

New tests in composer-review-base-fencing, composer-review-base-submit-cache and composer-submit-source-ownership. With the GitLab fix removed, the GitLab cases fail against main (late reply overwrites the form). The full composer suite passes (20 files, 209 tests). pnpm tc:web, oxlint, check:code-quality:changed and pnpm lint (owner-routing ratchet at 0) pass.

Review

Rebuilt on current main (kept main's owner routing in the three conflicting files). P0/P1 review found one regression: a resolved GitLab MR base was cleared on a same-project host switch. Fixed, with a regression test. A second note (typing a branch while a PR/MR lookup is pending is still overwritten when it lands) is existing behavior on main and left as is.

Agent skill upstream boundary

  • Not applicable.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • Before/after described
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote impact considered (renderer-only)

@OrcaWin
OrcaWin force-pushed the nwparker/fence-review-base-10-09 branch from 3c45023 to 0c1d57c Compare October 11, 2026 08:10
@OrcaWin
OrcaWin changed the base branch from nwparker/explicit-workspace-name-10-09 to main October 11, 2026 08:10
@OrcaWin OrcaWin changed the title fix: preserve workspace choices after delayed lookups fix(composer): ignore delayed PR/MR lookups after you change the form Oct 11, 2026
@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

📝 Walkthrough
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough

Walkthrough

The composer now uses a shared source-selection ref for GitHub PR selections, GitLab MR selections, and GitHub submit lookups. Selection-changing actions clear or retarget that ref. Provider and submit resolution handlers check that their selection is still current before applying results. New tests cover stale resolutions, submit lookup behavior, and review-base caching.








Priority: ➖ Normal

Merge Risk: 🔵 Low · up to 0c1d5

A delayed lookup can replace form choices after switching hosts. This is a narrow, fixable risk to address before merging.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 29 functions across 26 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description covers the problem, user-visible behavior, implementation approach, testing, review notes, and scope. It is mostly complete, but it does not provide an actual issue link in the require…
Title check Passed The title clearly and concisely describes the main change: preventing delayed PR/MR lookups from overwriting newer form choices.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR







  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ccf65500-1660-4ed9-8df0-676c2e673435
📥 Commits

Reviewing files that changed from the base of the PR and between 0024735 and 0c1d57c.

📒 Files selected for processing (26)
  • src/renderer/src/hooks/composer-state/async-composer-state.ts
  • src/renderer/src/hooks/composer-state/async-model.ts
  • src/renderer/src/hooks/composer-state/branch-start-point-actions.test.ts
  • src/renderer/src/hooks/composer-state/branch-start-point-actions.ts
  • src/renderer/src/hooks/composer-state/composer-decisions.ts
  • src/renderer/src/hooks/composer-state/composer-deferred-source-name.test.ts
  • src/renderer/src/hooks/composer-state/composer-external-sync.ts
  • src/renderer/src/hooks/composer-state/composer-name-ownership.test.ts
  • src/renderer/src/hooks/composer-state/composer-name-source-selection.test.ts
  • src/renderer/src/hooks/composer-state/composer-review-base-fencing.test.ts
  • src/renderer/src/hooks/composer-state/composer-review-base-submit-cache.test.ts
  • src/renderer/src/hooks/composer-state/composer-review-base-test-fixture.ts
  • src/renderer/src/hooks/composer-state/composer-source-state.ts
  • src/renderer/src/hooks/composer-state/composer-submit-source-ownership.test.ts
  • src/renderer/src/hooks/composer-state/github-provider-selection.ts
  • src/renderer/src/hooks/composer-state/github-submit-resolution.ts
  • src/renderer/src/hooks/composer-state/gitlab-provider-selection.ts
  • src/renderer/src/hooks/composer-state/issue-source-actions.ts
  • src/renderer/src/hooks/composer-state/multiple-create-reset.test.ts
  • src/renderer/src/hooks/composer-state/project-target-actions.ts
  • src/renderer/src/hooks/composer-state/source-identity-actions.ts
  • src/renderer/src/hooks/composer-state/source-selection-decisions.ts
  • src/renderer/src/hooks/composer-state/target-change-actions.ts
  • src/renderer/src/hooks/composer-state/work-item-source-actions.ts
  • src/renderer/src/hooks/useComposerState-host-context-boundaries.test.ts
  • src/renderer/src/hooks/useComposerState-host-retarget.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

Comment on lines 120 to +135
@@ -131,7 +132,7 @@ export function useTargetChangeActions(input: TargetChangeActionsInput) {
setForkPushWarning(null)
}
if (!options.preserveStartFrom) {
smartGitHubPrStartPointSelectionRef.current = null
smartSourceSelectionRef.current = null

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Fence non-GitHub-PR lookups during preserved repository changes.

A same-project host switch preserves smartSourceSelectionRef.current unless it contains a GitHub PR. A pending GitLab MR or GitHub submit lookup can therefore pass its identity guard and publish a result from the previous repository context. Clear the shared selection ref for non-GitHub-PR selections while retaining the existing GitHub PR retargeting.

Suggested fix
-      if (!options.preserveStartFrom) {
+      if (!options.preserveStartFrom || smartSourceSelectionRef.current?.kind !== 'github-pr') {
         smartSourceSelectionRef.current = null
       }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// Why: only a GitHub PR re-resolves on the new host; other review bases are kept as before.
if (options.preserveStartFrom && smartSourceSelectionRef.current?.kind === 'github-pr') {
smartSourceSelectionRef.current = retargetGitHubPrStartPointSelection(
smartSourceSelectionRef.current,
value
)
setBaseBranch(undefined)
setCompareBaseRef(undefined)
setPushTarget(undefined)
setBranchNameOverride(undefined)
setBranchNameOverridePreservesNameEdits(false)
branchAutoNameRef.current = ''
setForkPushWarning(null)
}
if (!options.preserveStartFrom || smartSourceSelectionRef.current?.kind !== 'github-pr') {
smartSourceSelectionRef.current = null

@OrcaWin
OrcaWin merged commit a46ddb8 into main Oct 11, 2026
34 of 53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants