Skip to content

fix(workspaces): re-seed a gate-reported empty workspace after an agent selection - #20182

Merged
brennanb2025 merged 5 commits into
mainfrom
brennanb2025/fix-gated-empty-reseed-agent-suppression
Sep 14, 2026
Merged

brennanb2025 merged 5 commits into
mainfrom
brennanb2025/fix-gated-empty-reseed-agent-suppression

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​121 $\color{#cf222e}{\Huge{\mathbf{−}}}$​4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​117
Prod 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​61 $\color{#cf222e}{\Huge{\mathbf{−}}}$​22 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​39

ELI5

Creating a workspace with an agent used to leave it with an empty tab bar when the agent's surface failed to appear. The safety net that normally drops a shell in an empty workspace had been switched off for agent selections. This turns that net back on, while keeping the fix that stopped a stray "Terminal 1" appearing next to every agent.

What Changed

activationProvidesInitialSurface (added in #19940) answers "is a surface coming?" — true for any agent != null. That one value was being used for two different questions in worktree-activation.ts:

  1. Create-time seeding skip — don't seed a shell now, an agent surface is on its way. This is fix(workspaces): seed shells only for blank selection #19940's intent and is unchanged.
  2. Async activation-gate empty-outcome re-seed — this was the bug.

Added gatedEmptyOutcomeReseedSuppressed in worktree-activation-surface-selection.ts, deliberately narrower: only an explicit providesInitialSurface caller promise suppresses the re-seed. Both gate callbacks (git worktree at :253, folder workspace at :154) now use it. The two predicates sit adjacent with comments explaining why they must not be re-unified, and reseedGatedEmptyWorkspace's doc records the contract.

Net source change: 3 lines (1 import + 2 call sites), plus comments.

Why

gateWorktreeAgentActivation returns 'empty' only after PTY adoption, structured-session inventory, and sleeping-session resume have all produced nothing — the gate's own comment calls it "this gate produced no surface, seed one." It is positive evidence that no surface materialised, not a "couldn't tell" (that's 'blocked', which never re-seeds).

So an agent selection and a gate-reported empty are different facts. The selection is a request; empty is the report that the request produced nothing — a dead PTY, an unreadable PTY census, or a null startup plan. Suppressing the fail-closed re-seed (STA-5701) on that report is what left the workspace with zero tabs. Nothing else recovers it: ensureWebRuntimeWorktreeTerminalAfterWake returns early at web-runtime-worktree-terminal-after-wake.ts:39 when no web-runtime session is active, so for a plain local workspace it is a no-op.

Reachable from worktree-creation-flow-execute.ts:170 and full-creation-execution.ts:220, which pass agent with no explicit providesInitialSurface; when the backend already spawned the startup terminal there is no startup/setup/defaultTabs/issueCommand, so hasActivationWork is false and the gate runs.

Why only the agent half, rather than ignoring the predicate entirely: pre-#19940 this path passed opts?.providesInitialSurface, so honouring the explicit promise is exactly v1.4.200's shipped behaviour. Dropping that half too would change behaviour v1.4.200 shipped and no bug report covers, and would mean editing forwards providesInitialSurface=%s through the async activation gate — an assertion that predates #19940 and encodes the editor/diff-caller intent. This fix edits no existing assertion. That also keeps it cherry-pickable.

Linked Issue

Regression from #19940 (2ffac471bd), which is not in v1.4.200 (git merge-base --is-ancestor 2ffac471bd v1.4.200 fails), so this ships new.

Fixes #

Visual Proof

N/A — no rendering change. The observable difference is tab count in a failure path that needs a dead agent PTY to reproduce; it is covered by the unit tests below rather than a screenshot.

Testing

Which existing assertion changed: none

The ['an agent', 'codex' as const, 0] cases in worktree-activation-emptied-workspace-reseed.test.ts (:37, :256) were the suspected pin. They are not pinning the defect — they exercise the create-time path, not the gate. In both, canInspectAgentActivationInventory() is false (no window.api stub) and there are no sleeping sessions, so shouldGateAgentActivation is false and the gate is never entered. Expecting 0 tabs there is #19940's legitimate no-stray-shell behaviour, so they are kept as-is and still pass. No assertion anywhere pinned the gate+agent path — it simply had no coverage, which is how the regression landed.

Checked #19940's siblings for the same pin: worktree-activation-empty-remote.test.ts, worktree-creation-agent-seeding.test.ts, worktree-activation-web-runtime.test.ts, worktree-activation-surface-caller-wiring.test.ts. None assert the gate+agent outcome; worktree-creation-agent-seeding.test.ts:75 only asserts the agent option is forwarded. gateWorktreeAgentActivation is referenced by only one other test file (app-startup-routing.test.ts, source-text assertions). No sibling needed a change.

New coverage

Four cases added, pinning both sides of the split on both activation entry points — the folder-workspace twin goes through activateAndRevealFolderWorkspace, not setActiveWorktree(folderWorkspaceKey(id)), which never reaches the folder path:

entry point selection expected
activateAndRevealWorktree { agent: 'codex' } re-seeds (1 tab)
activateAndRevealWorktree { agent: 'codex', providesInitialSurface: true } stays empty (0 tabs)
activateAndRevealFolderWorkspace { agent: 'codex' } re-seeds (1 tab)
activateAndRevealFolderWorkspace { agent: 'codex', providesInitialSurface: true } stays empty (0 tabs)

The providesInitialSurface: true rows guard against over-broadening the fix into ignoring the caller promise.

Ablation (measured)

Both source files reverted to origin/main with the new tests kept — not a one-lever arm:

  • Pre-fix (all 3 source files at origin/main, new tests kept): 2 failed | 22 passed. The two failures are exactly the agent-selection rows: expected [] to have a length of 1 but got +0 at :109 (git) and :370 (folder). The two providesInitialSurface: true rows pass on both arms, as intended — they pin the half deliberately preserved.
  • Post-fix: 24 passed in that file; 50 passed across it plus all four fix(workspaces): seed shells only for blank selection #19940 sibling test files; 223 passed / 27 files across the whole activation + worktree-creation suite plus app-startup-routing.test.ts.
  • The restored files are byte-identical to the measured arm (verified by shasum), and the pre-commit hook changed nothing, so the ablation holds at this head.

Create-time behaviour still pinned

Confirmed — seeds a default shell for %s selection only (both the git and folder copies, including the agent → 0 tabs rows) is untouched and green, so this cannot silently reintroduce #19940's stray "Terminal 1".

Gates

  • oxlint on all 4 changed files: exit 0, zero errors, zero warnings. No max-lines disable added (largest file 349 lines, cap 400 with blanks/comments skipped).

  • tsc --noEmit run sequentially on config/tsconfig.tc.web.json, config/tsconfig.node.json, config/tsconfig.tc.cli.json: all exit 0, no output.

  • oxfmt reports no changes.

  • NUL-byte scan on all 4 changed files: clean.

  • pnpm-lock.yaml restored to origin/main and excluded from the commit.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

AI Disclosure

Review

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Cross-platform: no platform-dependent code; renderer-only predicate change, no paths, shells, or shortcuts.
  • Remote SSH: the re-seed's existing guards are unchanged — a runtime-owned workspace with a live host still returns early from ensureWorktreeHasInitialTerminal because the host owns terminal creation, so this does not seed into an SSH/runtime host's gap. The folder-workspace tests cover an SSH-host row sharing one tabsByWorktree key.
  • Backwards compatibility: no wire, IPC, or persisted-schema change.
  • Performance: one extra boolean read per gated activation.
  • Cherry-pickable: 4 files, renderer-only, no dependency on anything merged after fix(workspaces): seed shells only for blank selection #19940.

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

…nt selection

#19940 routed two different questions through one predicate. An agent selection
justifies skipping the *pre-emptive* shell at create time, but it was also
suppressing the async activation gate's fail-closed re-seed. The gate returns
`empty` only after adoption, structured inventory and resume all produced
nothing, so it is positive evidence the agent surface never arrived (dead PTY,
unreadable census, null startup plan) — exactly when the re-seed is needed.

Suppressing it there left the workspace with zero tabs and no recovery:
ensureWebRuntimeWorktreeTerminalAfterWake returns early for a plain local
workspace, so nothing else seeds one.

`gatedEmptyOutcomeReseedSuppressed` now answers the re-seed question on its own,
honouring only an explicit `providesInitialSurface` caller promise — restoring
v1.4.200's behaviour for that path. The create-time skip keeps using the
agent-inclusive `activationProvidesInitialSurface` unchanged.
@coderabbitai

coderabbitai Bot commented Sep 12, 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 makes gated empty-workspace reseeding accept explicit caller-surface and execution-host values. Folder and worktree activation pass these values to the gate. Reseeding skips caller-provided surfaces, inactive workspaces, and mismatched execution hosts. Tests cover surface selection, pending activation replacement, recovery races, and local and SSH workspace state.

Priority: ➖ Normal

Merge Risk: 🟡 Moderate · up to 2504c

Rapidly switching a workspace between local and SSH activation can leave the workspace with an incorrect terminal surface or no terminal surface. The gate result must remain bound to the host that produced it before merge.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 18.75% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 16 functions across 10 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 identifies the primary fix: re-seeding a gate-reported empty workspace after an agent selection. It is concise and specific.
Description check ✅ Passed The description is detailed and covers the required change, rationale, testing, visual-proof status, compatibility considerations, and checklist. The required Linked Issue field is incomplete because …
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.
  • Fix all pre-merge checks with AI
✨ 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.

@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

  • Split the gate's re-seed predicate from the create-time promise — new gatedEmptyOutcomeReseedSuppressed (worktree-activation-surface-selection.ts:47) returns true only for an explicit providesInitialSurface, so an agent selection no longer suppresses the fail-closed re-seed after the async gate reports empty.
  • Both activation entry points use it — the folder callback (worktree-activation.ts:154) and the git callback (:253) now pass the narrower predicate instead of activationProvidesInitialSurface. Create-time seeding (#19940) is untouched, so no stray "Terminal 1" beside a live agent.
  • Contract recorded in docs — reseedGatedEmptyWorkspace's doc (worktree-initial-terminal-seeding.ts:38) tells callers to derive the flag from the new predicate, never from an agent selection.
  • Four new cases pin both sides on both paths — agent selection re-seeds (1 tab); agent + providesInitialSurface stays empty (0 tabs), for both activateAndRevealWorktree and activateAndRevealFolderWorkspace.

I verified the split is real and the coverage bites: the new test file passes at head (24 tests), and reverting only the two call sites to providesInitialSurface fails exactly the two agent-selection rows (:109, :370) while the providesInitialSurface: true rows stay green — matching the PR's ablation. pnpm tc:web and oxlint on all four files are clean, and the sibling activation suites (37 tests) pass.

The one deliberate asymmetry is sound: an explicit providesInitialSurface still suppresses the gate re-seed because those callers (editor/diff/structured chat) own their surface, while empty is positive evidence that an agent surface never materialized.

Pullfrog  | View workflow run | Using openrouter/deepseek/deepseek-v4.1-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

  • Reframed the gate re-seed predicate as an explicit policy — gatedEmptyOutcomeReseedSuppressed becomes gatedEmptyWorkspaceReseedPolicy, returning 'reseed' | 'caller-provides-surface' (worktree-activation-surface-selection.ts:44). The folder (worktree-activation.ts:153) and git (:252) callbacks now gate on === 'reseed' and call reseedGatedEmptyWorkspace(key, false). Behavior is unchanged from the previous commit: an explicit providesInitialSurface still suppresses, an agent selection no longer does.
  • Added SSH-host coverage to the folder re-seed case — the folder matrix now parameterizes executionHostId, including an SSH_HOST_ID row that asserts the re-seeded tab resolves to the host's conn-1 connection via getRemoteConnectionIdForWorktree.
  • Trimmed comments and dropped the doc-only edit — the worktree-initial-terminal-seeding.ts JSDoc change is no longer part of the PR, so the diff is back to 3 files.

I re-ran the file at head (25 passed) and ablated the policy back to treating an agent as 'caller-provides-surface': exactly the three agent rows fail (:107, :376 local and SSH), while the providesInitialSurface rows stay green. pnpm tc:web and oxlint on the three files are clean.

Pullfrog  | Fix it ➔ | View workflow run | Using openrouter/deepseek/deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Electron QA completed on the rendered app, including a current-origin/main comparison. All images below are uncropped 1728×994 full-window CDP screenshots.

One limitation up front: I could not complete the full New Workspace modal flow under the required hidden-window launch. Both clicking New workspace through Playwright and calling the real openModal('new-workspace-composer') store action made the hidden renderer stop responding. I therefore exercised the equivalent real launch/store boundaries and am explicitly treating the picker-to-Create interaction itself as unverified.

Empty-prompt Codex path: current origin/main vs this PR

In both builds, with chat-by-default off, the live launch planner resolved an empty Codex prompt to terminal-tui and the real startup-plan builder returned null. I created a local Git workspace with createdWithAgent="codex", called the real activateAndRevealWorktree path, and observed the real activation gate return empty.

  • Current origin/main (556a7772ed): began with zero terminal/unified/renderable tabs and ended with zero; the active workspace had a visibly empty tab strip, no error toast, and zero console errors.
  • PR branch (10a21ab307): began with zero tabs and ended with exactly one terminal tab, one unified contentType="terminal" tab, and renderableTabCount=1.

origin/main — zero tabs after empty:

origin/main zero tabs

PR — one recovery shell after the same empty outcome:

PR one recovery shell

Normal Codex launch regression check

At the real launch/store boundary on the PR build, a non-empty prompt produced a non-null Codex startup plan on the terminal-tui route. The backend reported startupTerminal.spawned=true / surface="visible"; the live model contained exactly one renderable terminal with launchAgent="codex" and no extra shell tab. The real Codex process received the prompt and visibly returned QA_READY.

normal Codex launch

Remaining gap: selecting Codex, typing the prompt, and pressing Create were not driven through the stalled full composer.

Blank Terminal (agent === null)

Store-level trigger through the real activation path: the gate returned empty, and the workspace went from no terminal/unified tabs to exactly one real-PTY terminal, one unified terminal, and renderableTabCount=1.

Blank Terminal seeds one shell

Remaining gap: the Blank Terminal picker row itself was not clicked because the full composer could not be opened reliably.

Folder workspace

The plain directory was registered through project setup-existing-folder --kind folder, then exercised through the distinct real activateAndRevealFolderWorkspace entry point with agent="codex". This was a store-level trigger; the gate returned empty, and the final model had exactly one real-PTY terminal, one unified terminal, and renderableTabCount=1.

folder workspace reseeded after empty

The rendered state and backing tab model agree for the main-vs-PR fix comparison, the normal real Codex startup, Blank Terminal, and the folder activation path. The only unresolved coverage is end-to-end interaction through the full New Workspace modal under hidden-background Electron validation.

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

Reviewed changes

This run re-reviewed commit 278e5ed3 ("harden gated empty reseeding"), the delta since pullfrog's previous review at 5f01512c.

  • Replaced the policy predicate with per-gate intent tracking — gateAndReseedEmptyWorkspace records { callerProvidesSurface, executionHostId } in a WeakMap keyed by the in-flight gate promise, so concurrent activations that share one gate resolve the empty outcome with the newest caller's intent only.
  • Added a stale-host guard to the re-seed — reseedGatedEmptyWorkspace now takes executionHostId and skips when the active workspace host no longer matches, so a gate settling after the user switched hosts cannot seed into the wrong one.
  • Made active-folder connection resolution host-aware — getFolderWorkspaceConnectionId accepts an explicit host, and getConnectionIdFromState, the retained file selector, worktreeUsesWslPath, worktreeUsesRemoteConnection, and getRemoteConnectionIdForWorktree all thread the active workspace host through.
  • Expanded coverage — folder rows for local + SSH and duplicate-id routing, plus gate-supersession and no-double-seed cases.

I re-ran the three affected suites (56 passed), pnpm tc:web (clean), and audited the host-routing and async-supersession paths independently; both found the new logic consistent.

ℹ️ The PR description still describes the pre-hardening change

The body says "Net source change: 3 lines (1 import + 2 call sites)", "Cherry-pickable: 4 files", and "Which existing assertion changed: none", and the removed test comment called the host-blind resolution defect out of scope. At 278e5ed3 the PR is 10 files and changes how every active folder workspace resolves its connection. A reviewer or merger reading the description would badly underestimate the blast radius.

Technical details
# Update the PR description for the hardening commit

## Affected sites
- PR body `## What Changed` — still claims "Net source change: 3 lines (1 import + 2 call sites)".
- PR body `## Notes` — still claims "Cherry-pickable: 4 files, renderer-only".
- PR body `## Testing` — the "Which existing assertion changed: none" section and the ablation numbers predate `278e5ed3`.
- `worktree-activation-emptied-workspace-reseed.test.ts` — the removed comment that declared the host-blind connection defect out of scope is gone because the commit fixes it.

## Required outcome
- The description should describe the current 10-file change: the per-gate intent supersession, the stale-host re-seed guard, and the host-aware folder connection resolution.
- Call out the blast radius: while a folder workspace is active, its file/terminal connection resolution now depends on `activeWorkspaceExecutionHostId`, not just the workspace row.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using openrouter/deepseek/deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

if (
callerProvidesSurface === true ||
state.activeWorktreeId !== workspaceKey ||
(executionHostId !== undefined && state.activeWorkspaceExecutionHostId !== executionHostId)

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 new executionHostId guard has no coverage: every folder re-seed test sets activeWorkspaceExecutionHostId to the requested host before the gate settles, so a regression that always or never skipped on host mismatch would still pass. A case that moves the active host after the gate starts — e.g. setActiveFolderWorkspace(FOLDER_ID, SSH_HOST_ID) while a local gate is pending, then resolving it 'empty' — and asserts zero tabs would pin it.

@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 — this delta splits the folder-routing change out of the PR; the re-seed fix itself is unchanged and green.

Reviewed changes

This run re-reviewed commit 54bca206 ("chore(workspaces): split duplicate-folder routing fix"), the delta since pullfrog's previous review at 278e5ed3.

  • Split the host-aware folder connection routing out of the PR — reverted getFolderWorkspaceConnectionId's explicit-host parameter and the host threading through getConnectionIdFromState, the retained file selector, worktreeUsesWslPath, worktreeUsesRemoteConnection, and getRemoteConnectionIdForWorktree, restoring main's host-blind resolution.
  • Trimmed the folder re-seed tests to match — the gate rows keep their tab-count and active-host assertions but drop the connection-resolution assertions that the split removed.
  • Left the gate re-seed fix and its hardening intact — gateAndReseedEmptyWorkspace, the WeakMap latest-intent supersession, and the reseedGatedEmptyWorkspace stale-host guard are unchanged.

I verified the revert is clean (no dangling references to getSelectedExecutionHostId, the removed policy predicates, or the 3-arg signature; every call site uses the 2-arg form), re-ran the re-seed suite (27 passed at head), and pnpm tc:web exits 0.

One prior inline thread (missing coverage for the executionHostId guard's mismatch branch) remains open and unchanged by this commit, so this run does not approve.

Pullfrog  | Fix it ➔ | View workflow run | Using openrouter/deepseek/deepseek-v4.1-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.

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)
src/renderer/src/lib/worktree-initial-terminal-seeding.ts (1)

39-50: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Preserve executionHostId during terminal seeding. reseedGatedEmptyWorkspace uses the host only for its guard, then passes the bare worktree ID to ensureWorktreeHasInitialTerminal and createTab. The repository supports the same worktree ID on multiple hosts, while bare lookup uses the first matching row. Therefore, an empty SSH reseed can create a terminal through another host's connection. Pass the selected host through terminal creation or use a host-qualified lookup.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 77cd1325-08f4-451c-9b01-ddf00fc450ab

📥 Commits

Reviewing files that changed from the base of the PR and between 278e5ed and 54bca20.

📒 Files selected for processing (1)
  • src/renderer/src/lib/worktree-activation-emptied-workspace-reseed.test.ts

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

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

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)
src/renderer/src/lib/worktree-activation-gated-empty-reseed.ts (1)

18-38: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Key the activation gate by execution host

gateWorktreeAgentActivation deduplicates only by workspaceKey, but listActivationPtySessions performs a host-scoped census. If local activation starts a census and SSH activation occurs before it settles, the SSH call reuses the local promise while latestReseedIntentByGate replaces the intent with SSH. A local empty result can therefore reseed SSH without checking SSH, while a local adopted or resumed result can suppress a required SSH reseed. Capture the host for the census and key the in-flight gate by (workspaceKey, executionHostId), or enforce an equivalent host-matching result before applying the latest intent.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 655ab90c-ff5f-4a86-bff4-be1dd9836a86

📥 Commits

Reviewing files that changed from the base of the PR and between 54bca20 and 2504cdd.

📒 Files selected for processing (2)
  • src/renderer/src/lib/worktree-activation-gated-empty-reseed.ts
  • src/renderer/src/lib/worktree-activation.ts

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

@brennanb2025
brennanb2025 merged commit ad49aae into main Sep 14, 2026
34 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.

1 participant