goose
goose copied to clipboard
Don't persist ephemeral extensions when resuming sessions
Fixes #5973
Summary
When resuming sessions with ephemeral extensions (added via --with-extension) or recipe extensions, they should be restored for the session only, not permanently saved to config. Otherwise the user ends up with a duplicate garbage extension entry in ~/.config/goose/config.yaml:
goose session --with-extension "uvx mcp_gdrive@latest"
# ... do work, exit session ...
goose session --resume --session-id <id>
# Prompt: "Extension(s) mcpgdrive_sgoMpj77 from previous session are no longer in config. Re-add them to config?"
# Answer: Yes
now ~/.config/goose/config.yaml has:
mcpgdrivelatest_gbtrm2lw:
enabled: true
type: stdio
name: mcpgdrivelatest_gBtrm2lw
description: ''
cmd: uvx
args:
- mcp_gdrive@latest
envs: {}
env_keys: []
timeout: 300
bundled: null
available_tools: []
Changes
- Updated prompt message: "Restore for this session?" (was "Re-add them to config?")
- Removed
set_extension()call that wrote to config.yaml - Cleaned up unused imports
Root cause
check_missing_extensions_or_exit() called set_extension() which writes to config.yaml. Unnecessary since extensions are already restored from saved_state.extensions.