Skip to content

fix: make apps work in built copies of goose#6901

Merged
alexhancock merged 1 commit intomainfrom
alexhancock/app-window-fix
Feb 2, 2026
Merged

fix: make apps work in built copies of goose#6901
alexhancock merged 1 commit intomainfrom
alexhancock/app-window-fix

Conversation

@alexhancock
Copy link
Collaborator

The old code in the launch-app IPC handler tried to construct the standalone app URL by extracting the origin from the current window's URL:

const currentUrl = launchingWindow.webContents.getURL();
const baseUrl = new URL(currentUrl).origin;
const standaloneUrl = `${baseUrl}/#/standalone-app?...`;
  • In development (just run-ui), the main window URL is http://localhost:5173/..., so origin returns http://localhost:5173
  • In production (built app), the main window loads from a file:// URL like file:///C:/path/to/app/index.html#/.... For file:// URLs, new URL(...).origin returns the string "null"

This caused the standalone app window to try loading a URL like null/#/standalone-app?.... The fix constructs the URL the same way the main window URL is constructed elsewhere in the codebase:

const url = MAIN_WINDOW_VITE_DEV_SERVER_URL
  ? new URL(MAIN_WINDOW_VITE_DEV_SERVER_URL)
  : pathToFileURL(path.join(__dirname, `../renderer/${MAIN_WINDOW_VITE_NAME}/index.html`));
  • In dev mode: Uses the Vite dev server URL (http://localhost:5173)
  • In production: Uses pathToFileURL() to properly construct a file:// URL pointing to the bundled HTML file

@alexhancock alexhancock marked this pull request as ready for review February 2, 2026 18:18
Copilot AI review requested due to automatic review settings February 2, 2026 18:18
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a critical bug preventing standalone app windows from loading in production builds of the goose desktop application. The issue occurred because the old code extracted the URL origin from the launching window, which returns the string "null" for file:// URLs in production builds, resulting in invalid URLs like "null/#/standalone-app?...".

Changes:

  • Replaced broken URL origin extraction with the same URL construction pattern used for main window and launcher window creation
  • Improved query parameter encoding by using URLSearchParams instead of manual encodeURIComponent calls
  • Added comment explaining the fix for future maintainers

await appWindow.loadURL(standaloneUrl);

// Construct URL the same way as main window - using dev server in dev mode,
// or file:// URL in production. This fixes app loading on Windows builds.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd delete the comment about "fixing", since this is how it should have always been really

await appWindow.loadURL(standaloneUrl);

// Construct URL the same way as main window - using dev server in dev mode,
// or file:// URL in production. This fixes app loading on Windows builds.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drop the comments? I don't know how this is related to Windows builds


// Construct URL the same way as main window - using dev server in dev mode,
// or file:// URL in production. This fixes app loading on Windows builds.
const url = MAIN_WINDOW_VITE_DEV_SERVER_URL
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is literalyy the same as for the main window indeed, can we not just reuse that?

@alexhancock alexhancock force-pushed the alexhancock/app-window-fix branch from b564d8b to 9fda4fa Compare February 2, 2026 18:35
@alexhancock alexhancock merged commit 493ae78 into main Feb 2, 2026
18 checks passed
@alexhancock alexhancock deleted the alexhancock/app-window-fix branch February 2, 2026 19:07
katzdave added a commit that referenced this pull request Feb 3, 2026
…ntext

* 'main' of github.com:block/goose:
  refactor(providers): extract ProviderDef trait and OpenAiCompatibleProvider (#6832)
  feat: ask ai discord bot (#6842)
  chore(maintenance): make GitHub repo configurable for auto-updater and publisher (#6828)
  fix: make apps work in built copies of goose (#6901)
  Remove dependency on goose-mcp from goose crate (#6637)
  Clean up build canonical warnings (#6880)
  Sync desktop_prompt with UI (#6898)
stebbins pushed a commit to stebbins/goose that referenced this pull request Feb 4, 2026
Signed-off-by: Harrison <hcstebbins@gmail.com>
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.

3 participants