Skip to content

fix(remote): disable the new-session button on remote project groups - #223

Merged
devsuitup merged 1 commit into
mainfrom
fix/remote-project-new-session-btn
Sep 8, 2026
Merged

devsuitup merged 1 commit into
mainfrom
fix/remote-project-new-session-btn

Conversation

@devsuitup

Copy link
Copy Markdown
Owner

Closes #214.

Clicking an existing remote session was already guarded — it routes to the
read-only transcript viewer, and the main process refuses a resume whose cached
folder is remote. The + button in the project-group header was not: it was
created for every group with no test on project.remoteAlias, and its handler
reached open-terminal with isNew set and the host's path as cwd. The remote
guard in main.js only runs when isNew is false, so it never fired there.

What stopped it was the generic fs.existsSync(spawnCwd) check, which failed
with "project directory no longer exists: /srv/…" — a misleading message for a
path that was never on this machine.

The button is now disabled for a mirrored project, with a title naming the host,
and the click handler is guarded independently so a programmatic invocation
cannot reach the popover either. Disabled rather than hidden: sessions under a
missing project already use an explanatory title instead of removing the
control, and keeping the button avoids a shifting header layout.

Verification

Three tests added, in the style of the existing remote-session sidebar test.

Mutation, with the change proven applied before running: the source was copied
and md5-verified, both call sites were reverted to unconditional, the mutated
lines were printed, and the suite was run — two of the three new tests went red
(disabled false, and the popover called with the remote path). The third, on a
local project, stayed green as it should. The file was then restored from the
byte-exact copy, md5 confirmed identical, and everything went green again.

task check: 1097 tests, 1089 passed, 0 failed, 8 pre-existing skips. Lint 0
errors; the 272 warnings are pre-existing and unchanged by this diff.

The "+" button in a project-group header was created unconditionally,
including for a remote-mirrored project (project.remoteAlias set). Its
click handler reached showNewSessionPopover -> launchNewSession -> the
open-terminal IPC with isNew and the remote host's projectPath, which
this machine does not have on disk. The generic fs.existsSync guard in
main.js caught it with a misleading "project directory no longer
exists" message for a path that was never local.

Disable the button rather than hide it: sessions under a missing
project already use this project's convention of an explanatory title
instead of removing the control, so the "+" button follows the same
idiom, with a title naming the mirrored host. The click handler is
also guarded directly so a disabled button never reaches
showNewSessionPopover even if invoked programmatically.

Refs #214
@devsuitup
devsuitup enabled auto-merge (squash) September 8, 2026 08:09
@devsuitup
devsuitup merged commit 6335a3c into main Sep 8, 2026
10 checks passed
@devsuitup
devsuitup deleted the fix/remote-project-new-session-btn branch September 8, 2026 08:16
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(remote): the New session button is not gated on a remote project group

1 participant