fix: isolate claude-code sessions via stream-json session_id#7108
Merged
codefromthecrypt merged 1 commit intomainfrom Feb 10, 2026
Merged
fix: isolate claude-code sessions via stream-json session_id#7108codefromthecrypt merged 1 commit intomainfrom
codefromthecrypt merged 1 commit intomainfrom
Conversation
| )] | ||
| async fn complete_with_model( | ||
| &self, | ||
| _session_id: Option<&str>, // create_session == YYYYMMDD_N, but --session-id requires a UUID |
Collaborator
Author
There was a problem hiding this comment.
this only applies to CLI validation, not the ndjson itself.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the claude-code CLI provider to use a session_id in the stream-json protocol so a single persistent subprocess can correctly isolate multiple concurrent/serial Goose sessions (and avoids leaking state between tests).
Changes:
- Add
session_idto theclaude-codestream-json input payload and remove the previousmessages_sentbookkeeping. - Update provider integration tests to support CLI providers (
claude-code,codex) and use per-test session IDs where needed. - Refactor CLI provider
from_envconstruction forclaude-codeandcodexinto theProviderDefimplementation.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| crates/goose/src/providers/claude_code.rs | Add session_id to stream-json input; remove messages_sent; adjust session-id handling in complete_with_model. |
| crates/goose/src/providers/codex.rs | Move env-based provider construction into ProviderDef::from_env. |
| crates/goose/tests/providers.rs | Expand integration tests for CLI providers; introduce CLI/non-CLI session handling and skip logic. |
ed6d261 to
ff6c11a
Compare
Signed-off-by: Adrian Cole <adrian@tetrate.io>
ff6c11a to
950f9a6
Compare
10 tasks
michaelneale
approved these changes
Feb 10, 2026
zanesq
added a commit
that referenced
this pull request
Feb 10, 2026
…tensions-deeplinks * 'main' of github.com:block/goose: [docs] update authors.yaml file (#7114) Implement manpage generation for goose-cli (#6980) docs: tool output optimization (#7109) Fix duplicated output in Code Mode by filtering content by audience (#7117) Enable tom (Top Of Mind) platform extension by default (#7111) chore: added notification for canary build failure (#7106) fix: fix windows bundle random failure and optimise canary build (#7105) feat(acp): add model selection support for session/new and session/set_model (#7112) fix: isolate claude-code sessions via stream-json session_id (#7108) ci: enable agentic provider live tests (claude-code, codex, gemini-cli) (#7088) docs: codex subscription support (#7104) chore: add a new scenario (#7107) fix: Goose Desktop missing Calendar and Reminders entitlements (#7100) Fix 'Edit In Place' and 'Fork Session' features (#6970) Fix: Only send command content to command injection classifier (excluding part of tool call dict) (#7082) Docs: require auth optional for custom providers (#7098) fix: improve text-muted contrast for better readability (#7095) Always sync bundled extensions (#7057)
tlongwell-block
added a commit
that referenced
this pull request
Feb 10, 2026
* origin/main: feat: add AGENT=goose environment variable for cross-tool compatibility (#7017) fix: strip empty extensions array when deeplink also (#7096) [docs] update authors.yaml file (#7114) Implement manpage generation for goose-cli (#6980) docs: tool output optimization (#7109) Fix duplicated output in Code Mode by filtering content by audience (#7117) Enable tom (Top Of Mind) platform extension by default (#7111) chore: added notification for canary build failure (#7106) fix: fix windows bundle random failure and optimise canary build (#7105) feat(acp): add model selection support for session/new and session/set_model (#7112) fix: isolate claude-code sessions via stream-json session_id (#7108) ci: enable agentic provider live tests (claude-code, codex, gemini-cli) (#7088) docs: codex subscription support (#7104) chore: add a new scenario (#7107) fix: Goose Desktop missing Calendar and Reminders entitlements (#7100) Fix 'Edit In Place' and 'Fork Session' features (#6970) Fix: Only send command content to command injection classifier (excluding part of tool call dict) (#7082) # Conflicts: # crates/goose/src/agents/extension.rs
jh-block
added a commit
that referenced
this pull request
Feb 10, 2026
* origin/main: (30 commits) docs: GCP Vertex AI org policy filtering & update OnboardingProviderSetup component (#7125) feat: replace subagent and skills with unified summon extension (#6964) feat: add AGENT=goose environment variable for cross-tool compatibility (#7017) fix: strip empty extensions array when deeplink also (#7096) [docs] update authors.yaml file (#7114) Implement manpage generation for goose-cli (#6980) docs: tool output optimization (#7109) Fix duplicated output in Code Mode by filtering content by audience (#7117) Enable tom (Top Of Mind) platform extension by default (#7111) chore: added notification for canary build failure (#7106) fix: fix windows bundle random failure and optimise canary build (#7105) feat(acp): add model selection support for session/new and session/set_model (#7112) fix: isolate claude-code sessions via stream-json session_id (#7108) ci: enable agentic provider live tests (claude-code, codex, gemini-cli) (#7088) docs: codex subscription support (#7104) chore: add a new scenario (#7107) fix: Goose Desktop missing Calendar and Reminders entitlements (#7100) Fix 'Edit In Place' and 'Fork Session' features (#6970) Fix: Only send command content to command injection classifier (excluding part of tool call dict) (#7082) Docs: require auth optional for custom providers (#7098) ...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
claude-codeshares a persistent subprocess that previously conflated all sessions into one. This caused a lot of problems, notably tests would include state from other tests. This could add pressure to restart the subprocess, rather than solve the bookkeeping problem.This implements
session_idto the stream-json protocol and removes themessages_sentbookkeeping as sessions are handled internally to claude.This is standard practice for stream-json SDKs: Each sends only the new user message per turn with a
session_idfield, and the CLI maintains conversation context internally:session_iddefaults to"default"session_iddefaults to"default"session_idon everyStreamMessageThis also updates
providers.rsintegration tests to use a unique session ID per test, and support running withclaude-codeandcodexCLI providers.Type of Change
AI Assistance
Testing
Related Issues