Skip to content

Conversation

@zanesq
Copy link
Collaborator

@zanesq zanesq commented Dec 10, 2025

Summary

Changing working dir restarts the agent and sets it to the session
Extensions serve as new chat defaults and can be applied before starting a new chat or during chat.
Extensions are loaded server side now with the agent startup

Pre-requisite for multichat

Kapture.2025-12-10.at.14.20.00.mp4

* 'main' of github.com:block/goose: (21 commits)
  Hide recipe icon in empty chat (#6022)
  docs: provider and model config (#6008)
  Show modal selector after configuring a provider (#6005)
  docs: additional mcp sampling resources (#6020)
  Flutter PR Code Review (#6011)
  feat(mcp): elicitation support (#5965)
  Onboarding detect provider from api key (#5955)
  Fix PATH on Windows for extensions (#6000)
  recipe(datahub): Add a recipe for searching & understanding data in DataHub (#5859)
  fix params not being substituted in activities (#5992)
  blog: MCP Sampling (#5987)
  Update Anthropic and Google Gemini models to latest API versions (#5980)
  docs: chat recall tutorial (#5975)
  fix: `final assistant content cannot end with trailing whitespace` error from Anthropic (#5967)
  5527 multiple file popups (#5905)
  Groq configure fix  (#5833)
  added sidebar contextual information for firefox (#5433)
  docs: council of mine MCP (#5979)
  docs: nano banana extension (#5977)
  fix: remove prompt change, read model from config (#5976)
  ...

# Conflicts:
#	ui/desktop/src/api/sdk.gen.ts
#	ui/desktop/src/components/bottom_menu/DirSwitcher.tsx
* 'main' of github.com:block/goose:
  blog: How to stop your ai agent from making unwanted code changes (#6055)
  Fix typo in prompt (#6007)
  Docs for new terminal integration feature (#6042)
  fix: linux goosed crashing libssl error (#6051)
  chore(release): release version 1.16.0 (minor) (#5985)
  fix: metrics on posthog (#6024)
  gov: new LF Projects LLC section (#6027)
  Cleanup: Remove Recipe Key Flow (#6015)
  chore(deps): bump mdast-util-to-hast from 13.2.0 to 13.2.1 in /documentation (#5963)
  remove problematic corrupted woff font (#6006)
  Added search bar / filtering for recipes (#6019)
@zanesq zanesq requested a review from DOsinga December 10, 2025 21:11
@zanesq zanesq marked this pull request as draft December 11, 2025 19:15
@zanesq
Copy link
Collaborator Author

zanesq commented Dec 11, 2025

Put in draft while I work on a few more places using working dir that need to be addressed.

@zanesq zanesq marked this pull request as ready for review December 11, 2025 19:36
…en when multiple sessions are active concurrently
@zanesq zanesq mentioned this pull request Dec 11, 2025
zanesq and others added 2 commits December 12, 2025 16:18
* 'main' of github.com:block/goose: (22 commits)
  Disallow subagents with no extensions (#5825)
  chore(deps): bump js-yaml in /documentation (#6093)
  feat: external goosed server (#5978)
  fix: Make datetime info message more explicit to prevent LLM confusion about current year (#6101)
  refactor: unify subagent and subrecipe tools into single tool (#5893)
  goose repo is too big for the issue solver workflow worker (#6099)
  fix: use system not developer role in db (#6098)
  Add /goose issue solver github workflow (#6068)
  OpenAI responses streaming (#5837)
  Canonical models for Providers (#5694)
  feat: add Inception provider for Mercury models (#6029)
  fix old sessions with tool results not loading (#6094)
  Fix community page mobile responsiveness and horizontal overflow (#6082)
  Tool reply meta (#6074)
  chore: avoid accidentally using native tls again (#6086)
  Update vars to be capitalised to be in line with other variables in config file (#6085)
  docs: restructure recipe reference (#5972)
  docs: configure custom providers (#6044)
  docs: Community All-Stars Spotlight November 2025, CodeTV Hackathon edition (#6070)
  fix: include file attachments in queued messages (#5961)
  ...

# Conflicts:
#	crates/goose-server/src/routes/agent.rs
#	crates/goose/src/agents/extension_manager.rs
#	ui/desktop/src/api/sdk.gen.ts
Copy link
Collaborator

@DOsinga DOsinga left a comment

Choose a reason for hiding this comment

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

this does feel like the right direction, but I think we need to consider some archtectual decisions here:
* an agent should have a working dir and that should be synced with the session. this is the working dir an extension should use when it is added. adding an extension with a working dir seems odd to me
* the current working dir in the app outside of a session is already a mess, we should not make it worse. I think the best we can do is just always use the last used working dir and set that when the user changes the working dir. I don't like that mechanism particularly either, but that is what we have.

also, we shouldn't restart the agent from the client, leave that as something the server can decide to do when the directory changes

a more fundamental problem is that we don't store the extensions of the agent in the session. so far that only showed as a problem when you restarted goose. but now that also shows up if you change directories. that one is tricky

@@ -0,0 +1,37 @@
// Store for new chat configuration
// Acts as a cache that can be updated from UI or synced from session
// Resets on page refresh - defaults to window.appConfig.get('GOOSE_WORKING_DIR')
Copy link
Collaborator

Choose a reason for hiding this comment

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

this doesn't seem like the way. this is yet another shadow settings thing. the way we handle GOOSE_WORKING_DIR is a complete mess, but we should fix that, not stack stuff on top

Copy link
Collaborator Author

@zanesq zanesq Dec 16, 2025

Choose a reason for hiding this comment

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

Good call, removed this and changed to use session as source of truth and pass working dir rather than cacheing it in 960285b

&self,
extension: ExtensionConfig,
working_dir: Option<std::path::PathBuf>,
) -> ExtensionResult<()> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

this doesn't feel great to me. an agent has a working_dir. if you add an extension and that extension needs to know what the working dir is, it should just get it from the agent

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Agreed, added working_dir to agent synced with session in this commit 6b4d570

* 'main' of github.com:block/goose: (22 commits)
  OpenRouter & Xai streaming (#5873)
  fix: resolve mcp-hermit cleanup path expansion issue (#5953)
  feat: add goose PR reviewer workflow (#6124)
  perf: Avoid repeated MCP queries during streaming responses (#6138)
  Fix YAML serialization for recipes with special characters (#5796)
  Add more posthog analytics (privacy aware) (#6122)
  docs: add Sugar MCP server to extensions registry (#6077)
  Fix tokenState loading on new sessions (#6129)
  bump bedrock dep versions (#6090)
  Don't persist ephemeral extensions when resuming sessions (#5974)
  chore(deps): bump mdast-util-to-hast from 13.2.0 to 13.2.1 in /ui/desktop (#5939)
  chore(deps): bump node-forge from 1.3.1 to 1.3.2 in /documentation (#5898)
  Add Scorecard supply-chain security workflow (#5810)
  Don't show subagent tool when we're a subagent (#6125)
  Fix keyboard shortcut conflict for Focus Goose Window (#5809)
  feat(goose-cli): add feature to disable update (#5886)
  workflow: enable docs-update-recipe-ref (#6132)
  fix: filter tools in Ollama streaming when chat mode is enabled (#6118)
  feat(mcp): platform extension for "code mode" MCP tool calling (#6030)
  workflow: auto-update recipe-reference on release (#5988)
  ...

# Conflicts:
#	ui/desktop/src/App.tsx
#	ui/desktop/src/api/sdk.gen.ts
#	ui/desktop/src/components/ChatInput.tsx
#	ui/desktop/src/components/recipes/RecipesView.tsx
@zanesq
Copy link
Collaborator Author

zanesq commented Dec 17, 2025

@DOsinga mind taking one more pass before I merge?

@zanesq zanesq requested a review from DOsinga December 17, 2025 16:11
* 'main' of github.com:block/goose: (28 commits)
  Clean PR preview sites from gh-pages branch history (#6161)
  fix: make goose reviewer less sycophantic (#6171)
  revert /reply to previous behavior (replacing session history) when full conversation provided (#6058)
  chore: manually update version (#6166)
  Integrate pricing with canonical model (#6130)
  Regenerate canonical models when release branch is created. (#6127)
  fix: use correct parameter name in read_module handler (#6148)
  docs: blog for code mode MCP (#6126)
  test: add ACP integration test (#6150)
  docs: auto download updates (#6163)
  fix: respect default_enabled value of platform extensions (#6159)
  docs: skills (#6062)
  fix: add conditional configuration for GOOSE_BIN_DIR in PATH (#5940)
  Update dependencies to help in Fedora packaging (#5835)
  fix: make goose reviewer less bad (#6154)
  docs: create/edit recipe button (#6145)
  fix(google): Fix 400 Bad Request error with Gemini 3 thought signatures (#6035)
  fix: we don't need to warn about tool count when in code mode (#6149)
  deps: upgrade agent-client-protocol to 0.9.0 (#6109)
  fix(providers): fix for gemini-cli on windows to work around cmd's multiline prompt limitations #5911 (#5966)
  ...

# Conflicts:
#	ui/desktop/src/api/sdk.gen.ts
#	ui/desktop/src/hooks/useAgent.ts
* 'main' of github.com:block/goose:
  Enhanced PostHog Error Tracking with Detailed Messages (#6176)

# Conflicts:
#	crates/goose-server/src/routes/agent.rs
zanesq added 5 commits January 5, 2026 11:56
* 'main' of github.com:block/goose:
  docs(blog): compress images to fix GitHub Pages deployment (#6339)
* 'main' of github.com:block/goose:
  refactor:  when changing provider/model,load existing provider/model (#6334)
  chore: refactor configure_extensions_dialog to reduce line count (#6277)
  chore: refactor handle_configure to reduce line count (#6276)
  chore: refactor interactive session to reduce line count (#6274)
  chore: refactor docx_tool to reduce function size (#6273)
  chore: refactor cli() function to reduce line count (#6272)
  make sure the models are using streaming properly (#6331)
  feat: add a max tokens env var (#6264)
  docs: slash commands topic (#6333)
  fix(ci): prevent gh-pages branch bloat (#6340)
  chore(deps): bump qs and body-parser in /documentation (#6338)
  Skip the smoke tests for dependabot PRs (#6337)
@zanesq zanesq requested a review from DOsinga January 6, 2026 16:19
zanesq added 6 commits January 6, 2026 13:09
* 'main' of github.com:block/goose:
  Claude 3.7 is out. we had some harcoded stuff (#6197)
  Release 1.19.0
  chore: upgrade to node v24 as engine (#6361)
  chore(deps): bump rsa from 0.9.9 to 0.9.10 (#6358)
  Bump rust toolchain to 1.92 (current stable) (#6356)
  Hide advanced recipe options under expandable content (#6021)
  fix: use .config/agents (plural) for skills directory (#6357)
  fix: prevent KaTeX from treating underscores as subscripts in plain text (#6242)
  fix: make goose review PRs more like goose contributors do (#6240)
  fix : preserve provider engine type when editing custom providers (#6106)
  feat(providers): add retry for model fetching (#6347)
  allow goose issue solver to react to activation comments (#6239)
Resolved conflicts:
- crates/goose/src/agents/extension_manager.rs: Keep normalize(&config_name) from branch, add duplicate extension check from main
- ui/desktop/src/App.tsx: Remove useAgent/loadCurrentChat (main removed it), keep simplified PairRouteWrapper from branch
- ui/desktop/src/components/ChatInput.tsx: Keep onWorkingDirChange prop and RestartingAgent state from branch
- ui/desktop/src/components/sessions/SessionListView.tsx: Keep getSessionExtensionNames from branch, add getSearchShortcutText from main
- ui/desktop/src/hooks/useAgent.ts: Deleted (main removed it, no longer used)
* 'main' of github.com:block/goose:
  Fixed fonts (#6389)
  Update confidence levels prompt injection detection to reduce false positive rates (#6390)
  Add ML-based prompt injection detection  (#5623)
  docs: update custom extensions tutorial (#6388)
  fix ResultsFormat error when loading old sessions (#6385)
  docs: add MCP Apps tutorial and documentation updates (#6384)
  changed z-index to make sure the search highlighter does not appear on modal overlay (#6386)
  Handling special claude model response in github copilot provider (#6369)
  fix: prevent duplicate rendering when tool returns both mcp-ui and mcp-apps resources (#6378)
  fix: update MCP Apps _meta.ui.resourceUri to use nested format (SEP-1865) (#6372)
  feat(providers): add streaming support for Google Gemini provider (#6191)
  Blog: edit links in mcp apps post (#6371)
  fix: prevent infinite loop of tool-input notifications in MCP Apps (#6374)
Copy link
Collaborator

@DOsinga DOsinga left a comment

Choose a reason for hiding this comment

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

so I am conflicted about this. If I am honest, this does not feel like the way we should do this. we're threading working_dir through many places and keeping track of the extensions we're adding to agents and starting them seems quite convoluted and somewhat messy.

on the other hand we do need something to fix the actual problem of not being able to change the working_dir

maybe we should write up a bit of document on how this all should work with sessions, agent isolation and a unified API /cc @baxen @codefromthecrypt


/// Load extensions from session into the agent
/// Skips extensions that are already loaded
pub async fn load_extensions_from_session(
Copy link
Collaborator

Choose a reason for hiding this comment

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

this function seems to be called only once, which doesn't seem right; shouldn't we be calling this everywhere where we start an agent? really I think this should be done through the agentmanager and we should just always use agent_for_session which would then get us the right agent.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We call it in 3 places in agent.rs start_agent, resume_agent and restart_agent_internal but good point we need a single "get me a fully configured agent for this session" method but I think it should be in a follow up larger refactor because there is a lot of considerations that need to be made (sub agents use parent's extensions not session extensions).

pub async fn add_extension(
&self,
extension: ExtensionConfig,
working_dir: Option<std::path::PathBuf>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think we should pass the working_dir in here and if we do, it shouldn't be optional; an agent should have one working_dir, this just makes it possible to have multiple source of the truth

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Agreed, removed and changed it to look it up from the session instead for now.

pub async fn add_extension(&self, extension: ExtensionConfig) -> ExtensionResult<()> {
/// Save current extension state to session by session_id
/// Simpler version of save_extension_state that just takes a session_id
pub async fn persist_extension_state(&self, session_id: &str) -> Result<()> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

why do we need this? shouldn't we just always when you call add_extension on agent write it to the session?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

good point, changed to do it in add_extension 👍

let working_dir = session.working_dir.clone();

// Try to load session-specific extensions first, fall back to global config
let session_extensions =
Copy link
Collaborator

Choose a reason for hiding this comment

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

we should not need to do this; the extensions should always be in the session, no?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the idea was backwards compatibility for when we didn't have extensions in sessions but I went ahead and removed that for now and logged it since its a rare case

@zanesq
Copy link
Collaborator Author

zanesq commented Jan 8, 2026

@DOsinga thanks for the review! I updated it to not thread working_dir everywhere and I think we're at a good middle ground for now to unblock multi chat. Definitely agree that we should come back to the overall vision in a follow up.

@zanesq zanesq changed the title Add support for changing working dir and extensions in same window Add support for changing working dir and extensions in same window/session Jan 9, 2026
@zanesq zanesq merged commit 9a01fcb into main Jan 9, 2026
19 checks passed
@zanesq zanesq deleted the zane/working-dir branch January 9, 2026 00:48
wpfleger96 added a commit that referenced this pull request Jan 9, 2026
* main: (89 commits)
  fix(google): treat signed text as regular content in streaming (#6400)
  Add frameDomains and baseUriDomains CSP support for MCP Apps (#6399)
  fix(ci): add missing dependencies to openapi-schema-check job (#6367)
  feat: http proxy support
  Add support for changing working dir and extensions in same window/session (#6057)
  Sort keys in canonical models (#6403)
  added validation and debug for invalid call tool result (#6368)
  Update MCP apps tutorial: fix _meta structure and version prereq (#6404)
  Fixed fonts (#6389)
  Update confidence levels prompt injection detection to reduce false positive rates (#6390)
  Add ML-based prompt injection detection  (#5623)
  docs: update custom extensions tutorial (#6388)
  fix ResultsFormat error when loading old sessions (#6385)
  docs: add MCP Apps tutorial and documentation updates (#6384)
  changed z-index to make sure the search highlighter does not appear on modal overlay (#6386)
  Handling special claude model response in github copilot provider (#6369)
  fix: prevent duplicate rendering when tool returns both mcp-ui and mcp-apps resources (#6378)
  fix: update MCP Apps _meta.ui.resourceUri to use nested format (SEP-1865) (#6372)
  feat(providers): add streaming support for Google Gemini provider (#6191)
  Blog: edit links in mcp apps post (#6371)
  ...
wpfleger96 added a commit that referenced this pull request Jan 9, 2026
* main: (89 commits)
  fix(google): treat signed text as regular content in streaming (#6400)
  Add frameDomains and baseUriDomains CSP support for MCP Apps (#6399)
  fix(ci): add missing dependencies to openapi-schema-check job (#6367)
  feat: http proxy support
  Add support for changing working dir and extensions in same window/session (#6057)
  Sort keys in canonical models (#6403)
  added validation and debug for invalid call tool result (#6368)
  Update MCP apps tutorial: fix _meta structure and version prereq (#6404)
  Fixed fonts (#6389)
  Update confidence levels prompt injection detection to reduce false positive rates (#6390)
  Add ML-based prompt injection detection  (#5623)
  docs: update custom extensions tutorial (#6388)
  fix ResultsFormat error when loading old sessions (#6385)
  docs: add MCP Apps tutorial and documentation updates (#6384)
  changed z-index to make sure the search highlighter does not appear on modal overlay (#6386)
  Handling special claude model response in github copilot provider (#6369)
  fix: prevent duplicate rendering when tool returns both mcp-ui and mcp-apps resources (#6378)
  fix: update MCP Apps _meta.ui.resourceUri to use nested format (SEP-1865) (#6372)
  feat(providers): add streaming support for Google Gemini provider (#6191)
  Blog: edit links in mcp apps post (#6371)
  ...
fbalicchia pushed a commit to fbalicchia/goose that referenced this pull request Jan 13, 2026
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