Skip to content

fix: restore provider and extensions for LRU-evicted sessions#7616

Merged
wpfleger96 merged 1 commit intomainfrom
wpfleger/restore-provider
Mar 4, 2026
Merged

fix: restore provider and extensions for LRU-evicted sessions#7616
wpfleger96 merged 1 commit intomainfrom
wpfleger/restore-provider

Conversation

@wpfleger96
Copy link
Copy Markdown
Collaborator

@wpfleger96 wpfleger96 commented Mar 3, 2026

Restores provider and MCP extensions for sessions re-created after LRU eviction. When AgentManager::get_or_create_agent creates a new agent for an evicted session, the new agent was a blank shell — the session data was persisted in SQLite but never read back, causing /reply to immediately fail with "Provider not set". This fix makes get_or_create_agent session-aware.

  • In get_or_create_agent, load session from DB when creating a new agent; if provider_name is persisted, call restore_provider_from_session and load_extensions_from_session concurrently
  • Fall through to default_provider only if no session state was found (preserving behavior for genuinely new sessions)
  • Provider restoration failure logs a warning and continues; the default provider fallback still applies

Closes #7615

@wpfleger96 wpfleger96 force-pushed the wpfleger/restore-provider branch from 5bd6742 to aef6636 Compare March 3, 2026 05:21
@wpfleger96 wpfleger96 marked this pull request as ready for review March 3, 2026 05:23
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: aef6636684

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@wpfleger96 wpfleger96 force-pushed the wpfleger/restore-provider branch from aef6636 to 1f5d1eb Compare March 3, 2026 05:29
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1f5d1eb8f9

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@wpfleger96 wpfleger96 force-pushed the wpfleger/restore-provider branch from 1f5d1eb to ff28b37 Compare March 3, 2026 05:45
@wpfleger96 wpfleger96 enabled auto-merge March 3, 2026 05:46
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ff28b37615

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

When a session is evicted from the AgentManager LRU cache and a new
/reply arrives, get_or_create_agent was creating a blank agent with
no provider or extensions. The session data is persisted in SQLite
but was never read back on re-creation.

Now get_or_create_agent checks for existing session state before
falling back to the default provider. For evicted sessions with
a persisted provider, it calls restore_provider_from_session and
load_extensions_from_session concurrently — the same restoration
pattern used by restart_agent_internal.

Closes #7615
@wpfleger96 wpfleger96 force-pushed the wpfleger/restore-provider branch from ff28b37 to 21dfc9c Compare March 3, 2026 05:53
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 21dfc9c19d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@wpfleger96 wpfleger96 added this pull request to the merge queue Mar 4, 2026
Merged via the queue into main with commit d883e6e Mar 4, 2026
20 of 21 checks passed
@wpfleger96 wpfleger96 deleted the wpfleger/restore-provider branch March 4, 2026 00:49
tlongwell-block added a commit that referenced this pull request Mar 4, 2026
* origin/main:
  fix: restore provider and extensions for LRU-evicted sessions (#7616)
  Restore goosed logging (#7622)
lifeizhou-ap added a commit that referenced this pull request Mar 4, 2026
* main:
  docs: add GOOSE_INPUT_LIMIT environment variable documentation (#7299)
  Merge platform/builtin extensions (#7630)
  Clean up stale references to removed components (#7644)
  fix: scope empty session reuse to current window to prevent session mixing (#7602)
  fix: prevent abort in local inference  (#7633)
  Revert git patch for llama-cpp-2 (#7642)
  docs: update recipe usage step to reflect auto-submit behavior (#7639)
  docs: add guide for customizing the sidebar (#7638)
  docs: update Claude Code approve behavior and model list in cli-providers guide (#7448)
  fix: restore provider and extensions for LRU-evicted sessions (#7616)
  Restore goosed logging (#7622)
craigwalkeruk pushed a commit to craigwalkeruk/custom-goose that referenced this pull request Mar 5, 2026
tlongwell-block added a commit that referenced this pull request Mar 5, 2026
* origin/main: (107 commits)
  Merge platform/builtin extensions (#7630)
  Clean up stale references to removed components (#7644)
  fix: scope empty session reuse to current window to prevent session mixing (#7602)
  fix: prevent abort in local inference  (#7633)
  Revert git patch for llama-cpp-2 (#7642)
  docs: update recipe usage step to reflect auto-submit behavior (#7639)
  docs: add guide for customizing the sidebar (#7638)
  docs: update Claude Code approve behavior and model list in cli-providers guide (#7448)
  fix: restore provider and extensions for LRU-evicted sessions (#7616)
  Restore goosed logging (#7622)
  feat: return structured {stdout, stderr} from shell tool with output schema (#7604)
  Improve custom provider creation experience (#7541)
  fix(scheduler): schedules added via CLI showing up in UI (#7594)
  chore: openai reasoning model cleanup (#7529)
  chore(deps): bump hono from 4.12.1 to 4.12.3 in /evals/open-model-gym/mcp-harness (#7585)
  chore(deps): bump minimatch from 10.1.1 to 10.2.3 in /evals/open-model-gym/suite (#7498)
  chore(deps): bump swiper from 11.2.10 to 12.1.2 in /documentation (#7368)
  Better network failure error & antrhopic retry (#7595)
  feat: make the text bar persistent and add a queue for messages (#7560)
  fix: outdated clippy command in goosehints (#7590)
  ...

# Conflicts:
#	Cargo.lock
#	Cargo.toml
#	crates/goose-server/src/commands/agent.rs
#	crates/goose-server/src/main.rs
#	crates/goose-server/src/routes/reply.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.

get_or_create_agent should restore session state on LRU re-creation

2 participants