Skip to content

Preserve user-set workspace names across branch changes - #17448

Merged
Jinwoo-H merged 10 commits into
mainfrom
review/pr12742-landable
Aug 31, 2026
Merged

Jinwoo-H merged 10 commits into
mainfrom
review/pr12742-landable

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 25 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​826 $\color{#cf222e}{\Huge{\mathbf{−}}}$​10 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​816
Prod 42 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​527 $\color{#cf222e}{\Huge{\mathbf{−}}}$​90 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​437

Summary

Fixes the P0 workspace unwanted-renaming bug by persisting whether a display name is user-pinned or automatic. User labels survive branch changes, including when the label equals the old branch; generated branch-like labels remain automatic.

Reproduction

On origin/main, a workspace with branch feature and display name feature changes its sidebar label to main after switching branches. The old renderer heuristic could not distinguish a user label from an auto-derived label.

Behavior

  • User labels are preserved exactly after edge trimming and control/bidi sanitization.
  • Clearing a label resumes automatic naming.
  • Collision retries suffix the Git branch/path candidate while retaining the visible user label.
  • Desktop, runtime/RPC, SSH, mobile, CLI, folder-compatible, and background creation paths carry provenance.
  • New wire fields are optional for mixed-version compatibility.

Validation

  • pnpm tc
  • changed-code quality: 0 findings
  • host/runtime focused suite: 1,257 passing, 1 existing skip
  • mobile suite: 3,899 passing, 3 skipped
  • Electron/CDP E2E: created a real workspace, changed its branch, and confirmed the rendered sidebar retained the pinned label
  • Reverted-oracle check: the new regression fails under the old equality heuristic and passes with provenance-aware mode

Compatibility note

An old host/client cannot preserve the equal-to-branch edge case after refresh because it does not persist/project the optional provenance bit; updated peers do. No public comments, deployment, or Linear mutation was performed.

ELI5

Orca now records whether a sidebar label came from the user or was generated from Git. A user label stays put when the branch changes, while generated labels continue following the branch. The provenance travels through local, remote, CLI, and mobile creation paths, and older metadata falls back to the previous heuristic.

Performance Measurement

No speed-up is claimed or measured; this is metadata correctness. Branch-switch handling remains O(1) and adds only a boolean provenance check; create and update paths add at most one optional enum/boolean field. Existing Git probes, IPC/RPC round trips, and persistence counts are unchanged. No wall-clock benchmark was run.

User-Facing Trade-offs

None on updated peers: user labels stay pinned while generated labels continue to follow the branch. A mixed-version old host or client cannot preserve the equal-to-branch pinned-label edge case because it does not carry the optional provenance bit; updated peers do. Otherwise label and branch behavior is unchanged.

@greptile-apps

greptile-apps Bot commented Aug 30, 2026 •

Copy link
Copy Markdown

Greptile Summary

This PR adds explicit display-name provenance so user-pinned workspace labels survive branch changes while generated labels continue following Git identity.

  • Adds optional provenance fields to shared metadata and RPC creation contracts.
  • Propagates provenance through desktop, CLI, mobile, SSH, folder, and orchestration creation paths.
  • Updates host persistence and renderer reconciliation to distinguish fixed and automatic display names.
  • Adds regression and compatibility coverage for branch changes, collision retries, legacy peers, and metadata refreshes.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
src/main/ipc/worktree-display-name.ts Centralizes display-name sanitization, legacy request interpretation, and pinned-versus-generated metadata resolution.
src/main/ipc/worktree-remote.ts Applies provenance-aware display-name resolution consistently to local and remote worktree creation.
src/main/ipc/worktree-metadata-merge.ts Projects persisted pinning metadata into fixed or automatic catalog display-name behavior.
src/main/runtime/orca-runtime.ts Carries display-name provenance through runtime creation and metadata update boundaries.
src/renderer/src/store/slices/worktrees/listing/fetched-worktree-merge.ts Reconciles fetched host metadata with renderer state while preserving explicit labels and refreshing automatic ones.
src/renderer/src/store/slices/worktrees/metadata/worktree-meta-persist.ts Persists renderer display-name changes together with their fixed or automatic provenance.
mobile/src/tasks/source-workspace-create.ts Marks manually edited mobile workspace labels as user-owned while leaving auto-managed branch labels unpinned.
src/shared/worktree/display-name-provenance.ts Defines the shared conversion between wire-level display-name mode and persisted pinning metadata.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
    A[Workspace creation request] --> B[Creation path: desktop, CLI, mobile, SSH, or RPC]
    B --> C[Host resolves and sanitizes display name]
    C --> D{Display-name provenance}
    D -->|User| E[Persist pinned display name]
    D -->|Generated| F[Persist automatic provenance]
    E --> G[Merge Git facts with metadata]
    F --> G
    G --> H{Branch changes?}
    H -->|Pinned| I[Keep user label]
    H -->|Automatic| J[Derive label from current branch]
    I --> K[Publish workspace catalog]
    J --> K
Loading

Reviews (11): Last reviewed commit: "refactor(workspaces): unify display-name..." | Re-trigger Greptile

@pullfrog pullfrog 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.

ℹ️ No critical issues — one design question and two minor nits below.

Reviewed changes

  • Provenance model — adds displayNameKind on the create wire args, displayNameIsPinned on WorktreeMeta, and a derived displayNameMode on Worktree, replacing the old renderer heuristic that couldn't tell a user label equal to the branch from an auto-derived one.
  • Name resolution — new src/main/ipc/worktree-display-name.ts centralizes resolveWorktreeCreateDisplayName / resolveWorktreeCreateDisplayNameMeta, threaded through local, remote, SSH, runtime/RPC, mobile, and CLI create paths.
  • Renderer branch-change logic — updateWorktreeGitIdentity now prefers displayNameMode over a displayName === currentBranchName equality check, with an undefined-mode fallback that preserves legacy behavior.

ℹ️ CLI and agent worktrees now freeze the sidebar label to --name

src/cli/handlers/worktree.ts now sends displayName: name with displayNameKind: 'user' on every worktree create, so a CLI- or agent-created worktree's label is committed to the --name value and stops re-deriving from the branch on later git checkouts. For the desktop composer this is exactly the intended fix, but the CLI --name is the git branch name itself (there is no separate display label), so this converts a label that previously tracked the branch into a frozen one. Worth confirming this is the intended scope for the CLI and agent paths rather than an accidental broad application of the provenance fix.

Technical details
# CLI/agent display-name provenance scope

## Open questions for the human
- Is it intended that `orca worktree create --name feature` pins the sidebar
  label to `feature` so it no longer follows a later branch switch? The composer
  wants that; the CLI (and the agent-path tests asserting `displayNameKind:
  'user'`) may not. If not, the CLI handler should omit `displayNameKind` (or
  mark it `generated`) and let the fallback stay automatic.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

Comment thread src/main/ipc/worktree-display-name.ts Resolved
@coderabbitai

coderabbitai Bot commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Worktree creation now carries displayNameKind through mobile, renderer, CLI, RPC, and runtime layers. Shared helpers sanitize and resolve generated or user-provided display names. Runtime metadata records whether a display name is pinned. Renderer state projects pin metadata to fixed or automatic display-name mode and preserves fixed names across branch changes. Tests cover request payloads, sanitization, provenance resolution, schema parsing, metadata merging, and branch updates.

Merge Risk: 🔵 Low · up to 67d7f

The PR preserves user-set workspace names across branch changes, but two bounded risks remain: clearing a label may leave an empty name for worktrees with no branch, and mixed-version peers may lose the pinned-name distinction in the equal-to-branch case. The change is otherwise mergeable with owner awareness or follow-up for these edge cases.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the bug, behavior, implementation scope, compatibility, and validation. However, it omits the required linked issue, visual proof or an explicit N/A statement, the required Te… Add a valid issue reference after “Fixes #”. Add the required Visual Proof section with attachments or write N/A with a reason. Add the Testing section and mark or explain the required test checkboxes. Complete the remaining required temp…
Docstring Coverage ⚠️ Warning Docstring coverage is 14.81% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 27 functions across 45 files. (1 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise, specific, and accurately summarizes the primary change: preserving user-set workspace names across branch changes.
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.
Full details: Description check

Explanation

The description explains the bug, behavior, implementation scope, compatibility, and validation. However, it omits the required linked issue, visual proof or an explicit N/A statement, the required Testing section and checklist status, and several template sections.

Resolution

Add a valid issue reference after “Fixes #”. Add the required Visual Proof section with attachments or write N/A with a reason. Add the Testing section and mark or explain the required test checkboxes. Complete the remaining required template sections, including AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist.

Full details: Docstring Coverage

Explanation

Docstring coverage is 14.81% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 27 functions across 45 files. (1 skipped: 1 too large.)

✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch

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: 3


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b2d8dfa2-e617-4d00-98a8-8ca4ad015fed

📥 Commits

Reviewing files that changed from the base of the PR and between ba5f334 and 486666dff1a13a0602abec13ae4845eba744b484.

📒 Files selected for processing (36)
  • config/tsconfig.tc.web.json
  • mobile/src/tasks/blank-workspace-create.test.ts
  • mobile/src/tasks/blank-workspace-create.ts
  • mobile/src/tasks/source-workspace-create.test.ts
  • mobile/src/tasks/source-workspace-create.ts
  • mobile/src/tasks/workspace-create-params.ts
  • src/cli/handlers/worktree.ts
  • src/cli/index-worktree-create-agent.test.ts
  • src/cli/index-worktree-create-linear.test.ts
  • src/cli/index-worktree-create-parent.test.ts
  • src/cli/index-worktree-create-target.test.ts
  • src/main/ipc/worktree-display-name.ts
  • src/main/ipc/worktree-logic.test.ts
  • src/main/ipc/worktree-logic.ts
  • src/main/ipc/worktree-metadata-merge.ts
  • src/main/ipc/worktree-remote.ts
  • src/main/runtime/orca-runtime.ts
  • src/main/runtime/rpc/methods/worktree-create-args.ts
  • src/main/runtime/rpc/methods/worktree-create-schemas.ts
  • src/main/runtime/rpc/methods/worktree-schemas.test.ts
  • src/main/runtime/rpc/methods/worktree.ts
  • src/renderer/src/hooks/composer-state/full-creation-execution.ts
  • src/renderer/src/hooks/composer-state/full-submit-preparation.ts
  • src/renderer/src/hooks/composer-state/quick-creation-execution.ts
  • src/renderer/src/hooks/composer-state/quick-creation-request.ts
  • src/renderer/src/hooks/composer-state/quick-submit-preparation.ts
  • src/renderer/src/lib/pending-worktree-creation.ts
  • src/renderer/src/lib/worktree-creation-flow-execute.ts
  • src/renderer/src/store/slices/worktree-meta-update-application.ts
  • src/renderer/src/store/slices/worktrees-git-identity-branch-title.test.ts
  • src/renderer/src/store/slices/worktrees/create/worktree-create-payload.ts
  • src/renderer/src/store/slices/worktrees/metadata/update-worktree-meta.ts
  • src/renderer/src/store/slices/worktrees/metadata/worktree-git-identity-update.ts
  • src/shared/worktree/create-types.ts
  • src/shared/worktree/meta-types.ts
  • src/shared/worktree/types.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.

Comment thread src/main/ipc/worktree-display-name.ts Resolved
Comment thread src/main/runtime/orca-runtime.ts Resolved
Comment thread src/main/runtime/orca-runtime.ts Resolved
@Jinwoo-H
Jinwoo-H force-pushed the review/pr12742-landable branch from e1ab971 to 8ad9530 Compare August 30, 2026 22:20
@coderabbitai

coderabbitai Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes

Since the prior Pullfrog review, commit f06ac0ba5c addressed the two open inline threads and hardened the sanitize-to-empty edge cases:

  • Mobile display-name trimming — createNewBranchWorkspace / createBranchWorkspace now send a pre-trimmed manualDisplayName, resolving the guard-vs-value inconsistency.
  • Provenance-branch clarity — resolveWorktreeCreateDisplayNameMeta gained comments explaining the generated-vs-user distinction, and the bidi rationale was restored on sanitizeWorktreeDisplayName.
  • Empty user-label handling — a user label that sanitizes away now resolves to { displayNameIsPinned: false }, keeping the generated fallback automatic rather than falling through to shouldSetDisplayName.
  • Runtime folder path — createManagedWorktree resolves the name via resolveWorktreeCreateDisplayName and pins only when displayNameKind === 'user' with a non-empty resolved name.
  • Test coverage — new cases cover sanitize-to-empty user labels and the folder path's unpinned behavior; each would fail under the previous logic.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@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: Pro Plus

Run ID: a5456a70-9164-4eca-a08d-f70b847a1421

📥 Commits

Reviewing files that changed from the base of the PR and between f06ac0b and 67d7fd70bc0cad95b59f86fe47bf8cdb24564abf.

📒 Files selected for processing (13)
  • src/main/ipc/worktree-metadata-merge.test.ts
  • src/main/ipc/worktree-metadata-merge.ts
  • src/main/runtime/orca-runtime.ts
  • src/main/runtime/rpc/methods/orchestration-federated-worker-start.ts
  • src/main/runtime/rpc/methods/orchestration-federation-start-schema.ts
  • src/main/runtime/rpc/methods/orchestration-federation.test.ts
  • src/main/runtime/rpc/methods/orchestration-federation.ts
  • src/main/runtime/rpc/methods/orchestration-worker-topology.ts
  • src/main/runtime/rpc/methods/orchestration-workers-new-worktree.test.ts
  • src/renderer/src/store/slices/worktree-meta-update-application.test.ts
  • src/renderer/src/store/slices/worktree-meta-update-application.ts
  • src/renderer/src/store/slices/worktrees/listing/detected-worktree-meta.test.ts
  • src/renderer/src/store/slices/worktrees/listing/detected-worktree-meta.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.

@pullfrog pullfrog 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.

ℹ️ No critical issues — one minor import-ordering nit inline.

Reviewed changes

  • Automatic name freshness — mergeWorktree now re-derives the display name from the live branch whenever displayNameIsPinned is false, so a persisted auto-generated label no longer shows a stale value after a branch switch.
  • Clear-label optimistic reset — applyWorktreeUpdates and applyDetectedWorktreeUpdates reset the display name back to the current branch immediately when a label is cleared, matching the server-side merge.
  • Orchestration provenance — worker and federation create paths now carry displayNameKind (a new optional schema field, plus a 'user' derivation from an explicit worker label), and createManagedWorktree forwards it.
  • Coverage — new tests exercise branch re-derivation, the clear-label reset in both projection helpers, and worker-label provenance; each fails under the previous logic.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@@ -17,6 +17,7 @@ import { worktreeMatchesHost } from './worktree-host-ownership'
const folderWorkspaceWorktreeCache = new WeakMap<FolderWorkspace, Worktree>()

import { worktreeRowMatchesMetaHost } from './worktree-meta-host-match'
import { branchName } from '@/lib/git-utils'

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.

branchName (and worktreeRowMatchesMetaHost above it) is imported after the folderWorkspaceWorktreeCache declaration instead of with the top-level import block, whereas the sibling worktree-meta-update-application.ts imports branchName cleanly at the top. Hoist these two imports to the top of the file to match the surrounding convention.

@Jinwoo-H
Jinwoo-H force-pushed the review/pr12742-landable branch from c29d299 to 8c5a390 Compare August 31, 2026 19:17

@pullfrog pullfrog 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.

ℹ️ The c29d299 delta is clean. Holding only on the minor import-placement suggestion left by the prior review (unchanged by this commit).

Reviewed changes

  • Legacy CLI label preservation — mergeWorktree now treats pre-migration CLI-created labels (cliProvenance.kind === 'created-by-cli' with no displayNameIsPinned) as fixed instead of automatic, so a legacy label equal to its branch no longer re-derives on refresh.
  • Renderer fallback — updateWorktreeGitIdentity excludes CLI-created worktrees from the display-name-equals-branch auto-derived heuristic, preserving legacy CLI titles even when displayNameMode was never projected (mixed-version / stale-cache defense-in-depth).
  • Coverage — new tests exercise both the server projection and the renderer fallback; each fails under the previous logic.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog 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.

ℹ️ No new issues in this delta. The one thread left open by the prior review (import placement in detected-worktree-meta.ts) is unchanged by this commit and remains pending.

Reviewed changes

  • Unified CLI provenance resolution — added resolveWorktreeCreateDisplayNameRequest, which coerces CLI-created requests to a pinned 'user' label (falling back to args.name when no display name was sent), and threaded it through the local, SSH, folder-workspace, provisioned-root-adoption, and runtime create paths so the legacy CLI contract holds on every host.
  • Host-authoritative pinning — worktrees:updateMeta now derives displayNameIsPinned from the display name at the host boundary instead of trusting renderer-authored provenance, and the first-agent title rename pins its label for catalog-refresh stability.
  • Concurrent-rename preservation — added preserveConcurrentDisplayName so a listing refresh response that predates a completed rename cannot clobber the newer label, covering mode-absent (older host) and mode-projected (newer host) variants.
  • Detached-worktree fallback — applyWorktreeUpdates and applyDetectedWorktreeUpdates keep the old label when clearing on a detached worktree instead of flashing an empty row, matching the host's repo/path fallback.
  • Mobile auto-name propagation — mobile create flows now compute nameIsAutoManaged from the draft vs. the last auto-generated name and suppress or emit displayName + displayNameKind accordingly; the web preload forwards displayNameKind.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog 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.

ℹ️ No new issues in this delta. The one prior minor nit (import placement in detected-worktree-meta.ts) is unchanged and remains the only open item.

Reviewed changes

  • Legacy provenance fallback — resolveWorktreeCreateDisplayNameRequest now classifies legacy requests that omit displayNameKind: an explicit displayName maps to a generated artifact title, nameWasGenerated stays generated, and a bare name-only request maps to a user-pinned label, recovering the pre-provenance "user-typed name" contract.
  • Threaded nameWasGenerated — the local, SSH, folder-workspace, provisioned-root, and runtime create paths now pass nameWasGenerated into the resolver so legacy generated names remain automatic.
  • Mobile collision-retry authoritative name — createWorktreeWithNameRetry returns the host-selected display name after a collision retry, falling back to the client candidate when an older host omits it.
  • Coverage — new tests pin the legacy name-only user create at the host boundary, the generated-name/artifact-title fallbacks, and the host-display-name-after-retry behavior.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog 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.

ℹ️ No new issues in this delta — the refresh-race fence is sound.

Reviewed changes

Since the prior Pullfrog review (174ca42726), commit da97c36966 ("fence display-name refresh races"):

  • Pending-write fence — persistWorktreeMeta now tracks in-flight displayName persists in a module-level set, and preserveConcurrentDisplayName keeps the optimistic name whenever a persist is still in flight, so a listing response captured before the write settles can't clobber the newer label.
  • Older-host guard — when a refresh omits displayNameMode but the live worktree is pinned (fixed or legacy CLI provenance), the merge keeps the pinned name instead of letting an omitted/generated label replace it.
  • Coverage — two new tests, each failing under the prior logic: one pins a fixed mode across a branch switch when the host drops displayNameMode, the other asserts a stale host response never overwrites an in-flight rename.

The one item still open from an earlier review (import placement in detected-worktree-meta.ts) is unchanged by this commit.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

The old-host preserve fence kept a pinned local label on every refresh,
which also suppressed a legitimate rename another client persisted
through the same host until app restart. Narrow it to labels the host
re-derived itself (branch short name, or path basename when detached);
any other changed label in a mode-less response is explicit meta a peer
wrote there. Stale prior-label responses stay covered by the downstream
staleness fence, in-flight writes by the pending fence.
Three call sites (renderer optimistic update, local IPC updateMeta
handler, remote worktree.set handler) each restated the same formula;
a future edit to one would silently skew provenance between paths.

@pullfrog pullfrog 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.

ℹ️ No new issues in this delta. The prior import-placement nit in detected-worktree-meta.ts remains open and is unchanged by this commit.

Reviewed changes

Since the prior Pullfrog review (da97c36966), commit 860e79c212 ("accept peer renames from provenance-less hosts"):

  • Narrowed the older-host guard — preserveConcurrentDisplayName now suppresses an incoming label only when it looks automatic (equal to the branch short, or the path basename when detached-HEAD), so a genuine peer rename from a provenance-less host is no longer clobbered by the previous over-broad guard. The incomingLooksAutomatic check mirrors the host's own mergeWorktree derivation.
  • Coverage — three new tests cover accepting a peer rename, suppressing a branch-derived relabel, and suppressing a detached-HEAD path relabel; the peer-rename test fails under the previous logic.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@Jinwoo-H
Jinwoo-H merged commit 8f15f21 into main Aug 31, 2026
38 checks passed
nwparker added a commit to nwparker/orca that referenced this pull request Sep 1, 2026
…-refactor

main advanced 45 commits, six of them landing inside the orca-runtime.ts this
branch splits apart. Git resolves that as a plain "take one side", and either
side silently loses work, so each was ported into the module that now owns the
code:

- stablyai#17655 bound ref and worktree scans -> runtime-repository-ref-queries
- stablyai#17448 preserve user-set workspace names -> the worktree-create modules
- stablyai#17667 cut cold worktree-switch attach latency -> the mutation lock, including
  the deletion half (worktree-terminal-mutation-wait.ts is gone)
- stablyai#17718 preserve large agent prompt pastes -> the agent-prompt write path
- stablyai#17486 unblock targeted SSH session tab refresh -> the mobile refresh modules
- stablyai#17159 close readiness gaps -> 34 runtime hunks and 5 test hunks

Every added line of the six was checked against the merged tree; the unmatched
ones are all renames or line splits, verified individually.

Two defects surfaced while porting, both predating this merge:

- isMobileSessionSurfaceMembershipAllowed read a session accessor that answers
  null where main's answers undefined, so main's `session !== undefined` guard
  was always true and the fence stopped fencing. Three clauses found in neither
  main nor the split base had been added ahead of it to compensate, and one of
  them dropped a freshly published split leaf out of syncWindowGraph. Restored
  to main's control flow with the sentinel normalized; stablyai#17159's two new tests
  cover it from both directions.
- retiredMobileSessionPtyIds was write-only state this branch invented. Its only
  reader was the clause above, and it exists in neither main nor the split base.
- RuntimeTerminalWriter.writeAgentPrompt had no callers and still carried the
  chunked-paste shape stablyai#17718 replaced.
nwparker added a commit to nwparker/orca that referenced this pull request Sep 1, 2026
The stablyai#17448 port added a third import from ../ipc/worktree-logic, which the
code-quality oxlint config rejects under --deny-warnings. Plain oxlint does not
flag it, so it only surfaced in CI's static analysis job.
nwparker added a commit that referenced this pull request Sep 1, 2026
…17605)

* refactor(runtime): split OrcaRuntimeService into focused modules

* test(runtime): cover admission tiers and strict worktree reconciliation

* fix(runtime): preserve owner and structured session visibility

* fix(runtime): port post-extraction compatibility fixes

* fix(runtime): preserve skill-share cancellation barrier

* test(runtime): update identity inventory after extraction

* fix(runtime): preserve hook transport environment cleanup

* fix(runtime): consolidate idle probe imports

* test(runtime): retire split file process allowlist entry

* fix(runtime): route child process types through shared boundary

* test(runtime): preserve worktree host metadata precedence

* fix(runtime): update extracted test seams

* fix(runtime): gate the split's ts-nocheck set and restore the stop-confirmed contract

Audit follow-ups for the OrcaRuntimeService split:

- Freeze the 171 @ts-nocheck files behind a ratchet so no new file can disable
  type checking. The split's linear mixin chain cannot express forward
  references yet, so the existing suppressions are grandfathered; the baseline
  may only shrink.
- Drop the stray @ts-nocheck at the end of orca-runtime-get-status.ts. It sat
  after the first statement, where TypeScript ignores it, so the module was
  already checked.
- Restore `retireRejectedPty(ptyId, stopConfirmed: boolean)` as a required
  argument. The split widened it to optional and patched the resulting error
  with `stopConfirmed === true`; an omitted argument would have silently taken
  the unverified-stop path instead of failing to compile.
- Guard that every orca-runtime-tests fragment is imported by the compatibility
  entrypoint. The fragments are .spec.ts, which no Vitest include glob matches,
  so one left out of the list would silently stop running.

* fix(runtime): restore four behaviors the OrcaRuntimeService split dropped

Audit findings against the refactor's true base (ad5ba25):

- retirePtyAgentLaunchAuthority collected pane keys after deleting the
  restored-authority receipt instead of before it. collectPaneKeysForPty reads
  that receipt, so a receipt-only pane lost its key and never had its agent-hook
  compatibility authority retired. on-pty-exit.ts already carried a comment
  naming this exact invariant.
- The PTY-exit path kept orchestrationMailboxNotifications.retirePty but lost
  the loop that schedules a debounced mail-pointer repoint for the dead pty's
  terminal handle and any run bound to its panes. Restores the schedule call
  count to 7, matching base.
- subscribeToPtyExit lost isPtyKnownExited's leaf fallback and its
  post-registration lifecycle-generation recheck. leavesByPtyId is rebuilt from
  the renderer graph independently of ptysById, so a leaf can outlive its pty
  record; without the fallback a caller waiting on an already-dead pty never
  gets released.
- The chain root declared `[key: string]: unknown`, which base had nowhere. It
  leaked through the exported runtime type into every consumer, so any misspelled
  member access typechecked as unknown instead of erroring, and it accounted for
  957 of the suppressed errors. Removing it costs zero type errors.

* fix(runtime): restore escalation prose and unscoped automation publication

Two more behaviors the split dropped, each with a regression test that fails
against the pre-fix code:

- The worker-exit escalation stopped deriving its title through
  buildOrchestrationTaskDisplayMetadata and inlined `task.spec` instead. That
  ignored an explicit task_title, dropped the single-line normalization and the
  80-character bound, and turned the no-spec case into a quoted, duplicated id.
  A multi-paragraph spec landed verbatim in the coordinator's banner. The
  existing 11 tests all use short single-line specs, where the derived title and
  the raw spec are identical, so none of them could see it.
  Also reverts an added `if (!handle) return` guard: the dispatch lookup is
  deliberately keyed on the pane as well, because a reminted handle no longer
  matches the row while the pane identity outlives the remint.
- updateAutomation stopped going through automationChangePublications and
  published `source` unconditionally while gating the fallback on a non-null
  destination. A destination the store can no longer name then published only
  the stale source, so subscribers scoped elsewhere kept rendering a row that
  had left them — the exact case the helper documents. The helper had been left
  with zero callers; all three sites use it again.

* fix(skills): stop swallowing lookup errors and hard-erroring on non-ssh hosts

Follow-ups from auditing the skill install path against the refactor's base:

- resolveWorktree wrapped showManagedWorktree in `.catch(() => null)`, so a
  transient git or IO failure surfaced to the user as
  skill-install-workspace-not-found with the real cause discarded. Errors
  propagate again; a genuine id mismatch still returns null.
- resolveSkillSshTarget threw skill-install-workspace-host-unavailable when the
  execution host was neither local nor ssh, on both the repo and folder
  branches. Base gated these on connectionId, so a runtime-owned repo simply
  was not an SSH install and fell through to the local path. Both return null
  again, and the error code the split invented is now unreferenced.
- listManagedSkillInstalls awaited the receipt walk and the worktree resolve in
  sequence. They are independent and either can hit disk, WSL, or an SSH scan,
  so Promise.all is restored.

Deliberately unchanged: resolving the worktree through listResolvedWorktrees
rather than showManagedWorktree, which disambiguates a worktree id colliding
across hosts and is covered by its own test, and the SSH-folder
skill-install-ssh-dispatch-required throw, which matches the repo branch.

* fix(runtime): merge duplicate worktree-logic imports

The #17448 port added a third import from ../ipc/worktree-logic, which the
code-quality oxlint config rejects under --deny-warnings. Plain oxlint does not
flag it, so it only surfaced in CI's static analysis job.

* ci: run the ts-nocheck ratchet in PR checks

pr-workflow-lint-parity requires every leaf command in `pnpm lint` to have a
matching step in pr.yml. The ratchet was wired into lint but not the workflow,
so PR CI would not have enforced it.

* Merge remote-tracking branch 'origin/main' and retry the paired-host launch evaluate

main advanced 9 commits; none touch the orca-runtime.ts this branch splits, so
nothing needed porting.

CI failed twice on `Execution context was destroyed` thrown from
headless-paired-runtime-host's first `evaluate` after launch — a different spec
each run, which is the signature of the flake #17780 describes rather than a
regression. That commit added retryTransientMainEvaluate and adopted it in five
helpers but not this call site, even though its docblock names exactly this
case: the first evaluate after electron.launch() resolves, before the app is
ready. Wrapped it the same way.
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* fix(worktrees): preserve user workspace names across branch changes

* test(worktrees): cover pinned rename metadata

* fix(workspaces): address display-name review edge cases

* fix(workspaces): keep automatic names fresh across refreshes

* fix(workspaces): preserve legacy CLI labels

* fix(workspaces): preserve display-name provenance across hosts

* fix(workspaces): honor legacy display-name provenance

* fix(workspaces): fence display-name refresh races

* fix(workspaces): accept peer renames from provenance-less hosts

The old-host preserve fence kept a pinned local label on every refresh,
which also suppressed a legitimate rename another client persisted
through the same host until app restart. Narrow it to labels the host
re-derived itself (branch short name, or path basename when detached);
any other changed label in a mode-less response is explicit meta a peer
wrote there. Stale prior-label responses stay covered by the downstream
staleness fence, in-flight writes by the pending fence.

* refactor(workspaces): unify display-name pin derivation

Three call sites (renderer optimistic update, local IPC updateMeta
handler, remote worktree.set handler) each restated the same formula;
a future edit to one would silently skew provenance between paths.
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…tablyai#17605)

* refactor(runtime): split OrcaRuntimeService into focused modules

* test(runtime): cover admission tiers and strict worktree reconciliation

* fix(runtime): preserve owner and structured session visibility

* fix(runtime): port post-extraction compatibility fixes

* fix(runtime): preserve skill-share cancellation barrier

* test(runtime): update identity inventory after extraction

* fix(runtime): preserve hook transport environment cleanup

* fix(runtime): consolidate idle probe imports

* test(runtime): retire split file process allowlist entry

* fix(runtime): route child process types through shared boundary

* test(runtime): preserve worktree host metadata precedence

* fix(runtime): update extracted test seams

* fix(runtime): gate the split's ts-nocheck set and restore the stop-confirmed contract

Audit follow-ups for the OrcaRuntimeService split:

- Freeze the 171 @ts-nocheck files behind a ratchet so no new file can disable
  type checking. The split's linear mixin chain cannot express forward
  references yet, so the existing suppressions are grandfathered; the baseline
  may only shrink.
- Drop the stray @ts-nocheck at the end of orca-runtime-get-status.ts. It sat
  after the first statement, where TypeScript ignores it, so the module was
  already checked.
- Restore `retireRejectedPty(ptyId, stopConfirmed: boolean)` as a required
  argument. The split widened it to optional and patched the resulting error
  with `stopConfirmed === true`; an omitted argument would have silently taken
  the unverified-stop path instead of failing to compile.
- Guard that every orca-runtime-tests fragment is imported by the compatibility
  entrypoint. The fragments are .spec.ts, which no Vitest include glob matches,
  so one left out of the list would silently stop running.

* fix(runtime): restore four behaviors the OrcaRuntimeService split dropped

Audit findings against the refactor's true base (9dd3804):

- retirePtyAgentLaunchAuthority collected pane keys after deleting the
  restored-authority receipt instead of before it. collectPaneKeysForPty reads
  that receipt, so a receipt-only pane lost its key and never had its agent-hook
  compatibility authority retired. on-pty-exit.ts already carried a comment
  naming this exact invariant.
- The PTY-exit path kept orchestrationMailboxNotifications.retirePty but lost
  the loop that schedules a debounced mail-pointer repoint for the dead pty's
  terminal handle and any run bound to its panes. Restores the schedule call
  count to 7, matching base.
- subscribeToPtyExit lost isPtyKnownExited's leaf fallback and its
  post-registration lifecycle-generation recheck. leavesByPtyId is rebuilt from
  the renderer graph independently of ptysById, so a leaf can outlive its pty
  record; without the fallback a caller waiting on an already-dead pty never
  gets released.
- The chain root declared `[key: string]: unknown`, which base had nowhere. It
  leaked through the exported runtime type into every consumer, so any misspelled
  member access typechecked as unknown instead of erroring, and it accounted for
  957 of the suppressed errors. Removing it costs zero type errors.

* fix(runtime): restore escalation prose and unscoped automation publication

Two more behaviors the split dropped, each with a regression test that fails
against the pre-fix code:

- The worker-exit escalation stopped deriving its title through
  buildOrchestrationTaskDisplayMetadata and inlined `task.spec` instead. That
  ignored an explicit task_title, dropped the single-line normalization and the
  80-character bound, and turned the no-spec case into a quoted, duplicated id.
  A multi-paragraph spec landed verbatim in the coordinator's banner. The
  existing 11 tests all use short single-line specs, where the derived title and
  the raw spec are identical, so none of them could see it.
  Also reverts an added `if (!handle) return` guard: the dispatch lookup is
  deliberately keyed on the pane as well, because a reminted handle no longer
  matches the row while the pane identity outlives the remint.
- updateAutomation stopped going through automationChangePublications and
  published `source` unconditionally while gating the fallback on a non-null
  destination. A destination the store can no longer name then published only
  the stale source, so subscribers scoped elsewhere kept rendering a row that
  had left them — the exact case the helper documents. The helper had been left
  with zero callers; all three sites use it again.

* fix(skills): stop swallowing lookup errors and hard-erroring on non-ssh hosts

Follow-ups from auditing the skill install path against the refactor's base:

- resolveWorktree wrapped showManagedWorktree in `.catch(() => null)`, so a
  transient git or IO failure surfaced to the user as
  skill-install-workspace-not-found with the real cause discarded. Errors
  propagate again; a genuine id mismatch still returns null.
- resolveSkillSshTarget threw skill-install-workspace-host-unavailable when the
  execution host was neither local nor ssh, on both the repo and folder
  branches. Base gated these on connectionId, so a runtime-owned repo simply
  was not an SSH install and fell through to the local path. Both return null
  again, and the error code the split invented is now unreferenced.
- listManagedSkillInstalls awaited the receipt walk and the worktree resolve in
  sequence. They are independent and either can hit disk, WSL, or an SSH scan,
  so Promise.all is restored.

Deliberately unchanged: resolving the worktree through listResolvedWorktrees
rather than showManagedWorktree, which disambiguates a worktree id colliding
across hosts and is covered by its own test, and the SSH-folder
skill-install-ssh-dispatch-required throw, which matches the repo branch.

* fix(runtime): merge duplicate worktree-logic imports

The stablyai#17448 port added a third import from ../ipc/worktree-logic, which the
code-quality oxlint config rejects under --deny-warnings. Plain oxlint does not
flag it, so it only surfaced in CI's static analysis job.

* ci: run the ts-nocheck ratchet in PR checks

pr-workflow-lint-parity requires every leaf command in `pnpm lint` to have a
matching step in pr.yml. The ratchet was wired into lint but not the workflow,
so PR CI would not have enforced it.

* Merge remote-tracking branch 'origin/main' and retry the paired-host launch evaluate

main advanced 9 commits; none touch the orca-runtime.ts this branch splits, so
nothing needed porting.

CI failed twice on `Execution context was destroyed` thrown from
headless-paired-runtime-host's first `evaluate` after launch — a different spec
each run, which is the signature of the flake stablyai#17780 describes rather than a
regression. That commit added retryTransientMainEvaluate and adopted it in five
helpers but not this call site, even though its docblock names exactly this
case: the first evaluate after electron.launch() resolves, before the app is
ready. Wrapped it the same way.
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.

1 participant