block / goose

Goose is a developer agent that operates from your command line to help you do the boring stuff.
https://block.github.io/goose/
Apache License 2.0
108 stars 17 forks source link

fix: correct context loading from session new/overwrite and resume #180

Open lamchau opened 2 days ago

lamchau commented 2 days ago

This fix corrects session handling with the overwrite session prompt.

Previously overwriting a session didn't

  1. clear the context (which we load at init) https://github.com/block-open-source/goose/blob/7749b8aaf4390a83068045dd98f63345ed9566d9/src/goose/cli/session.py#L95
  2. clear the session file when we write immediately (#94)
  3. missing test case when adding guards (#101)
  4. edge case when resuming a session (#145)

Steps to reproduce

$ uv run goose session start aaaa
PLEASE NOTE: the ollama provider is experimental, use with care
Session already exists at /Users/lam/.config/goose/sessions/aaaa.jsonl.
Would you like to overwrite it?

  [y]es      Overwrite the existing session
  [n]o       Pick a new session name
  [r]esume   Resume the existing session

Enter your choice: y
Overwriting existing session
session size: 4

The expected session size should be 0 (or empty).