Skip to content

fix(goose-acp): heap allocations#7322

Merged
alexhancock merged 1 commit intomainfrom
alexhancock/goose-acp-stack
Feb 19, 2026
Merged

fix(goose-acp): heap allocations#7322
alexhancock merged 1 commit intomainfrom
alexhancock/goose-acp-stack

Conversation

@alexhancock
Copy link
Collaborator

goose-acp frequently errors out now when clients connect to it via HTTP

2026-02-18T14:44:06.016245Z  INFO goose_acp::transport::http: Session created acp_session_id=565b645e-dd6d-4cf9-94d4-0ceff7fd0016

thread 'tokio-runtime-worker' (7050194) has overflowed its stack
fatal runtime error: stack overflow, aborting
zsh: abort      cargo run -p goose-acp

this addresses it by Boxing things

@alexhancock alexhancock marked this pull request as ready for review February 18, 2026 21:58
Copilot AI review requested due to automatic review settings February 18, 2026 21:58
@alexhancock alexhancock force-pushed the alexhancock/goose-acp-stack branch from a360852 to 787beaa Compare February 18, 2026 21:58
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 stack overflow bug in goose-acp that occurs when clients connect via HTTP/WebSocket. The issue was caused by large async state machines (~85KB) being allocated on tokio worker thread stacks, which have limited size.

Changes:

  • Modified handle_message to use Box::pin to move the large MatchMessageFrom chain to the heap
  • Changed serve function to return a boxed pinned future instead of being async
  • Moved future creation outside tokio::spawn in HTTP and WebSocket transports for consistency

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
crates/goose-acp/src/server.rs Changed handle_message and serve to return boxed futures, moving large async state machines to heap
crates/goose-acp/src/transport/http.rs Moved future creation outside tokio::spawn for consistency
crates/goose-acp/src/transport/websocket.rs Moved future creation outside tokio::spawn for consistency

Copy link
Collaborator

@michaelneale michaelneale left a comment

Choose a reason for hiding this comment

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

oh nice - yes that would fill up the heap as ... well as we know http data can grow large in stack terms pretty quickly.

})
.await
.map(|()| Handled::Yes)
})
Copy link
Collaborator

Choose a reason for hiding this comment

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

The copilot explanation is convincing. That is quite a lot of .awaits, each one growing the size of the state machine. 85kb is quite a lot less than the default 2mb though.

@alexhancock alexhancock force-pushed the alexhancock/goose-acp-stack branch from 787beaa to ec914ba Compare February 19, 2026 02:26
Copilot AI review requested due to automatic review settings February 19, 2026 03:08
@alexhancock alexhancock force-pushed the alexhancock/goose-acp-stack branch from ec914ba to 53269fa Compare February 19, 2026 03:08
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

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@alexhancock alexhancock added this pull request to the merge queue Feb 19, 2026
Merged via the queue into main with commit c35b249 Feb 19, 2026
20 checks passed
@alexhancock alexhancock deleted the alexhancock/goose-acp-stack branch February 19, 2026 03:25
rabi pushed a commit to rabi/goose that referenced this pull request Feb 19, 2026
Change-Id: Ie24a6a5ac215f360acf6c0a192ebadcf9898bb5d
Signed-off-by: rabi <ramishra@redhat.com>
katzdave added a commit that referenced this pull request Feb 19, 2026
* 'main' of github.com:block/goose:
  fix: skip whitespace-only text blocks in Anthropic message (#7343)
  fix(goose-acp): heap allocations (#7322)
jh-block added a commit that referenced this pull request Feb 19, 2026
* origin/main:
  fix(ci): deflake smoke tests for Google models (#7344)
  feat: add Cerebras provider support (#7339)
  fix: skip whitespace-only text blocks in Anthropic message (#7343)
  fix(goose-acp): heap allocations (#7322)
  Remove trailing space from links (#7156)
  fix: detect low balance and prompt for top up (#7166)
  feat(apps): add support for MCP apps to sample (#7039)
  Typescript SDK for ACP extension methods (#7319)
  chore: upgrade to rmcp 0.16.0 (#7274)
  docs: add monitoring subagent activity section (#7323)
  docs: document Desktop UI recipe editing for model/provider and extensions (#7327)
  docs: add CLAUDE_THINKING_BUDGET and CLAUDE_THINKING_ENABLED environm… (#7330)
  fix: display 'Code Mode' instead of 'code_execution' in CLI (#7321)
  docs: add Permission Policy documentation for MCP Apps (#7325)
  update RPI plan prompt (#7326)
  docs: add CLI syntax highlighting theme customization (#7324)
  fix(cli): replace shell-based update with native Rust implementation (#7148)
  docs: rename Code Execution extension to Code Mode extension (#7316)
aharvard added a commit that referenced this pull request Feb 19, 2026
* origin/main: (29 commits)
  fix(ci): deflake smoke tests for Google models (#7344)
  feat: add Cerebras provider support (#7339)
  fix: skip whitespace-only text blocks in Anthropic message (#7343)
  fix(goose-acp): heap allocations (#7322)
  Remove trailing space from links (#7156)
  fix: detect low balance and prompt for top up (#7166)
  feat(apps): add support for MCP apps to sample (#7039)
  Typescript SDK for ACP extension methods (#7319)
  chore: upgrade to rmcp 0.16.0 (#7274)
  docs: add monitoring subagent activity section (#7323)
  docs: document Desktop UI recipe editing for model/provider and extensions (#7327)
  docs: add CLAUDE_THINKING_BUDGET and CLAUDE_THINKING_ENABLED environm… (#7330)
  fix: display 'Code Mode' instead of 'code_execution' in CLI (#7321)
  docs: add Permission Policy documentation for MCP Apps (#7325)
  update RPI plan prompt (#7326)
  docs: add CLI syntax highlighting theme customization (#7324)
  fix(cli): replace shell-based update with native Rust implementation (#7148)
  docs: rename Code Execution extension to Code Mode extension (#7316)
  docs: remove ALPHA_FEATURES flag from documentation (#7315)
  docs: escape variable syntax in recipes (#7314)
  ...

# Conflicts:
#	ui/desktop/src/components/McpApps/McpAppRenderer.tsx
#	ui/desktop/src/components/McpApps/types.ts
katzdave added a commit that referenced this pull request Feb 19, 2026
* 'main' of github.com:block/goose: (24 commits)
  Docs: claude code uses stream-json (#7358)
  Improve link confirmation modal (#7333)
  fix(ci): deflake smoke tests for Google models (#7344)
  feat: add Cerebras provider support (#7339)
  fix: skip whitespace-only text blocks in Anthropic message (#7343)
  fix(goose-acp): heap allocations (#7322)
  Remove trailing space from links (#7156)
  fix: detect low balance and prompt for top up (#7166)
  feat(apps): add support for MCP apps to sample (#7039)
  Typescript SDK for ACP extension methods (#7319)
  chore: upgrade to rmcp 0.16.0 (#7274)
  docs: add monitoring subagent activity section (#7323)
  docs: document Desktop UI recipe editing for model/provider and extensions (#7327)
  docs: add CLAUDE_THINKING_BUDGET and CLAUDE_THINKING_ENABLED environm… (#7330)
  fix: display 'Code Mode' instead of 'code_execution' in CLI (#7321)
  docs: add Permission Policy documentation for MCP Apps (#7325)
  update RPI plan prompt (#7326)
  docs: add CLI syntax highlighting theme customization (#7324)
  fix(cli): replace shell-based update with native Rust implementation (#7148)
  docs: rename Code Execution extension to Code Mode extension (#7316)
  ...
michaelneale added a commit that referenced this pull request Feb 19, 2026
* main: (46 commits)
  chore(deps): bump hono from 4.11.9 to 4.12.0 in /ui/desktop (#7369)
  Include 3rd-party license copy for JavaScript/CSS minified files (#7352)
  docs for reasoning env var (#7367)
  docs: update skills detail page to reference Goose Summon extension (#7350)
  fix(apps): restore MCP app sampling support reverted by #6933 (#7366)
  feat: TUI client of goose-acp (#7362)
  docs: agent variable (#7365)
  docs: pass env vars to shell (#7361)
  docs: update sandbox topic (#7336)
  feat: add local inference provider with llama.cpp backend and HuggingFace model management (#6933)
  Docs: claude code uses stream-json (#7358)
  Improve link confirmation modal (#7333)
  fix(ci): deflake smoke tests for Google models (#7344)
  feat: add Cerebras provider support (#7339)
  fix: skip whitespace-only text blocks in Anthropic message (#7343)
  fix(goose-acp): heap allocations (#7322)
  Remove trailing space from links (#7156)
  fix: detect low balance and prompt for top up (#7166)
  feat(apps): add support for MCP apps to sample (#7039)
  Typescript SDK for ACP extension methods (#7319)
  ...
tlongwell-block added a commit that referenced this pull request Feb 20, 2026
* origin/main: (62 commits)
  Docs: claude code uses stream-json (#7358)
  Improve link confirmation modal (#7333)
  fix(ci): deflake smoke tests for Google models (#7344)
  feat: add Cerebras provider support (#7339)
  fix: skip whitespace-only text blocks in Anthropic message (#7343)
  fix(goose-acp): heap allocations (#7322)
  Remove trailing space from links (#7156)
  fix: detect low balance and prompt for top up (#7166)
  feat(apps): add support for MCP apps to sample (#7039)
  Typescript SDK for ACP extension methods (#7319)
  chore: upgrade to rmcp 0.16.0 (#7274)
  docs: add monitoring subagent activity section (#7323)
  docs: document Desktop UI recipe editing for model/provider and extensions (#7327)
  docs: add CLAUDE_THINKING_BUDGET and CLAUDE_THINKING_ENABLED environm… (#7330)
  fix: display 'Code Mode' instead of 'code_execution' in CLI (#7321)
  docs: add Permission Policy documentation for MCP Apps (#7325)
  update RPI plan prompt (#7326)
  docs: add CLI syntax highlighting theme customization (#7324)
  fix(cli): replace shell-based update with native Rust implementation (#7148)
  docs: rename Code Execution extension to Code Mode extension (#7316)
  ...

# Conflicts:
#	crates/goose-server/src/main.rs
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

Comments