Skip to content

fix(sidebar): a workspace rename reaches every host that publishes it - #160

Merged
nplez1 merged 2 commits into
nplez1/mainfrom
nplez1/Workspace-Rename
Oct 22, 2026
Merged

nplez1 merged 2 commits into
nplez1/mainfrom
nplez1/Workspace-Rename

Conversation

@nplez1

@nplez1 nplez1 commented Oct 22, 2026 •

Copy link
Copy Markdown
Owner

Why

A worktree id is repoId::path with no host component, so a repo registered on two execution hosts
publishes the same id twice — two sidebar rows, each with its own persisted displayName in the
host-qualified metadata store. The rename path wrote only the host whose row the user edited, so
every other host kept the old name, and a paired HUB row (one row behind two host ids) could not
rename its own server at all. Requested behaviour: renaming a workspace renames it on all hosts it
appears on, at the same time.

What

  • worktree-rename-across-hosts.ts (new) — planWorktreeRename resolves every host that
    publishes the workspace: same-id twin rows, both routes of a HUB row (hostId: ssh:x +
    runtimeOwnerEnvironmentId), and hosts that publish it only as a detected row. settleWorktreeRename
    starts every write together (the caller's full-payload write plus each other host's name-only
    write) so a host that refuses cannot strand the rest, and per-host pending-name entries exist from
    the first instant.
  • Best effort, as requested. A host that refuses keeps its own name and naming mode; its row goes
    back to it and the error names the host by the label the sidebar shows (SSH target label / host
    override / machine name). Refetching on a partial failure would undo the hosts that took the name.
    A row is only reverted while it still shows the name this attempt wrote, so a later rename or a
    refetch keeps the row it owns.
  • Only the name crosses hosts. The optimistic write gives the twin rows displayName +
    displayNameIsPinned; the rest of a mixed update (comment, links, push target) stays with the host
    the user edited, matching what is persisted.
  • use-worktree-card-activation-actions.ts — handleRenameTitle now reads the result and throws,
    so the inline editor's existing toast reports a partial rename instead of it silently reverting.
  • Two verbatim extractions (folder-workspace-meta-update.ts, refresh-hosted-review-after-meta-update.ts)
    keep update-worktree-meta.ts inside its 300-line max-lines budget (297 counted lines).
  • Scope, by decision: git worktrees only. Folder-workspace renames
    (updateFolderWorkspace) and main-side first-agent-message renames still write one host.

Verification

PR gate 1 — full unit run on the final revision:

Unit gate @d38307f35b (clean): PASS — 134245 passed; 36 failed (35 allowlisted, 0 unexpected); 1 flaky re-run passed; 0 unhandled error headline(s); 1025 s

pnpm tc clean (17,755 / 3,177 / 34 / 15,781 files). oxlint clean. check:code-quality:changed
passed. check:max-lines-ratchet, localization coverage/catalog/extraction, and the remaining
pnpm lint steps (check:readme-local-links, check:node-runtime-pin,
check:mobile-shared-dependency-versions, verify:rpc-params-catalog, verify:acp-protocol,
verify:bundled-skill-guides, verify:skill-bundle-manifest, check:process-host-imports,
check:main-sync-spawn-ratchet, check:compat-boundary-imports) pass.

pnpm lint stops at three ratchets that already fail on nplez1/main — verified by running them
in a clean detached checkout of the base:

  • check:id-only-store-write-ratchet — RepoLifecycleOperations.relocateRepoPath
    (src/main/persistence/tracking-repos/repo-update-operations.ts)
  • check:repo-host-read-ratchet — register-worktree-catalog-handlers.ts,
    runtime-repository-relocation-controller.ts
  • check:host-list-render-ratchet — src/renderer/src/components/settings/SshTargetList.tsx

Changed-file suites: pnpm test src/renderer/src/store src/renderer/src/components/sidebar —
890 files / 8,038 tests green, including 10 new tests (fan-out per host, optimistic name before any
write answers, partial failure keeps the hosts that took it and reverts only the refuser, a HUB row
written once, a host that publishes only as a detected row, an unreachable host reported, a row whose
host id lost the store dedupe, a mixed update keeping its comment local, and a non-rename update
staying host-scoped).

PR gate 2 — review: Opus 5.5 (claude/opus), high reasoning, two rounds.
Round 1 on the first commit: no BLOCKER; 5 SHOULD-FIX, 3 MINOR, 2 NIT — fan-out ordering, all
fields optimistically applied to twins, silently dropped unresolved hosts, detected-row hosts, and
the revert race. All were fixed. The delta re-check on round 2 confirmed each one RESOLVED and raised
4 new MINOR/NIT items, of which three are fixed here (a dedupe regression that hid one row's
optimistic name, pending-rename flags crossing hosts, and the preferred-host ordering); the fourth is
in the limitations list below. Final verdict: no open BLOCKER or SHOULD-FIX.

Second commit d38307f35b fixes the fork's own gate script: local/gate-unit.mjs cached its
verdict under <root>/.git/orca-gate, which is not a directory in a linked worktree, so the first
gate run computed the verdict and then threw it away with ENOTDIR. It now resolves
git rev-parse --absolute-git-dir. Tooling only — no app code, so it does not change what the review
covered.

Known limitations (not fixed here):

  • A retry after a partial failure is not possible from the inline editor: the edited host already
    holds the new name, so re-entering the same title is a no-op. Retry from the failed host's own row
    or the edit-meta dialog.
  • If the host being edited fails while the others succeed, the result is that host's own error (the
    other hosts' failures are logged, not merged into the message).
  • Two overlapping renames that both fail on the same host can leave that row showing the earlier
    rename; the next refetch corrects it.

A worktree id is `repoId::path`, so a repo registered on two execution hosts
publishes one id twice: two sidebar rows, each with its own persisted name. The
rename path wrote only the host whose row was edited, so every other host kept
the old name — and a paired HUB row, which is one row behind two host ids, could
not rename its own server at all.

A rename is now a workspace-level operation: it resolves every host that
publishes the workspace (same-id twins, both routes of a HUB row, and hosts that
publish it only as a detected row), starts all of their writes together so the
edited host cannot strand the rest, and shows the new name on every row
immediately. The other hosts receive the name alone; the rest of a mixed update
(comment, links, push target) stays with the host the user edited.

Best effort by design: a host that refuses keeps its own name and naming mode,
its row goes back to it, and the error names the host by the label the sidebar
shows. Refetching instead would have undone the hosts that did take the name. A
row is only reverted while it still shows the name this attempt wrote, so a later
rename or a refetch keeps the row it owns.

The folder-workspace branch of updateWorktreeMeta and the hosted-review refetch
move to their own modules verbatim, so the file stays inside its max-lines
budget.
A linked worktree's `.git` is a file, so `mkdir <root>/.git/orca-gate` failed
with ENOTDIR after the full suite had already run — the verdict was computed and
then thrown away. Resolve the git directory instead, which is a directory even
for a worktree, so the PR gate can be run where the work is.
@nplez1
nplez1 merged commit f758e10 into nplez1/main Oct 22, 2026
@nplez1
nplez1 deleted the nplez1/Workspace-Rename branch October 24, 2026 03:23
nplez1 added a commit that referenced this pull request Oct 24, 2026
#150)

LOCAL-PATCHES keeps the evidence for the release-tooling patch series and the known-red
sets, so the gate repairs need an entry there: which of the issue's five items had already
landed (#160's linked-worktree cache directory, #177's dirty-verdict refusal and shared
cache module, #178's judgement module and its tests), what the new fail-closed and cache
rules are, why the verdict records its gate inputs, and the coupling rule's limits.

BRANCHES gets the branch entry: why it exists, its shape, its target, and its verification
state.
nplez1 added a commit that referenced this pull request Oct 24, 2026
#150) (#179)

* fix(gate): fail the unit gate closed, and cache only what it can prove (#150)

Vitest's exit status was returned by runSuite and never read, so a non-zero exit that the
report did not explain was green. The rule is now the CI twin's (check-unit-shard-verdict):
a non-zero exit fails the gate only when neither the report nor the log explains it. The
declared-vs-read unhandled count drops '>' for '!==' for the same reason, and a step that
could not be spawned names the step instead of reading as failed.

A cached verdict now records the gate inputs it was computed against — GATE_INPUT_PATHS
plus the installed node and bun — and both readers compare them, because the machine-bound
sqlite-binding and host-toolchain classes move with a bun upgrade that HEAD never sees.
What may be reused or recorded is a decision with a reason: --no-cache forces a re-run and
still records it, --allow-dirty neither reuses nor records, forwarded selectors record
nothing, and HEAD and the tree are re-read before writing so a mid-run commit cannot become
the previous revision's verdict.

A forwarded selector's summary line now says it is not a gate-1 verdict, because it printed
the same shape as one.

The flake waiver asked only whether the test file was in the diff, so a branch that changed
src/x.ts and broke x.test.ts one run in ten waived it as 'not ours'. local/gate-flake-coupling.mjs
couples a test to itself, its sibling module, its one level of imports and the harness
sharedHarnessPaths derives from the config and the runner; a per-test row that passes in
isolation but is still refused says why.

* docs(fork): record the unit-gate repairs in LOCAL-PATCHES and BRANCHES (#150)

LOCAL-PATCHES keeps the evidence for the release-tooling patch series and the known-red
sets, so the gate repairs need an entry there: which of the issue's five items had already
landed (#160's linked-worktree cache directory, #177's dirty-verdict refusal and shared
cache module, #178's judgement module and its tests), what the new fail-closed and cache
rules are, why the verdict records its gate inputs, and the coupling rule's limits.

BRANCHES gets the branch entry: why it exists, its shape, its target, and its verification
state.
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