Skip to content

fix(ui): handle saved paths missing from the selected machine (OH-64) - #22

Merged
andorcassian merged 2 commits into
devfrom
feature/OH-64-stale-saved-paths
Nov 4, 2026
Merged

andorcassian merged 2 commits into
devfrom
feature/OH-64-stale-saved-paths

Conversation

@andorcassian

@andorcassian andorcassian commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

What changes

Saved paths that no longer exist on the selected machine are now handled explicitly, and a launch no longer creates a missing folder without asking.

  • Picker: favorites and recents are checked against the selected target when the picker opens or the target changes. A missing path shows "Not found on this machine". Pressing that row moves the path into the input instead of committing it. In the New Session popover and the standalone picker it fills only the input, so dismissing the list cannot leave a launch path the chip does not show; Enter commits it. Where the input stays on screen (wizard, handoff, voice) it also updates the draft, because that input is what launches. The favorite toggle still works, so a stale favorite can be removed.
  • Owner: probeMachineDirectory lives in the machine file-browser owner and uses the existing list-directory RPC with maxEntries: 1. It reads past the browse cache and does not write to it. isPathNotFoundErrorMessage moved to the same owner.
  • Launch: plain New Session launches no longer send approvedNewDirectoryCreation: true. The daemon reports the missing folder through the existing requestToApproveDirectoryCreation result and the app asks before creating it, as the machine detail screen already does. Confirming relaunches with the approval, only if the machine, relay, account and path are unchanged. Worktree launches keep the approval because the launch itself materializes that directory.
  • Daemon operation: the tracked spawn handler now settles the approval question as cancelled instead of the failed spawn_custody_unresolved projection, so a missing folder no longer leaves a false failed launch in Inbox. The app also marks that failed entry seen for released daemons, which still record it; the code names its removal condition.
  • Recents: a path is recorded as recent once the session exists, not before spawn. A declined or failed launch no longer becomes the target's default. A session that is created after the user has moved the screen to another target still records its path.
  • Auto-selected path: the path New Session picks by itself is checked against the selected target when the target changes and on open. If the machine reports it gone, selection moves to the next existing recent, then that machine's Home. A path the user, route or restored draft asked for is left alone, and unknown keeps the path. The wizard now switches machines through selectMachine so its default gets the same check.
  • Home/account change: a non-empty edited path is no longer carried to a new target that reuses the machine ID. A path the user cleared stays cleared.

Availability that cannot be determined (offline machine, daemon without the RPC, path outside browse roots, target changed mid-request) is unknown and leaves the row usable. There is no fallback to another machine. The launch check is the backstop for those rows, and for a launch sent before the auto-selected path check answers.

Decisions to review

  • Typed new folders now prompt too. The launch check does not know where a path came from, so a typed path that does not exist gets the same confirmation. Before, it was created silently. I chose one rule at the daemon's existing decision point over a second "is this saved" check in the app. Creating a new folder still works, with one extra confirmation.
  • Missing rows are not disabled. A disabled row also disables its right accessory, which would make a stale favorite impossible to remove.

Compatibility

No new capability, RPC or wire field. Source at the commit matching the installed 0.2.17 release honors approvedNewDirectoryCreation: false in ensureSessionDirectory and maxEntries in the list-directory handler. A daemon that ignored maxEntries would return a longer listing, which the probe treats the same way. This was checked by reading that source, not by running a released daemon.

Validation

RED was observed before implementation for the first batch: 12 new cases failed across the four owner test files for the intended reasons (88 passed). The review fixes had their own RED: the daemon test saw failed, the popover test saw a draft write, the recents test saw the declined path recorded, the Inbox test saw the failed entry, and the revalidation test had no owner. The worktree approval test is test-only and fails when isRepoNativeWorktreeLaunch || is removed.

Check Result
UI: components/sessions/new, components/ui/pathPicker, handoff, voice pickers, machineFileBrowser, actionOperations, settings/machinePath* (138 files) 1032/1032
CLI: rpcHandlers.actionOperations.spawn, daemon/actionOperations (6 files) 19/19
yarn --cwd apps/ui typecheck, yarn workspace @happier-dev/cli typecheck exit 0
session.new.pathPicker.spec.ts, -g "browses and persists" (isolated server and daemon, folder deleted on disk, review dismissed with Escape) 1/1

All four ran on the committed bytes. Two tests were added in the verification pass, and both had RED observed first. In the recents test, a session created after the launch scope changed was not recorded; the fix moves recording ahead of that early return. In the screen-model test, the auto-selected path stayed on the deleted folder when the revalidation mount was removed.

Not run: the full UI and CLI suites, the other tests in that spec, and the launch confirmation in a browser. The confirmation and Inbox behavior are covered at hook and RPC-handler level with the spawn boundary mocked. The auto-selected check runs against the real path state and file-browser owner with the RPC mocked, both in its owner test and mounted through useNewSessionScreenModel (that test fails when the mount is removed).

Hosted CI (CI — Tests) on head 22a46c2: green on attempt 2. Attempt 1 failed only in the opt-in real tmux test spawnInTmux parses -P/-F output when the client environment has no UTF-8 locale, in its finally cleanup (ENOTEMPTY from rmSync while the spawned script could still write into the temp dir). Its assertions passed, and this PR does not touch tmux, so the failed jobs were rerun once. A Copilot review was requested after the PR was marked ready but did not arrive within 15 minutes; the PR merged without it.

Scope and deferrals

  • 0.3 port disposition is blocked because the destination checkout is absent.
  • Native QA is deferred: macOS picker across MacBook, Mac mini and Windows hosts, and real provider acceptance.
  • Not validated on a Windows host. The ENOENT / ENOTDIR classification is the existing one, unchanged.
  • Text typed into the popover input and then dismissed still stays the launch draft, as it did before this change (Tab-completing a missing row counts as typing). The chip does not show it. This is existing draft behavior with its own test, so it is reported rather than changed here.
  • On a released daemon the app clears the false Inbox entry only if the operation has reached the app by the time the dialog closes. Other devices still see it until that daemon updates.
  • Session handoff targets and automations are outside this change. Handoff gets the picker behavior, but its daemon import still pre-approves creation.

Tracks OH-64.

Check favorites and recents against the selected target through the
machine file-browser owner and label the ones it reports as gone. A
missing row moves its path into the input instead of committing it.

Stop pre-approving directory creation on plain New Session launches, so
the daemon reports a missing folder and the app asks before creating it.

Replace a non-empty edited path when the Home or account changes on a
reused machine ID.
Project the directory-approval question as a cancelled operation in the
tracked spawn handler, so a missing folder no longer leaves a failed
launch in Inbox. The app clears the failed entry released daemons record.

Keep a reviewed missing path out of the launch draft in the popover,
where the input closes but the draft stays. Record a recent path only
once the session exists, so a declined folder cannot become the default,
and still record it when the session outlives a changed launch scope.

Check the path New Session picks by itself against the selected target
and move to the next existing recent or the machine Home.
@andorcassian
andorcassian marked this pull request as ready for review November 4, 2026 19:27
@andorcassian
andorcassian merged commit 0275a83 into dev Nov 4, 2026
87 of 90 checks passed
@andorcassian
andorcassian deleted the feature/OH-64-stale-saved-paths branch November 4, 2026 19:44
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