Skip to content

feat(storage): suspend and restore settled worktrees - #508

Merged
lastobelus merged 14 commits into
lastcode/mainfrom
lastcode/suspend-worktrees
Oct 26, 2026
Merged

lastobelus merged 14 commits into
lastcode/mainfrom
lastcode/suspend-worktrees

Conversation

@lastobelus

@lastobelus lastobelus commented Oct 26, 2026 •

Copy link
Copy Markdown
Owner

Finished subagents leave worktrees on disk. Deleting them loses local changes, and archiving a long-lived parent just to reclaim space is the wrong tradeoff. This adds Suspend worktrees and Restore worktree so space can be reclaimed while the work stays recoverable.

What changed

  • Suspend / restore: suspending saves local files, the index, and the Git revision, then removes an eligible managed checkout. Continuing work restores it.
  • Automatic suspension: off by default. Users opt in by choosing a delay and which thread types qualify.
  • Automatic safeguards: active work and Keep workspace holds are protected; insufficient participation or lineage evidence does not qualify a thread.
  • Storage page: one page covers suspension, saved-workspace management, and the separate permanent-deletion rules.
  • Thread/project removal: explicit keep/discard choices for the saved recovery data.
  • Safe acquisition: provider turns, terminals, editors, previews, actions, Git operations, and file writes either restore the worktree first or refuse safely.
  • Automatic cleanup CPU churn: event bursts are coalesced and a bounded set of roots is rotated, rather than repeatedly scanning every checkout.

Recovery limits

Recovery is local. It needs the saved data plus the original Git repository. It is not an off-machine backup.

Validation

  • CI: managed Quick CI passed on the exact published head and base. The ordinary hook reused that receipt.
  • Focused regressions: store, policy, controller, permission, lifecycle, and scheduler tests passed.
    • Final preview/permission integration run: 162 cases passed.
    • Recreation boundaries: 9 passed.
    • Mounted UI checks: 39 passed, plus 25 changed-module compiler checks.
  • Real isolated client run: suspend and restore preserved all 8 fixture entries (including a binary file, a symlink, and an ignored note), the staged and unstaged diff, and HEAD.
    • File modes were preserved too.
    • Earlier larger roundtrip and recovery checks apply only to the revisions they were run on.
  • Review: Astra High found 4 issues and Claude Opus 5.5 High found 5. All 9 were fixed and re-tested. The last review rounds still had findings, so the review is not reported as clean.

Not covered

  • Native mobile is deferred and untested.
  • No live deletion or install was run.
  • No claim about physical free space reclaimed.

UI evidence

Before shows the temporary copy-comparison draft, not the main-branch UI. After shows the accepted copy, with no settings saved during the comparison.

Before: comparison draft After: accepted copy
Earlier copy comparison Accepted suspension settings

Implemented with GPT-6.1 Sol through the Codex harness, with Astra High and Claude Opus 5.5 High review and Claude Sonnet 5.5 copy work.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T06:12:38.095784Z 8609279 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@lastobelus lastobelus changed the title feat(storage): suspend worktrees and restore local work feat(storage): suspend and restore settled worktrees Oct 26, 2026
@lastobelus

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ffd38fa09b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/web/src/components/worktreeSuspensionMenu.ts Outdated
Save local changes and Git recovery references before removing eligible checkouts, restore them on continuation, and provide explicit recovery disposal and workspace holds through one Storage page.

Carry-Group: incubator

Carry-Observation: The shared capture format, workspace acquisition guards, lifecycle commands, and clients form one inseparable feature.
Keep automatic inspection to four distinct worktree roots per pass with fair rotation, share that budget across resource types, and retain one necessary follow-up instead of repeatedly scanning the environment.

Carry-Group: incubator

Carry-Observation: These cleanup changes call and test the suspension service and must replay with the workspace lifecycle feature.
Keep shared branch changes usable, retain recovery authority after deleted recovery threads, isolate and bound suspension candidates, protect unknown participation, and align disposal permissions. Recreate verified missing registrations without pruning saved siblings or deleting newly occupied destinations.

Carry-Group: incubator
…passes

Keep deletion-triggered cleanup within the four-root budget while inspecting its target promptly. Run saved-workspace discovery only for scheduled, manual, and settings-triggered passes, coalescing pending work without renewing deferred roots.

Carry-Group: incubator

Carry-Observation: These cleanup changes call and test the suspension service and must replay with the workspace lifecycle feature.
Provide workspace acquisition to new preview fixtures, preserve typed filesystem failures in recreation tests, and align dashboard timestamps and service layers with current contracts.

Carry-Group: incubator
Keep the named Effect function while making its two internal request arguments explicit for current type inference.

Carry-Group: incubator

Carry-Observation: These cleanup changes call and test the suspension service and must replay with the workspace lifecycle feature.
Keep Restore worktree available while disabling hold changes until the checkout is active, matching the server guard.

Carry-Group: incubator
Provide attr, acl, and e2fsprogs in package and server test jobs, including release validation, so suspension safety checks can verify filesystem metadata.

Carry-Group: build-ci
Supply the current lifecycle confirmation and thread source contracts while retaining permission, Undo, and project-navigation coverage. Document the Linux metadata inspection prerequisites.

Carry-Group: incubator
Name the test setup step for both compiler and filesystem inspection requirements.

Carry-Group: build-ci
Assert provider bursts coalesce within the active cleanup pass. Observe the outer membership lock in launch fixtures and release the winning launch before awaiting the queued loser, retaining acceptance and replay assertions.

Carry-Group: incubator
@lastobelus
lastobelus force-pushed the lastcode/suspend-worktrees branch from ffd38fa to 0982d12 Compare October 26, 2026 05:09
@lastobelus

Copy link
Copy Markdown
Owner Author

Published the CI/integration repairs at 0982d12, based on bea65a3. The enabled ordinary push hook ran fresh Quick CI successfully for this exact head/base. Exact same-base carry replay also produced the expected tree. Linux CI and release jobs now install the metadata inspection utilities required by suspension verification; Linux acceptance remains pending GitHub CI. Focused repairs passed 104 web unit checks, 16 browser checks, 3 provider-burst cleanup cases, and 2 thread-launch lock cases; the refreshed Action/MCP/contract/shared integration run passed 106 cases. These supplement the earlier isolated suspend/restore evidence. Native mobile remains deferred and untested.

@lastobelus

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0982d1236b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/server/src/actionResume/ActionResume.ts
Acquire requested and restored workspace leases before terminal thread locks, including attachment startup. Reconcile idle checkout owners within the bounded sweep and keep lifecycle test milestones aligned with persistence and replay behavior. Keep internal suspension defaults and components private.

Carry-Group: incubator
Carry-Observation: These repairs depend on the suspension feature and its workspace acquisition service.
@lastobelus

Copy link
Copy Markdown
Owner Author

Published ac28fc0 on unchanged base bea65a3. The enabled ordinary push hook ran fresh Quick CI successfully for this exact pair, and exact same-base carry compilation passed. The unused-export lint failure is repaired. Bounded catalog reconciliation now includes idle entries so departed owners are released; all 40 suspension service tests passed. The MCP archive fixture now observes the outer persistence lock, and the replay assertion includes the current replay marker; both targeted tests passed with their lifecycle assertions retained. The terminal lock-order finding is addressed in the linked reply. GitHub CI and fresh review are still required. Native mobile remains deferred and untested.

@lastobelus

Copy link
Copy Markdown
Owner Author

@codex review

Register the temporary workspace root and await cleanup entering its lease before starting the cleanup-first provider case. Preserve both startup orderings and worktree recreation assertions.

Carry-Group: incubator
Carry-Observation: This fixture verifies provider acquisition against suspension workspace leases.
@lastobelus

Copy link
Copy Markdown
Owner Author

Test-only follow-up 6a89436: the provider cleanup/startup fixture now registers its temporary workspace and waits for cleanup to hold the lease before launching the cleanup-first case. Both cleanup-first and startup-first cases passed with the original recreation/runtime-policy assertions retained. Scoped lint/format, exact same-base carry compilation, and fresh enabled-hook Quick CI passed against bea65a3.

@lastobelus

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6a894363ae

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/server/src/workspace/WorktreeSuspension.ts Outdated
Verify linked-worktree identity separately from capture requirements so shallow repositories and in-progress Git operations remain usable while activity is recorded. Keep capture and recovery barriers strict, including missing catalogs.

Carry-Group: incubator
Carry-Observation: Activity tracking and capture eligibility are inseparable parts of the suspension feature.
@lastobelus

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 86092793ce

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@lastobelus
lastobelus merged commit 9348681 into lastcode/main Oct 26, 2026
19 checks passed
@lastobelus
lastobelus deleted the lastcode/suspend-worktrees branch October 26, 2026 06:23
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