Skip to content

fix(claude-code): allow goose to run inside a Claude Code session#7232

Merged
DOsinga merged 1 commit intomainfrom
adrian/fix-nested-claude
Feb 17, 2026
Merged

fix(claude-code): allow goose to run inside a Claude Code session#7232
DOsinga merged 1 commit intomainfrom
adrian/fix-nested-claude

Conversation

@codefromthecrypt
Copy link
Collaborator

Summary

This makes the Claude Code provider to work when goose is run inside a Claude Code session.

Claude Code 2.1.42+ sets CLAUDECODE=1 and refuses to start when it detects that variable. Removing it from the child process environment lets goose spawn claude normally.

Type of Change

  • Bug fix

AI Assistance

  • This PR was created or reviewed with AI assistance

Testing

Before (from inside a Claude Code session):

GOOSE_PROVIDER=claude-code GOOSE_MODEL=sonnet target/release/goose run --text "say just hello"
# starting session | provider: claude-code model: sonnet
#     session id: 20260214_23
#     working directory: /Users/codefromthecrypt/oss/goose-goosed
# Ran into this error: Request failed: CLI process terminated while waiting for set_model response.

After:

GOOSE_PROVIDER=claude-code GOOSE_MODEL=sonnet target/release/goose run --text "say just hello"
# starting session | provider: claude-code model: sonnet
#     session id: 20260214_24
#     working directory: /Users/codefromthecrypt/oss/goose-goosed
# Hello! 👋

Claude Code 2.1.42+ refuses to start when CLAUDECODE is set. Remove it
from the child process environment.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
Copilot AI review requested due to automatic review settings February 15, 2026 12:26
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 bug where goose could not be run inside a Claude Code session. Claude Code 2.1.42+ sets CLAUDECODE=1 to detect and prevent nested execution. The fix removes this environment variable from child processes spawned by goose's Claude Code provider.

Changes:

  • Remove CLAUDECODE environment variable when spawning Claude CLI subprocess to allow goose to work when run inside a Claude Code session

@DOsinga DOsinga added this pull request to the merge queue Feb 17, 2026
Merged via the queue into main with commit c7478c4 Feb 17, 2026
23 of 25 checks passed
@DOsinga DOsinga deleted the adrian/fix-nested-claude branch February 17, 2026 14:17
zanesq added a commit that referenced this pull request Feb 17, 2026
…led-extensions-cmd

* 'main' of github.com:block/goose: (24 commits)
  Set up direnv and update flake inputs (#6526)
  fix: restore subagent tool call notifications after summon refactor (#7243)
  fix(ui): preserve server config values on partial provider config save (#7248)
  fix(claude-code): allow goose to run inside a Claude Code session (#7232)
  fix(openai): route gpt-5 codex via responses and map base paths (#7254)
  feat: add GoosePlatform to AgentConfig and MCP initialization (#6931)
  Fix copied over (#7270)
  feat(gemini-cli): add streaming support via stream-json events (#7244)
  fix: filter models without tool support from recommended list (#7198)
  fix(google): handle more thoughtSignature vagaries during streaming (#7204)
  docs: playwright CLI skill tutorial (#7261)
  install node in goose dir (#7220)
  fix: relax test_basic_response assertion for providers returning reasoning_content (#7249)
  fix: handle reasoning_content for Kimi/thinking models (#7252)
  feat: sandboxing for macos (#7197)
  fix(otel): use monotonic_counter prefix and support temporality env var (#7234)
  Streaming markdown (#7233)
  Improve compaction messages to enable better post-compaction agent behavior (#7259)
  fix: avoid shell-escaping special characters except quotes (#7242)
  fix: use dynamic port for Tetrate auth callback server (#7228)
  ...
katzdave added a commit to YusukeShimizu/goose that referenced this pull request Feb 17, 2026
* origin/main: (263 commits)
  working_dir usage more clear in add_extension (block#6958)
  Use Canonical Models to set context window sizes (block#6723)
  Set up direnv and update flake inputs (block#6526)
  fix: restore subagent tool call notifications after summon refactor (block#7243)
  fix(ui): preserve server config values on partial provider config save (block#7248)
  fix(claude-code): allow goose to run inside a Claude Code session (block#7232)
  fix(openai): route gpt-5 codex via responses and map base paths (block#7254)
  feat: add GoosePlatform to AgentConfig and MCP initialization (block#6931)
  Fix copied over (block#7270)
  feat(gemini-cli): add streaming support via stream-json events (block#7244)
  fix: filter models without tool support from recommended list (block#7198)
  fix(google): handle more thoughtSignature vagaries during streaming (block#7204)
  docs: playwright CLI skill tutorial (block#7261)
  install node in goose dir (block#7220)
  fix: relax test_basic_response assertion for providers returning reasoning_content (block#7249)
  fix: handle reasoning_content for Kimi/thinking models (block#7252)
  feat: sandboxing for macos (block#7197)
  fix(otel): use monotonic_counter prefix and support temporality env var (block#7234)
  Streaming markdown (block#7233)
  Improve compaction messages to enable better post-compaction agent behavior (block#7259)
  ...

# Conflicts:
#	crates/goose/src/providers/openai.rs
zanesq added a commit that referenced this pull request Feb 17, 2026
…ions-fallback

* 'main' of github.com:block/goose: (43 commits)
  Added cmd to validate bundled extensions json (#7217)
  working_dir usage more clear in add_extension (#6958)
  Use Canonical Models to set context window sizes (#6723)
  Set up direnv and update flake inputs (#6526)
  fix: restore subagent tool call notifications after summon refactor (#7243)
  fix(ui): preserve server config values on partial provider config save (#7248)
  fix(claude-code): allow goose to run inside a Claude Code session (#7232)
  fix(openai): route gpt-5 codex via responses and map base paths (#7254)
  feat: add GoosePlatform to AgentConfig and MCP initialization (#6931)
  Fix copied over (#7270)
  feat(gemini-cli): add streaming support via stream-json events (#7244)
  fix: filter models without tool support from recommended list (#7198)
  fix(google): handle more thoughtSignature vagaries during streaming (#7204)
  docs: playwright CLI skill tutorial (#7261)
  install node in goose dir (#7220)
  fix: relax test_basic_response assertion for providers returning reasoning_content (#7249)
  fix: handle reasoning_content for Kimi/thinking models (#7252)
  feat: sandboxing for macos (#7197)
  fix(otel): use monotonic_counter prefix and support temporality env var (#7234)
  Streaming markdown (#7233)
  ...

# Conflicts:
#	crates/goose/src/config/extensions.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.

2 participants