fix(issue-10,13): check every agy artifact for holders and purge orphaned leftovers
Round-3 review of f5a6575 (planner-reviewer-codex-01, R1/R2).
R1 - the adapter's in-use check handed only the conversation DB to lsof, so a
holder that keeps the presence lock (or a sidecar) open while naming the uuid
on no command line and in no session variable was invisible, and the held
lock was unlinked from under it. AgyAgentAdapter.conversation_in_use now
passes every path of the conversation (DB, -wal/-shm/-journal, brain,
annotation, presence lock).
R2 - both resolver stages required the DB, so once an interrupted or pre-#10
purge had removed it, the WAL/annotation/lock left behind were "no artifact"
(exit 5) forever. BaseAgentAdapter.has_artifacts (default: a uuid-bearing
artifact path that exists) replaces the resolver's path fallback, and agy's
override accepts any of its pieces.
Tests: a flock holder that names the uuid nowhere is refused and nothing is
removed; orphaned leftovers resolve to agy and are purged. VERSIONS.md
v4.4.3 items 1-2 and orc-onboard SKILL.md updated.
Refs #10 #13
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VCgu9Fa9iT7TbJUSzdq4Ff
This commit is contained in:
1 parent
f5a6575bf2
commit
fae70c13d9
6 files changed
+90
-9
No files matched your search
@@ -1,6 +1,6 @@
|
||||
import os, sys, json, sqlite3, shutil
|
||||
from typing import Optional, Any
|
||||
from lib_py.agents.base import BaseAgentAdapter, DiscoveryContext
|
||||
from lib_py.agents.base import BaseAgentAdapter, DiscoveryContext, conversation_in_use
|
||||
|
||||
class AgyAgentAdapter(BaseAgentAdapter):
|
||||
@property
|
||||
@@ -74,6 +74,27 @@ class AgyAgentAdapter(BaseAgentAdapter):
|
||||
def _cli_root(self, ctx: DiscoveryContext) -> str:
|
||||
return f"{ctx.home_dir}/.gemini/antigravity-cli"
|
||||
|
||||
def _artifact_paths(self, uuid: str, ctx: DiscoveryContext) -> list:
|
||||
"""Every on-disk piece of one conversation, DB first: the SQLite
|
||||
sidecars, the brain dir, the title annotation and the presence lock."""
|
||||
db = self.artifact_path(uuid, ctx)
|
||||
root = self._cli_root(ctx)
|
||||
return ([db] + [f"{db}{suffix}" for suffix in ("-wal", "-shm", "-journal")]
|
||||
+ [f"{root}/brain/{uuid}", f"{root}/annotations/{uuid}.pbtxt",
|
||||
f"{root}/presence/{uuid}.lock"])
|
||||
|
||||
def has_artifacts(self, uuid: str, ctx: DiscoveryContext) -> bool:
|
||||
# Any piece counts, not only the DB: a purge that was interrupted (or
|
||||
# the pre-#10 purge) can leave a WAL, annotation or lock behind with
|
||||
# the DB already gone, and those orphans must still be reachable.
|
||||
return any(os.path.exists(p) for p in self._artifact_paths(uuid, ctx))
|
||||
|
||||
def conversation_in_use(self, uuid: str, ctx: DiscoveryContext) -> bool:
|
||||
# The holder may keep the presence lock (or a sidecar) open rather
|
||||
# than the DB, and may name the uuid nowhere; the lsof leg of the
|
||||
# check must see every path of the conversation.
|
||||
return conversation_in_use(uuid, self._artifact_paths(uuid, ctx))
|
||||
|
||||
def purge_artifacts(self, uuid: str, ctx: DiscoveryContext) -> list:
|
||||
# Issue #10: a purge must leave nothing resumable behind. Besides the
|
||||
# conversation DB and the brain dir, agy keeps SQLite sidecars (-wal /
|
||||
|
||||
Reference in new issue
Block a user