Skip to content

fix: stop killing goosed when a window closes - #9302

Merged
DOsinga merged 1 commit into
mainfrom
fix/8711-remove-goosed-kill-on-window-close
May 19, 2026
Merged

fix: stop killing goosed when a window closes#9302
DOsinga merged 1 commit into
mainfrom
fix/8711-remove-goosed-kill-on-window-close

Conversation

@DOsinga

@DOsinga DOsinga commented May 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

Closing a BrowserWindow killed its dedicated goosed process via goosedProcess.kill() in the mainWindow.on('closed') handler. This severed sessions for users who close one window while others are still open, causing the "session error" failures described in the issue.

The app.on('will-quit') handler already calls goosedResult.cleanup() for every spawned goosed process (with graceful SIGTERM + 5s SIGKILL fallback), so the per-window kill was redundant and harmful.

Changes

  • Removed goosedProcess.kill() from the mainWindow.on('closed') handler in ui/desktop/src/main.ts
  • Removed the now-unused process: goosedProcess destructuring from goosedResult

Testing

  • pnpm lint passes clean
  • All 347 desktop tests pass

Fixes #8711

Closing a BrowserWindow killed its dedicated goosed process, severing
sessions for all windows sharing that backend. The app.on('will-quit')
handler already calls goosedResult.cleanup() for every spawned process,
so the per-window kill was redundant and harmful.

Fixes #8711

Signed-off-by: Douwe Osinga <douwe@squareup.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

goose/ui/desktop/src/main.ts

Lines 1133 to 1135 in 756faf6

mainWindow.on('closed', () => {
windowMap.delete(windowId);

P1 Badge Clean up per-window goosed when chat window closes

Removing the goosedProcess.kill() path from the closed handler leaves each chat window's spawned backend alive until full app exit, but createChat() still starts a fresh backend for every new window. In environments where closing windows does not quit the app (e.g. macOS per window-all-closed logic in ui/desktop/src/main.ts), repeatedly closing/reopening chat windows accumulates orphaned goosed processes and listeners, which can degrade performance and eventually exhaust system resources.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@DOsinga
DOsinga added this pull request to the merge queue May 19, 2026
Merged via the queue into main with commit 88b5765 May 19, 2026
19 of 20 checks passed
@DOsinga
DOsinga deleted the fix/8711-remove-goosed-kill-on-window-close branch May 19, 2026 13:43
lifeizhou-ap added a commit that referenced this pull request May 20, 2026
* main: (70 commits)
  Feat/summon subagent instructions (#9325)
  feat: open-plugins generalization + skills (#9112)
  feat(hooks): PreToolUse denial (#9304)
  Add support for optional api_key configuration for declarative openai-engine providers (#9202)
  fix(cli): use plain '> ' prompt instead of goose emoji (#9305)
  flag for login shell PATH (#9313)
  Remove popular chat topics from new chat screen (#9307)
  fix: stop killing goosed when a window closes (#9302)
  Remove vendored Windows binaries (#9318)
  Add Linux musl CLI builds (#9240)
  feat(acp): paginate session list (#9199)
  docs: reorganize (#9310)
  Structured per-provider config block, non-destructive provider switching (#8977)
  feat(cli): add `goose review` local code review command (#9114)
  feat(tui): diff viewer (#9260)
  fix(otel): emit trace_output as span attribute instead of event (#9255)
  docs: add guide for connecting goose Desktop to a remote goosed server (#9275)
  fix(config): check file fallback when keyring has no entry (#9279)
  fix(desktop): ScheduleModal error message styling (#9278)
  fix(ui): align sidebar hamburger in macOS fullscreen (#9257)
  ...
lifeizhou-ap added a commit that referenced this pull request May 22, 2026
* main: (38 commits)
  [Prompt injection mitigation] Update pattern-based detection to reduce FPs (#9350)
  feat: add Harbor eval runner (#9138)
  chore(release): bump version to 1.35.0 (minor) (#9150)
  Include request URL in provider error messages (#9232)
  fix(databricks): ensure parallel tool image responses don't interleave tool results (#9241)
  Surface resolved Databricks model metadata (#9206)
  Add unified thinking effort control across all providers (#9242)
  Add Linux desktop Vulkan packages (#9323)
  chore: update canonical model registry (#9331)
  feat: slash commands (built-in, skill, recipe) in acp server (#9238)
  feat: add /goal command for agent self-evaluation before finishing (#9069)
  Feat/summon subagent instructions (#9325)
  feat: open-plugins generalization + skills (#9112)
  feat(hooks): PreToolUse denial (#9304)
  Add support for optional api_key configuration for declarative openai-engine providers (#9202)
  fix(cli): use plain '> ' prompt instead of goose emoji (#9305)
  flag for login shell PATH (#9313)
  Remove popular chat topics from new chat screen (#9307)
  fix: stop killing goosed when a window closes (#9302)
  Remove vendored Windows binaries (#9318)
  ...
shafqatevo pushed a commit to shafqatevo/goose that referenced this pull request Aug 7, 2026
Signed-off-by: Douwe Osinga <douwe@squareup.com>
Co-authored-by: Douwe Osinga <douwe@squareup.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.

[BUG] goosed killed by macOS disk-write coalition limits — SQLite sorter/pwrite workload on large sessions.db

2 participants