aaif-goose / aaif-goose/goose

Disabled extensions' stale state persists in session extension_data and gets injected into model context

Ouverte
#12,001 0 commentaires 0 réactions 1 personne assignée Réclamée par @filipkujawa Voir sur GitHub
Langage dominant
Rust
Étoiles
54.2k
Forks
6.2k
Merge moyen
3 j 2 h
PR mergées (30 j)
262

Description

## Summary

When an extension (e.g. `todo`) is enabled, used in a session, then later disabled in config, its state persists in the session's `extension_data` JSON field. On every subsequent session load, the stale state is read back via `EnabledExtensionsState::from_extension_data` and injected into the model's context, causing the model to auto-resume old tasks for previous requests from the user instead of responding to the user's actual current message.

## Root cause

In `crates/goose/src/agents/agent.rs`, the session's `extension_data` is loaded unconditionally at lines ~1208-1215 and ~1264:

```rust
let extensions_state = EnabledExtensionsState::from_extension_data(&session.extension_data);
```

There is no check to skip `extension_data` entries for extensions that are currently disabled in the user's config. The `todo.v0` key persists in `extension_data` even after the `todo` extension is set to `enabled: false` in `config.yaml`.

## Reproduction

1. Enable the `todo` extension in `config.yaml`
2. Start a session and have the model generate a TODO list with unchecked items
3. Disable the `todo` extension in `config.yaml` (`enabled: false`)
4. Restart Goose and resume the session
5. Send a trivial message like "Hello, respond only with Hello"
6. The model will begin executing unchecked TODO items instead of responding to the greeting

## Evidence

- 5 sessions on the reporting machine have non-empty TODO lists with unchecked items in `extension_data` despite the `todo` extension being disabled in config
- In the primary affected session, sending "Hello, respond only with Hello" caused the model to start reading and editing a grievance document, an unchecked TODO item, instead of responding to the greeting
- Clearing `todo.v0` from `extension_data` resolves the behavior immediately

## Proposed fix

In `agent.rs`, filter out `extension_data` entries for extensions that are currently disabled before passing them to `EnabledExtensionsState::from_extension_data`. This prevents stale state from disabled extensions from being injected into the model's context.

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.