Files
magpie/internal/sessions/agy_held_other.go
T
yetone 29d0ab39fb sessions: Antigravity CLI (agy) sessions can be deleted (ysm119 on Discord)
ysm119 (#help) could delete Codex sessions on the Sessions page but not
agy's, and wanted to clear out empty ones. A delete now moves a
conversation to magpie's trash the way agy's own /resume delete (F4)
removes it: brain/<id>/, conversations/<id>.db with the -wal, -shm and
-journal SQLite leaves beside it, and annotations/<id>.pbtxt. Restore puts
them back.

What agy keeps of a conversation, read from real agy 1.4.12 in a sandbox
HOME against a fake Gemini endpoint (the live ~/.gemini was only read):
the files above, presence/<id>.lock, a row in conversation_summaries.db,
an entry in jetbox_summaries_proto.pb, and cache/last_conversations.json.
agy's own delete removes the files, the row and the jetbox entry. It
leaves the lock and last_conversations.json. magpie leaves the row and
jetbox entry too, because agy keeps both files open and jetbox is an
unknown protobuf. agy's /resume list leaves out a row whose files are
gone, so it never lists a deleted conversation.

A conversation agy has open is not deleted: agy flocks presence/<id>.lock
for as long as it has it open, idle too, and a held lock (or one that
can't be tried) is ErrActive. On Windows how agy locks it hasn't been seen,
so the minute since a write decides there alone.

Siblings: Hermes, Alma, OpenCode, ZCode, Cline, Grok Build, Kimi Code and
Claude Desktop (Cowork) sessions still can't be deleted. Each keeps an
index magpie would have to edit or leave stale; filed as #4595 with what
each needs.

Run at d018b9302 (on origin/main c30d3b7b6), then rebased onto 2cca11176,
which changes internal/gateway only; go test ./internal/sessions passed
again at the pushed head:
- mote: gofmt -l internal/sessions clean; go vet ./internal/sessions
  (darwin, GOOS=linux -tags nogui, GOOS=windows -tags nogui); go build
  ./... and the linux/windows nogui builds: ok.
- mote: go test -tags nogui -count=1 -timeout 45m ./...: 82 packages ok,
  internal/gui red only on TestSettingsSaveKeepsWhatItDoesNotSend (#4514)
  and TestColdTurnsTaken (#4510), both filed before and untouched here.
  go test ./internal/gui alone also showed TestMainWindowCorners (#3949).
- Windows (win-run): go test -run Agy ./internal/sessions: both new tests
  pass. TestAgySessions and TestAgyRowOnly are red there already (#4115,
  a /work cwd read as \work).
- Real agy 1.4.12 in a sandbox HOME, with a test binary built from this
  tree: Delete of one of three conversations moved its brain folder,
  .db and .pbtxt. agy's /resume then listed 2 of 3 and Other "No
  conversations available". Restore brought it back, and /resume listed 3.
  Before this, with the files moved by hand, `agy --conversation <id>`
  resumed a restored conversation and appended to it.

Broken by hand (each red in TestAgyDeleteRestore/TestAgyDeleteRowOnly):
agy taken out of Deletable; the presence-lock check turned off (a
conversation agy has open was deleted); only <id>.db moved, not its
-wal/-shm (a fresh -wal wasn't seen as recent, and they'd be left behind).

Not tried: agy on Windows or Linux for real; the GUI suite (no GUI file
changed: the Sessions page shows Delete from /api/sessions/manage's
deletable flag).
2026-10-31 23:10:48 +08:00

8 lines
228 B
Go

//go:build !unix
package sessions
// agyHeld: how agy locks a conversation it has open on Windows hasn't been
// seen, so there the minute since its files were written decides alone.
func agyHeld(string) bool { return false }