Skip to content

fix(sidebar): retain remote OMP rows before tab hydration - #20616

Merged
nwparker merged 10 commits into
mainfrom
nwparker/omp-remote-sidebar
Sep 19, 2026
Merged

nwparker merged 10 commits into
mainfrom
nwparker/omp-remote-sidebar

Conversation

@nwparker

@nwparker nwparker commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 12 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​788 $\color{#cf222e}{\Huge{\mathbf{−}}}$​17 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​771
Prod 12 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​312 $\color{#cf222e}{\Huge{\mathbf{−}}}$​41 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​271

When a remote OMP status arrives before its tab inventory, the worktree can show a green dot while its child row is missing until clicked. Keep SSH and paired-host rows visible using their existing workspace attribution, then remove them when the authoritative host retracts the tab—even if local hydration never occurred. Local completed-orphan suppression and host/workspace isolation remain intact.

ELI5: the sidebar can show a remote agent as soon as the host reports it, without waiting for you to click its workspace. When the host removes it, the row disappears too.

Fixes #18704.

Validation: independent sub-agent review; 249 sync/sidebar tests, renderer typecheck and full changed-code quality gate passed. A 100-workspace regression verifies one status-key enumeration per snapshot batch; parent independently reran seven attribution/retraction tests. Hidden Electron proof uses production selectors and compact rows with injected SSH/paired status and empty tab inventories, followed by retraction. The original Ubuntu pair was not reproduced; transport authority is covered by snapshot tests.

Remote OMP rows before local tab hydration

Reproduce the rendered fixture with tests/tools/omp-remote-sidebar-rendered/README.md.

@nwparker
nwparker marked this pull request as ready for review September 14, 2026 12:40
@coderabbitai

coderabbitai Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview 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

The change keeps completed remote OMP entries visible until host retraction while hiding local completed orphans. It adds environment- and worktree-specific mirrored-tab mapping and retraction. It scopes cleanup to host-owned panes during collisions. Unit tests and a hidden Electron fixture cover attribution, isolation, hydration, rendering, and empty-state behavior.

Priority: ➖ Normal

Merge Risk: 🟡 Moderate · up to 7c1f9

Mixed retraction batches can leave stale terminal and agent state behind. Scope collision handling per tab before merging.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 21 functions across 14 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the primary change: retaining remote OMP sidebar rows before tab hydration.
Description check ✅ Passed The description explains the problem, solution, rationale, linked issue, visual behavior, and validation. It is mostly complete, although it does not include the template's explicit Review, Notes, Age…
Linked Issues check ✅ Passed The changes satisfy the coding requirements in [#18704]. buildMirroredAgentStatusPatch preserves remote status attribution and hydrates rows without a local tab join. `collectCollidingRetractionPane…
Out of Scope Changes check ✅ Passed The changed source files implement mirrored status attribution, host-scoped retraction, and worktree isolation for [#18704]. The added unit, renderer, and Electron fixture tests validate these behavio…
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • 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: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 87b3ce3f-133f-4b46-9ca4-72640dd05321

📥 Commits

Reviewing files that changed from the base of the PR and between b87a6c0 and d4eea46.

📒 Files selected for processing (13)
  • src/renderer/src/components/sidebar/worktree-agent-live-index-patch.ts
  • src/renderer/src/components/sidebar/worktree-agent-remote-attribution.test.ts
  • src/renderer/src/runtime/web-session-tabs-sync/agent-status-primitives.ts
  • src/renderer/src/runtime/web-session-tabs-sync/apply-final-patch.ts
  • src/renderer/src/runtime/web-session-tabs-sync/apply-preparation-base.ts
  • src/renderer/src/runtime/web-session-tabs-sync/mirrored-status-tab-retractions.test.ts
  • src/renderer/src/runtime/web-session-tabs-sync/mirrored-status-tab-retractions.ts
  • src/renderer/src/runtime/web-session-tabs-sync/tracking-mappings.ts
  • tests/tools/omp-remote-sidebar-rendered/README.md
  • tests/tools/omp-remote-sidebar-rendered/fixture.css
  • tests/tools/omp-remote-sidebar-rendered/fixture.tsx
  • tests/tools/omp-remote-sidebar-rendered/index.html
  • tests/tools/omp-remote-sidebar-rendered/run.mjs
💤 Files with no reviewable changes (1)
  • src/renderer/src/runtime/web-session-tabs-sync/apply-final-patch.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 4 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 — minor suggestions on the retraction surface, inline.

Reviewed changes

  • Remote row retention — liveEntryWorktreeId now keeps done rows whose entry carries a connectionId or whose pane key uses a web-terminal-* tab id, so paired/SSH OMP rows render before their tab hydrates; the live-index patch bail-out also watches connectionId presence.
  • Host-tab retraction — new collectUnhydratedMirroredTabRetractions sweeps a mirrored row whose host stopped publishing even when tabsByWorktree never held its tab, driven by the previous snapshot's host mapping; buildRetractedMirroredTabSweepPatch no longer receives a worktree id.
  • Tests — attribution/retraction/host-isolation coverage, a 100-workspace single-enumeration regression, and a hidden Electron rendered fixture. Verified 7/7 pass, and reverting only the liveEntryWorktreeId predicate fails 3 of them — the regression tests are real.

ℹ️ Retraction still depends on a host mapping that other lifecycle events clear

collectUnhydratedMirroredTabRetractions derives its candidates from hostSessionTabIdsByLocalTabForWorktree, which updateHostSessionTabIdMappings clears and rebuilds on every snapshot apply, and which clearWebSessionTabsTrackingForWorktree / clearWebSessionTabsTrackingForEnvironment delete outright. Because the collect runs in the base stage before the unified stage rebuilds the mapping, an ordinary in-worktree retraction sees the previous mapping and works. The gap is states where a mapping is cleared with no in-worktree snapshot to rebuild it afterwards, leaving the row relying on entry.worktreeId with no remaining retraction trigger.

Technical details
# Retraction depends on a mapping that tracking teardown clears

## Affected sites
- `src/renderer/src/runtime/web-session-tabs-sync/mirrored-status-tab-retractions.ts:17-28` — candidates require an entry in `hostSessionTabIdsByLocalTabForWorktree`.
- `src/renderer/src/runtime/web-session-tabs-sync/tracking-lifecycle.ts:145` — `clearHostSessionTabIdMappings` on worktree removal / visibility tombstone; `:207-216` clears an entire environment.
- `src/renderer/src/runtime/web-session-tabs-sync/apply-preparation-base.ts:193` and `apply-final-patch.ts:63` — the tombstone frame skips both retraction branches by design.
- `src/renderer/src/runtime/web-session-tabs-sync/agent-status-patch.ts:164` — mirrored non-client-owned rows are deleted on the tombstone; client-owned rows (`isClientAuthoritativeAgentStatusPane`) are exempt and survive.
- `src/renderer/src/components/sidebar/worktree-agent-live-index-patch.ts:34` — the row then renders because it is "remote".

## Required outcome
- Either guarantee that a remote `done` row which outlives its host mapping is still retractable (or bounded), or make the "remove them when the authoritative host retracts the tab — even if local hydration never occurred" claim match what the code does.

## Open questions for the human
- Is the tombstone an intentional retention boundary (row should survive a visibility removal and re-render when the worktree returns), or should a client-owned mirrored row be reaped once its host mapping is gone?

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

}
const tabWorktreeId = tabIdToWorktreeId.get(parsed.tabId)
return tabWorktreeId ?? (entry.state === 'done' ? undefined : entry.worktreeId)
const remote = Boolean(entry.connectionId) || isWebTerminalSurfaceTabId(parsed.tabId)

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.

This predicate keeps a done row visible for any truthy connectionId, but collectUnhydratedMirroredTabRetractions only retracts web-terminal-* tab ids that appear in hostSessionTabIdsByLocalTabForWorktree.

Technical details
# Render predicate is broader than the retraction surface

## Affected sites
- `src/renderer/src/components/sidebar/worktree-agent-live-index-patch.ts:34` — `remote = Boolean(entry.connectionId) || isWebTerminalSurfaceTabId(parsed.tabId)`.
- `src/renderer/src/runtime/web-session-tabs-sync/mirrored-status-tab-retractions.ts:21-25` — candidate filter requires `isWebTerminalSurfaceTabId(tabId)` AND a host mapping; a truthy `connectionId` alone never qualifies.
- `src/renderer/src/hooks/ipc-events/agent-status-event-applicator.ts:84-95` — runtime-backed attribution (`hasRuntimeBackedWorktreeAttribution`) can mint a remote entry with a `worktreeId` while its tab is absent, and `routing.connectionId` is set from the hook (`:240`).

## Required outcome
- Every `done` row the new predicate keeps visible should have a reachable retraction, or the predicate should be narrowed to the ids the retraction covers.

## Open question for the human
- For a paired host, do hook statuses arrive keyed by a raw host tab id (non-`web-terminal-`) in every code path, or are they always re-keyed through the mirrored surface? If any path produces the former, those rows are now rendered with no retraction here.

// cutoffs means a republished pane cannot replay activity the user cleared on this client.
const sweep = buildRetiredTerminalTabStateSweepPatch(sweepState, retractedTabIds, worktreeId, {
// The host retracts exact tab ids; a worktree-wide orphan sweep could erase a sibling host.
const sweep = buildRetiredTerminalTabStateSweepPatch(sweepState, retractedTabIds, undefined, {

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.

Passing undefined here disables findCompletedOrphanPaneKeysForTabClose's worktree-wide branch, which sweepRetiredTerminalTabState documents as the Pi stranded-completed-row cleanup (retired-terminal-tab-state-sweep.ts:42). The new collect only covers mapped web-terminal-* ids, so a non-mirrored completed orphan dropped by a paired apply is no longer swept on this path.

Technical details
# Worktree-wide completed-orphan sweep is now dead on the paired retraction path

## Affected sites
- `src/renderer/src/runtime/web-session-tabs-sync/agent-status-primitives.ts:187` — `buildRetiredTerminalTabStateSweepPatch(sweepState, retractedTabIds, undefined, ...)`.
- `src/renderer/src/store/slices/retired-terminal-tab-state-sweep.ts:78` — `worktreeId` is only forwarded when truthy.
- `src/renderer/src/store/slices/agent-status-pane-key-tab-binding.ts:74-76` — `findCompletedOrphanPaneKeysForTabClose` returns `[]` without a worktree id.
- Only remaining worktree-id caller is the explicit local close (`src/renderer/src/store/terminals/terminal-tab-close.ts:250`).

## Required outcome
- Confirm the dropped cleanup is intentional and that removed tabs cover the client-owned/provisional rows the worktree sweep used to catch.

## Note
- No test exercises completed-orphan removal through the retraction path, so this change is not pinned either way.

@nwparker

Copy link
Copy Markdown
Contributor Author

Risk-reduction review at d4eea462cdf869d361a26d31b3618bb620146806: Hold — known defect.

Two new failing production-snapshot tests: retracting host A deletes live host B status when tab IDs collide, even with distinct leaves/workspaces. Existing 7 tests pass.

Remaining user-facing consequence: An active remote agent can disappear from status/sidebar. Needs host-scoped retraction, not another reader cache.

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

Caution

The new host-identity guard disables the remote-tab retraction this PR exists to add, and leaves the PR's own worktree-agent-remote-attribution.test.ts red (3 of 6 tests fail). Detail inline.

Reviewed changes

  • Host-identity scoping — collectUnhydratedMirroredTabRetractions now retracts a candidate only when entry.connectionId === environmentId (or, for a local nullish connectionId, environmentId === 'local').
  • Tests — added a connectionId: 'host' stamp to the 100-workspace enumeration fixture and a new does not retract a colliding tab id owned by another host case.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (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: Advanced

Run ID: 33decdd5-6a4d-421f-83d6-b0fb81ea84c9

📥 Commits

Reviewing files that changed from the base of the PR and between 2049a1b and 597b781.

📒 Files selected for processing (4)
  • src/renderer/src/components/sidebar/worktree-agent-remote-attribution.test.ts
  • src/renderer/src/runtime/web-session-tabs-sync/agent-status-patch.ts
  • src/renderer/src/runtime/web-session-tabs-sync/apply-final-patch.ts
  • tests/e2e/omp-risk-remote-review.unit.test.ts

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

it.each(['folder:same','folder:other'])('does not erase a different environment sharing a host tab ID (%s)',otherWorktree=>{
const initial=makeState();const a=applyWebSessionTabsSnapshot(initial,snapshot('folder:same',LEAF_ID),'host-a',NOW);const b=applyWebSessionTabsSnapshot(initial,snapshot(otherWorktree,SECOND_LEAF_ID),'host-b',NOW);
const state=makeState({agentStatusByPaneKey:{...a.agentStatusByPaneKey,...b.agentStatusByPaneKey}});
setHostSessionTabIdMapping({environmentId:'host-b',worktreeId:'folder:same',tabId:'same-host-tab'},'same-host-tab');

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

Use the host B snapshot worktree for the mapping.

When otherWorktree is "folder:other", this mapping records host B under "folder:same" while its status belongs to "folder:other". The regression case then does not exercise the real cross-workspace mapping and retraction path. Replace the fixed value with otherWorktree.

Proposed fix
- setHostSessionTabIdMapping({environmentId:'host-b',worktreeId:'folder:same',tabId:'same-host-tab'},'same-host-tab');
+ setHostSessionTabIdMapping({environmentId:'host-b',worktreeId:otherWorktree,tabId:'same-host-tab'},'same-host-tab');
📝 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
setHostSessionTabIdMapping({environmentId:'host-b',worktreeId:'folder:same',tabId:'same-host-tab'},'same-host-tab');
setHostSessionTabIdMapping({environmentId:'host-b',worktreeId:otherWorktree,tabId:'same-host-tab'},'same-host-tab');

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

Caution

The isolation test added in 597b781 (tests/e2e/omp-risk-remote-review.unit.test.ts) fails on this commit — both cases. The mirrored retraction sweep deletes every row under the retracted tab id, so host-a's retraction still erases host-b's row; the collect guard only gates which tab ids are collected. The connectionId stamp also drops palette agent metadata for mirrored tabs. Details inline.

Reviewed changes

  • Host identity on mirrored statuses — buildMirroredAgentStatusPatch now stamps connectionId: environmentId when a remapped host entry has none, so collectUnhydratedMirroredTabRetractions's guard matches and the paired retraction fires; the prior review's failing attribution/retraction tests pass again.
  • Retraction sweep scoping — buildRetractedMirroredTabSweepPatch drops its worktree-id parameter and always passes undefined, with a comment that a worktree-wide orphan sweep could erase a sibling host.
  • Isolation test — new tests/e2e/omp-risk-remote-review.unit.test.ts asserts two environments sharing a mirrored host tab id stay isolated.

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

nextByPaneKey.get(hostEntry.paneKey) ?? state.agentStatusByPaneKey[hostEntry.paneKey]
const entry = withMirroredEvidenceReceipt(hostEntry, existing, now)
const entry = withMirroredEvidenceReceipt(
hostEntry.connectionId === undefined ? { ...hostEntry, connectionId: environmentId } : hostEntry,

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.

Stamping the environment id here is read as an SSH host alias by an existing reader this PR does not touch: collectAgentMetadataFromIndex (lib/workspace-tab-agent-metadata.ts:289-291) calls isExecutionHostAliasForWorktree(toSshExecutionHostId(entry.connectionId), worktree), and toSshExecutionHostId(environmentId) can never equal a mirrored worktree's runtime:<env> host. Mirrored terminal tabs that previously qualified (undefined connectionId, non-ambiguous worktree) now drop their agent metadata in the Cmd+J palette.

Technical details
# `connectionId` stamp changes palette agent-metadata inclusion

## Affected sites
- `src/renderer/src/runtime/web-session-tabs-sync/agent-status-patch.ts:104-108` — the new stamp.
- `src/renderer/src/lib/workspace-tab-agent-metadata.ts:289-291` — reader compares `toSshExecutionHostId(connectionId)` against the worktree host.
- `src/renderer/src/lib/worktree-execution-host-alias.ts:12-16` and `src/shared/execution-host.ts:53-57` — `ssh:<env>` never equals `runtime:<env>` or `ssh:<target>`.
- `src/renderer/src/lib/workspace-tab-palette-entry-builder.ts:248-253` — feeds the mirrored terminal tab's `entityId` into that reader.

## Required outcome
- Mirror rows keep their agent metadata in the palette: either carry the environment id in a runtime-host field readers already understand, or make `collectAgentMetadataFromIndex` runtime-aware (`toRuntimeExecutionHostId`).

## Note
- `workspace-tab-agent-metadata.ts` is not in this PR's changed set, so no test pins the transition.

@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: 2834ede7-b1c3-4132-b8a3-d10ca4d26560

📥 Commits

Reviewing files that changed from the base of the PR and between de9b95a and 7c1f928.

📒 Files selected for processing (6)
  • src/renderer/src/runtime/web-session-tabs-sync/agent-status-patch.ts
  • src/renderer/src/runtime/web-session-tabs-sync/agent-status-primitives.ts
  • src/renderer/src/runtime/web-session-tabs-sync/apply-final-patch.ts
  • src/renderer/src/store/slices/agent-status-drop-reducer.ts
  • src/renderer/src/store/slices/retired-terminal-tab-state-sweep.ts
  • tests/e2e/omp-risk-remote-review.unit.test.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 new issues in the delta — the owner-blind retraction sweep is fixed and the isolation test is green. One residual on the collision detector's input set, inline.

Reviewed changes

  • Collision-scoped retraction — collectCollidingRetractionPaneKeys detects a pane under a retracted tab that this environment/worktree does not own, then scopes the sweep to the owned pane keys via a new paneKeys option threaded through buildRetiredTerminalTabStateSweepPatch and buildAgentStatusTabPrefixDropPatch.
  • Mirror delete guard — buildMirroredAgentStatusPatch now takes environmentId/worktreeId/retractedTabIds, skips panes this environment does not own, and defers retracted tabs so the retirement sweep can see the live row.
  • Tests — tests/e2e/omp-risk-remote-review.unit.test.ts expanded to 16 host/worktree/hydration/batch permutations; the two prior failures now pass, and pnpm tc:web plus the sync/sidebar suites (2806 tests) are green.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (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 found.

Reviewed changes

Reviewed the delta since the prior pullfrog review at 7c1f928 — the collision detector's input set, per-tab sweep scoping, and batch indexing.

  • Collision detector covers every swept map — collectCollidingRetractionPaneKeys moved to retraction-pane-ownership.ts, now returns a per-tab Map<tabId, owned pane keys>, and scans acknowledgedAgentsByPaneKey, agentLaunchConfigByPaneKey, paneForegroundAgentByPaneKey, and migrationUnsupportedByPtyId in addition to status/retained entries, so an auxiliary-only foreign pane forces the scoped sweep.
  • Per-tab retraction sweep — buildRetractedMirroredTabSweepPatch takes scopedPaneKeysByTabId and sweeps each retracted tab independently, scoping only the colliding tab instead of applying the scope to every tab in the frame.
  • Batch memoization — WebSessionTabsBatchContext.retractionPaneKeysByRecord indexes each auxiliary record once per batch and refreshes on record replacement.
  • Tests — new retraction-pane-ownership.test.ts (mirrored/local collision scoping, single enumeration + replacement) and a foreign-auxiliary-without-status-row matrix in omp-risk-remote-review.unit.test.ts; 35 focused tests pass locally.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (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 the delta — one non-blocking observation on the shared helper's blast radius.

Reviewed changes

Reviewed the delta since the prior pullfrog review at 8dbc1a8 — remote workspace attribution now survives tab hydration.

  • Host attribution wins after hydration — resolveAgentStatusWorktreeId now accepts connectionId and returns entry.worktreeId for remote entries (truthy connectionId or a web-terminal-* tab id), so a mirrored tab id that collides with another workspace's tab cannot re-bucket the row once its tab appears in the index.
  • Live-index delegates — liveEntryWorktreeId routes remote entries through that helper instead of a raw tabIdToWorktreeId.get(tabId); the local completed-orphan rule is unchanged.
  • Tests — new worktree-agent-host-attribution.test.ts (four states × full-rebuild and patch paths) plus two helper cases; 9/9 pass, and reverting the early return fails 6 of them.

ℹ️ The shared helper change also moves the worktree activity dot

resolveAgentStatusWorktreeId is not sidebar-only: worktree-activity-state.ts:51 (the worktree dot) and worktree-agent-activity-summary.ts:117 now also prefer a remote entry's worktreeId over the tab-index mapping. That is a reasonable extension of the same fix, but the new tests pin only the sidebar row selector and the helper itself, so the dot/summary callers have no remote-collision coverage.

Technical details
# Shared attribution precedence changed for callers outside the PR's file set

## Affected sites
- `src/renderer/src/lib/agent-status-worktree-attribution.ts:31-36` — the new remote early return.
- `src/renderer/src/lib/worktree-activity-state.ts:51` — `getLiveAgentStatusByWorktreeId` now attributes remote entries by `entry.worktreeId`.
- `src/renderer/src/components/sidebar/worktree-agent-activity-summary.ts:117` — same helper, feeds the per-worktree activity summary.

## Required outcome
- Confirm the dot/summary behavior change is intended; if so no code change is needed. If those surfaces must keep the tab-index precedence, the early return needs to be parameterized rather than baked into the shared resolver.

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

@nwparker
nwparker merged commit ef03188 into main Sep 19, 2026
33 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.

fix(sidebar): active OMP child tab missing beneath worktree until worktree is activated

1 participant