Skip to content

fix: resume terminal uninstall cleanup - #13

Draft
kossoy wants to merge 1 commit into
mainfrom
issue-12-resumable-terminal-cleanup
Draft

kossoy wants to merge 1 commit into
mainfrom
issue-12-resumable-terminal-cleanup

Conversation

@kossoy

@kossoy kossoy commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • atomically relocate the validated install receipt to a fixed terminal receipt before directory cleanup
  • resume terminal cleanup when the original receipt is gone, while deleting terminal authority only after every owned leaf is absent
  • retain terminal authority after interrupted cleanup or rmdir failure so uninstall can be retried safely
  • continue rejecting arbitrary empty metadata roots and preserve harness/skills/shared metadata ancestors

Verification

  • ./scripts/verify-outcome.sh (78 tests passed)
  • focused multi-harness matrix (18 tests passed)
  • interruption immediately after receipt relocation
  • injected metadata rmdir failure followed by successful retry
  • arbitrary empty metadata root remains rejected
  • shellcheck, compileall, and git diff --check

No live harness installation or deployment was performed.

Closes #12


Note

Medium Risk
Changes receipt lifecycle and uninstall state machine for isolated skill installs; mistakes could leave orphaned metadata or skip cleanup, but behavior is heavily tested and fail-closed on ambiguous receipt state.

Overview
Uninstall can now resume safely after interruption or partial cleanup by introducing a terminal receipt (.dev-workflow/{harness}-uninstall-receipt.json).

After quarantine file removal, the install receipt is renamed to that terminal path before empty-directory cleanup runs. A retry reads the terminal receipt instead of the original, skips re-staging owned files, and only deletes the terminal receipt once quarantine, skill leaf dirs, and harness metadata are all gone—otherwise it raises cleanup is incomplete and leaves the terminal receipt for another attempt.

Install also fails closed if the terminal receipt path already exists, alongside the existing metadata-root check. Tests cover interrupt right after receipt relocation, injected rmdir failure with successful retry, and rejecting installs when an empty harness metadata directory was created manually.

Reviewed by Cursor Bugbot for commit 0695a0a. Bugbot is set up for automated code reviews on this repo. Configure here.

Greptile Summary

This change preserves uninstall ownership information after installed files have been removed but before empty directories are fully pruned, so a later uninstall can safely resume cleanup. Filesystem checks exercised an interruption immediately after receipt relocation, a transient metadata-directory removal failure, retained terminal authority, retry cleanup, reinstall, and final uninstall. Those paths completed as intended, and no defects were found.

Confidence Score: 5/5

Safe to merge based on focused filesystem recovery validation and passing targeted recovery tests.

The exercised interruption and transient cleanup-failure paths retained uninstall authority, completed correctly on retry, and allowed a clean subsequent reinstall and uninstall without reproducing a defect.

Files Needing Attention: No additional files need attention; the reviewed changes are limited to dev_workflow/bundle.py and tests/test_multiharness_bundle.py.

T-Rex T-Rex Logs

What T-Rex did

  • Ran the terminal receipt filesystem validation script in the repository; it exited with code 0 and validated both relocation-interruption and metadata-cleanup failure flows, including terminal authority blocking, retry cleanup, reinstall, and final uninstall.
  • Executed the targeted multiharness bundle tests for interrupted-after-receipt relocation resumption and terminal rmdir failure retaining receipt for retry; both tests exited with code 0 and passed.

View all artifacts

T-Rex Ran code and verified through T-Rex

Reviews (1): Last reviewed commit: "fix: resume terminal uninstall cleanup" | Re-trigger Greptile

@kossoy
kossoy marked this pull request as draft August 31, 2026 13:16
@kossoy

kossoy commented Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

Independent review BLOCK: a canonical terminal receipt copied into a fresh target is accepted without genuine quarantine/phase provenance and can delete arbitrary pre-existing empty metadata and selected-skill leaf directories. Keep this PR draft. Required follow-up: bind terminal resume to durable install/quarantine provenance and add the copied-receipt adversarial regression. Core three-harness questionnaire skills and deterministic packaging are already merged; no live install has occurred.

@kossoy
kossoy force-pushed the issue-12-resumable-terminal-cleanup branch from 0695a0a to e8cbbd0 Compare November 21, 2026 13:15
@kossoy

kossoy commented Nov 21, 2026

Copy link
Copy Markdown
Contributor Author

Parked 2026-11-21: rebased once; resumes when the project is reactivated.

@kossoy
kossoy force-pushed the issue-12-resumable-terminal-cleanup branch from e8cbbd0 to 0695a0a Compare November 21, 2026 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make selective uninstall terminal cleanup resumable

1 participant