Skip to content

fix: uninstall when the control task is archived - #119

Merged
mergify[bot] merged 4 commits into
mainfrom
codex/BEAR-113-archived-control-uninstall
Aug 4, 2026
Merged

fix: uninstall when the control task is archived#119
mergify[bot] merged 4 commits into
mainfrom
codex/BEAR-113-archived-control-uninstall

Conversation

@ericlitman

@ericlitman ericlitman commented Aug 4, 2026

Copy link
Copy Markdown
Owner

Summary

Uninstall no longer depends on the persistent ThreadBear task being active. Before this change, archiving that task made its final title cleanup unreachable and stranded the installation; now any active native task can own a resumable uninstall, temporarily restore the archived home for cleanup, put it back exactly where it was, and remove ThreadBear without navigating away or using visual controls.

The prepared operation persists the exact initiator, main/controller identities, and original archive state. While it exists, maintenance, updates, and every ordinary title write stop; only cleanup writes from that initiator are accepted. Abort restores normal operation after archive recovery, and commit validates the clean main title plus restored archive state before removing state and the binary last.

Local teardown is checkpointed for interruption: pre-commit drift leaves every retry artifact intact, edited markerless managed guidance fails closed, and a retained candidate can finish or repeat the already-settled removal safely.

Fixes BEAR-113.

Linear: BEAR-113

Validation

  • go test ./...
  • go test -race ./...
  • go vet ./...
  • Darwin arm64 and amd64 cross-builds
  • experiment-registry, formatting, shell-syntax, installer/site parity, and diff checks
  • exact shipped-logic gate: 1,863 Go + 137 installer-shell = 2,000 lines

The exact final head (e30b61b064bd3351b37f3cce84fac884c7fa0a7a, arm64 SHA-256 b80dbd32587e2cc3d13e1db336e3838560c1f6bb6c958c298cc17450a5cbad40) was installed into the real Codex environment. A completed-install state was seeded only to isolate this uninstall canary from the unrelated historical migration backlog; prepare onward used the installed candidate and supported native controls. The live run proved:

  • archived home and distinct archived controller prepared from the active owner with exact ID readback;
  • a repeated-space native pass-through preserved the exact title bytes while retaining a normalized internal subject, and the original task title was restored;
  • a deliberately held-open repeated-space Pre transaction made uninstall prepare refuse the in-flight write; exact Post settlement allowed the same prepare to succeed;
  • plain Renamed and exact home-title writes were blocked by the installed hook while uninstall was prepared;
  • native unarchive, one hook-mediated explicit-target cleanup, supported title readback, and exact native re-archive;
  • same-owner resume without a duplicate title mutation;
  • edited markerless managed guidance failed before teardown and retained the binary, private state, installed skill, hooks, managed guidance, and retry path;
  • exact managed-file restoration recovered a healthy prepared state;
  • final commit completed, a retained candidate repeated completion as a no-op, and the binary, state, skill, hooks, managed guidance, and owned automation were absent afterward.

No visual inspection, screenshot, browser automation, or computer-control tool was used.

Monitoring

The shipped-logic count sits exactly at the 2,000-line hard ceiling, so CI intentionally rejects any additional production Go or installer-shell line until another shipped path is simplified.

@mobilyze-open-swe-studio2 mobilyze-open-swe-studio2 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Open SWE Review found 2 potential issues.

Open in Web

Comment thread cmd/threadbear/hook.go
Comment thread cmd/threadbear/install.go Outdated

@mobilyze-open-swe-studio2 mobilyze-open-swe-studio2 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Open SWE Review found 1 potential issue.

Open in Web

Comment thread cmd/threadbear/hook.go
@mergify

mergify Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • Entered queue2026-08-04 02:56 UTC · Rule: default · triggered by merge protections
  • Checks skipped · PR is already up-to-date
  • Merged2026-08-04 02:56 UTC · at e30b61b064bd3351b37f3cce84fac884c7fa0a7a

This pull request spent 19 seconds in the queue, including 5 seconds running CI.

Required conditions to merge
  • github-review-approved [🛡 GitHub repository ruleset rule Mergify automatic merge queue]
  • all of [🛡 Merge Protections rule Queue ready pull requests]:
  • any of [🛡 GitHub branch protection]:
    • check-success = verify
    • check-neutral = verify
    • check-skipped = verify
  • any of [🛡 GitHub branch protection]:
    • check-success = Open SWE Review
    • check-neutral = Open SWE Review
    • check-skipped = Open SWE Review
  • any of [🛡 GitHub repository ruleset rule Mergify automatic merge queue]:
    • check-success = @mergify/Mergify Merge Protections
    • check-neutral = @mergify/Mergify Merge Protections
    • check-skipped = @mergify/Mergify Merge Protections
  • any of [🛡 GitHub repository ruleset rule Review gate]:
    • check-success = Open SWE Review
    • check-neutral = Open SWE Review
    • check-skipped = Open SWE Review

@mergify
mergify Bot merged commit 5d1cf7b into main Aug 4, 2026
4 checks passed
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.

1 participant