fix(issue-10,11,13,15): complete agy purge, orchestrator purge, workspace-anchored registry

Issue #10 - agy purge_artifacts left resumable pieces behind: it now also
removes the SQLite sidecars (-wal/-shm/-journal), the title annotation and
the presence lock (the lock only once no live process references the
conversation), and residual_artifacts() reports anything under
~/.gemini/antigravity-cli still carrying the uuid.

Issue #13 - the orchestrator has no herdr_sessions row, so its conversation
could not be purged by any skill. `lib_py.agents purge <agent|auto> <uuid>`
resolves the adapter from what is on disk (orchestrator_uuids stores bare
uuids), refuses while a live process names the uuid (conversation_in_use:
process list minus the caller's own lineage, plus lsof), and prints what it
purged. `orc_onboard.sh --remove <uuid> --purge-conversation --yes [--agent]`
runs it before the registry update so a refusal changes nothing (exit 4
without --yes, 5 while in use).

Issue #11 - "Successfully removeed": conjugate add/remove explicitly.

Issue #15 - the job registry and audit log followed the caller's cwd, so the
pytest suite (create_session.sh with its default onboarding job, run from the
repo root) had left 593 test records in the real .mam/jobs. Defaults now
resolve MAM_JOBS_DIR / DELEGATE_JOB_LOGS_DIR, then $WORKSPACE_ROOT/.mam/...,
then the cwd (mqtt_common.default_registry_dir / get_logs_dir; registry.py,
publish_event.py, service.py, create_session.sh, stop_session.sh); the
sandbox fixture pins both. The tier suites that used to leak now leave the
real registry untouched (881 records before and after).

Tests: test_issue10_13_purge.py (13), test_issue15_registry_isolation.py (7);
T-O13 pins the corrected message; the R1 helper test and B-9 logs-dir test
now assert the workspace-anchored contract; publish_event snapshot updated.

Refs #10 #11 #13 #15

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VCgu9Fa9iT7TbJUSzdq4Ff
This commit is contained in:
GodopuandClaude Fable 5.1 committed 2026-09-13 08:18:56 +09:00
1 parent bd3df890dc
commit c82ea75a15
20 files changed
+723 -33

No files matched your search

+12 -3
View File
@@ -314,7 +314,9 @@ def test_publish_event_cli_contract_snapshot(mam_sandbox):
# Defaults that shell and wrapper callers depend on.
src = Path(publish_event.__file__).read_text(encoding="utf-8")
assert '"--attempts", type=int, default=3' in src
assert '"--registry-dir", default=DEFAULT_REGISTRY_DIR' in src
# Issue #15: resolved per process (MAM_JOBS_DIR, then WORKSPACE_ROOT, then
# the cwd-relative DEFAULT_REGISTRY_DIR) instead of the bare constant.
assert '"--registry-dir", default=default_registry_dir()' in src
assert '"--event", default="progress", choices=VALID_EVENTS' in src
@@ -1063,8 +1065,15 @@ def test_r1_shell_helper_ignores_a_lib_py_in_the_working_directory(mam_sandbox,
assert res.returncode == 0, res.stderr
job_id = res.stdout.strip()
assert re.fullmatch(r"[0-9a-f]+", job_id), repr(res.stdout)
assert (decoy / ".mam" / "jobs" / (job_id + ".json")).exists(), (
"the real cli should have registered the job in the cwd registry"
# Issue #15: the registry follows MAM_JOBS_DIR / WORKSPACE_ROOT (both point
# at the sandbox here), no longer the cwd — the decoy workspace's own
# .mam/jobs must stay empty.
registry = Path(env["MAM_JOBS_DIR"])
assert (registry / (job_id + ".json")).exists(), (
"the real cli should have registered the job in the sandbox registry"
)
assert not (decoy / ".mam" / "jobs" / (job_id + ".json")).exists(), (
"the job must not be registered relative to the cwd"
)