aaif-goose / aaif-goose/goose

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

Offen
#12,001 0 Kommentare 0 Reaktionen 1 zugewiesene Person Beansprucht von @filipkujawa Auf GitHub ansehen
Vorherrschende Sprache
Rust
Sterne
54.2k
Forks
6.2k
Ø Merge
3 T. 4 Std.
Gemergte PRs (30 T.)
240

Beschreibung

## 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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Das Issue befindet sich in crates/goose/src/agents/agent.rs ungefähr in den Zeilen 1208-1215 und 1264, wo session.extension_data geladen wird. Untersuche zunächst die Funktion EnabledExtensionsState::from_extension_data und die Datenstruktur der Session. Die Behebung umfasst das Filtern der extension_data-Schlüssel anhand der aktuell aktivierten Extensions aus der Konfiguration des Benutzers. Prüfe, wie Extensions konfiguriert und geladen werden, um die Filterlogik zu verstehen. Ein Test sollte überprüfen, dass Daten deaktivierter Extensions nicht in den Modellkontext injiziert werden.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Bereich
ai-infra-agents, backend
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Aktiv
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
65/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.