Skip to content

Conversation

@codefromthecrypt
Copy link
Collaborator

Summary

Propagate explicit session_id through provider and MCP requests, allowing coherent session IDs everywhere we can.

We use a fallback for two cases:

  • connection-scoped for unsolicited MCP sampling
  • new UUIDs for request paths that have no user session.

This notably fixes session-id propagation such as from servers who do MCP sampling in health checks.
This also fixes session ID propagation in session rename requests originally started in #5624.

Importantly, by backfilling ACP integration hooks, we now can fail any change that breaks session ID propagation.
This is important because before it was subtle, like task locals which might not even be the correct context. For example,
MCP sampling callbacks do not share a task local with a tool call that caused it!

Type of Change

  • Feature
  • Bug fix
  • Refactor / Code quality
  • Performance improvement
  • Documentation
  • Tests
  • Security fix
  • Build / Release
  • Other (specify below)

AI Assistance

  • This PR was created or reviewed with AI assistance

Testing

  • ACP fixtures cover streamable HTTP + MCP metadata coherence, including session list and session rename requests.
  • MCP client unit tests cover request injection (list/read/call/prompt) and sampling callback session resolution.

Related Issues

Resumes from #5624

}

mock_server
/// Calling this ensures incidental requests that might error asynchronously, such as
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is a very important part of ACP tests as it tracks any session ID mismatch including no session ID. if any propagation breaks in the future, and it is reproducible by ACP, this will be the tripwire

@codefromthecrypt codefromthecrypt marked this pull request as ready for review January 20, 2026 07:17
Copilot AI review requested due to automatic review settings January 20, 2026 07:17
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 propagates explicit session_id parameters through provider and MCP requests, replacing task-local context with explicit parameter passing. This ensures coherent session IDs everywhere, fixing issues with MCP sampling in health checks and session rename requests.

Changes:

  • Added session_id parameter to all Provider trait methods and implementations
  • Removed McpMeta struct in favor of direct session_id parameter in MCP client trait
  • Updated API client to inject session IDs into HTTP headers explicitly
  • Added comprehensive test coverage via ACP integration tests

Reviewed changes

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

Show a summary per file
File Description
crates/goose/src/providers/base.rs Added session_id parameter to Provider trait methods (complete, stream, etc.)
crates/goose/src/providers/api_client.rs Updated to require session_id in request builders, removed task-local lookup
crates/goose/src/agents/mcp_client.rs Removed McpMeta, added session resolution logic with fallbacks, updated all MCP methods
crates/goose/src/agents/extension_manager.rs Propagated session_id through all extension operations
crates/goose/src/session/session_manager.rs Updated generate_session_name to pass session_id
crates/goose/src/scheduler.rs Removed session_context wrapper (session_id now in SessionConfig)
crates/goose-acp/tests/common.rs Added session ID validation fixtures for integration tests
Provider implementations (20+ files) Updated all providers to accept and propagate session_id parameter
Test files Updated all tests to provide explicit session_id values

@michaelneale
Copy link
Collaborator

I think this is ok, I think @zanesq and @DOsinga should give their blessing as fairly cross cutting but should flush out some weirdness.

One small conflict to resolve, and that live test failure is a one off I think... worth retrying.

Copilot AI review requested due to automatic review settings January 21, 2026 03:50
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 60 out of 61 changed files in this pull request and generated 1 comment.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
Signed-off-by: Adrian Cole <adrian@tetrate.io>
Copilot AI review requested due to automatic review settings January 21, 2026 23:37
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 60 out of 61 changed files in this pull request and generated no new comments.

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.

this seems necessary and ok - if can work out about live failure (not likely related)

@codefromthecrypt
Copy link
Collaborator Author

the live one must have been a flake. merging this one in as without it sessions are lost through acp and also we have some edge cases even in normal paths (like session rename) which have incoherent session id propagation.

@codefromthecrypt codefromthecrypt merged commit 67de49a into main Jan 22, 2026
38 of 41 checks passed
@codefromthecrypt codefromthecrypt deleted the session-propagation branch January 22, 2026 00:28
michaelneale added a commit that referenced this pull request Jan 22, 2026
* main:
  chore: tweak release docs (#6571)
  fix(goose): propagate session_id across providers and MCP (#6584)
lifeizhou-ap added a commit that referenced this pull request Jan 22, 2026
* main: (41 commits)
  chore: tweak release docs (#6571)
  fix(goose): propagate session_id across providers and MCP (#6584)
  increase worker threads for ci (#6614)
  docs: todo tutorial update (#6613)
  Added goose doc map md file for goose agent to find relevant doc easily. (#6598)
  add back goose branding to home (#6617)
  fix: actually set the working dir for extensions from session (#6612)
  Multi chat (#6428)
  Lifei/fixed accumulated token count (#6587)
  Dont show MCP UI/Apps until tool is approved (#6492)
  docs: max tokens config (#6596)
  User configurable templates (#6420)
  docs: http proxy environment variables (#6594)
  feat: exclude subagent tool from code_execution filtering (#6531)
  Fix path for global agent skills (#6591)
  recipes: add mcp server (#6552)
  feat(gcp-vertex): add model list with org policy filtering (#6393)
  chore: encourage extension searching (#6582)
  blog: mobile apps consolidation and roadmap (#6580)
  chore: remove unused dependencies in cargo.toml (#6561)
  ...
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