Skip to content

Fix copilot process startup crash and model selector not applying selection#61

Merged
dalexsoto merged 1 commit intomainfrom
dev/alex/fix-fix
Feb 11, 2026
Merged

Fix copilot process startup crash and model selector not applying selection#61
dalexsoto merged 1 commit intomainfrom
dev/alex/fix-fix

Conversation

@dalexsoto
Copy link
Copy Markdown
Collaborator

CopilotService: Set explicit Cwd on CopilotClientOptions

When PolyPilot is launched from the staging directory via relaunch.sh, the process working directory resolves to the .app bundle path (/Users/.../bin/staging/PolyPilot.app). The SDK's CopilotClient uses this as the working directory when spawning the 'copilot' CLI process, which fails with 'No such file or directory' because .app bundles are not valid working directories for child processes on macOS.

Fix: Set CopilotClientOptions.Cwd = ProjectDir so the copilot CLI process always starts with the project source directory as its working directory, regardless of where the .app bundle is running from.

ModelSelector: Fix dropdown selection being ignored (focusout race)

The ModelSelector component had @onfocusout="Close" on the parent div and @OnClick handlers on dropdown options. When clicking a model option, the browser's focus-change sequence fires focusout before the click event. This caused Close() to set isOpen=false, triggering a Blazor re-render that removed the dropdown from the DOM before the Select() click handler could execute. The result was that the dropdown closed without applying the selection, snapping back to the default model.

Fix: Add @onmousedown:preventDefault="true" on the dropdown container. This prevents the browser's default mousedown behavior (moving focus away from the currently focused element), so focusout does not fire before the click event. The click on the model option now fires normally, Select() executes, and the chosen model is applied.

…ection

CopilotService: Set explicit Cwd on CopilotClientOptions

When PolyPilot is launched from the staging directory via relaunch.sh,
the process working directory resolves to the .app bundle path
(/Users/.../bin/staging/PolyPilot.app). The SDK's CopilotClient uses
this as the working directory when spawning the 'copilot' CLI process,
which fails with 'No such file or directory' because .app bundles are
not valid working directories for child processes on macOS.

Fix: Set CopilotClientOptions.Cwd = ProjectDir so the copilot CLI
process always starts with the project source directory as its working
directory, regardless of where the .app bundle is running from.

ModelSelector: Fix dropdown selection being ignored (focusout race)

The ModelSelector component had @onfocusout="Close" on the parent div
and @OnClick handlers on dropdown options. When clicking a model option,
the browser's focus-change sequence fires focusout before the click
event. This caused Close() to set isOpen=false, triggering a Blazor
re-render that removed the dropdown from the DOM before the Select()
click handler could execute. The result was that the dropdown closed
without applying the selection, snapping back to the default model.

Fix: Add @onmousedown:preventDefault="true" on the dropdown container.
This prevents the browser's default mousedown behavior (moving focus
away from the currently focused element), so focusout does not fire
before the click event. The click on the model option now fires
normally, Select() executes, and the chosen model is applied.
@dalexsoto dalexsoto merged commit 01b44b9 into main Feb 11, 2026
1 check passed
@PureWeen PureWeen deleted the dev/alex/fix-fix branch February 22, 2026 00:19
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