Repository navigation
feat(storage): suspend and restore settled worktrees - #508
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
There was a problem hiding this comment.
💡 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".
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
ffd38fa to
0982d12
Compare
|
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. |
|
@codex review |
There was a problem hiding this comment.
💡 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".
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.
|
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. |
|
@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.
|
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. |
|
@codex review |
There was a problem hiding this comment.
💡 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".
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.
|
@codex review |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
…n failures (#684) After a reboot renumbered an APFS filesystem's device number (`st_dev`), an existing workspace could no longer open. Acquisition failed before normal startup error handling, so the run stayed on “starting” once its retries ran out. ## 🔧 What changed - **Revalidation.** The new exception for a stale common-Git device number admits an unchanged active checkout only when all of these hold: - same canonical checkout path - same path for both Git directories - same inode number for all three directories - unchanged single-volume relationship The saved native identity is then refreshed under the existing workspace lease. The persisted canonical `record.path` is the historical location anchor; aliases remain available for lookup, but an old alias-only record whose prior canonical target cannot be proved is refused after renumbering. Changed inode or path evidence still blocks admission. - **Failure settlement.** Final acquisition failures now use the existing failure events for the run, attempt, root node, and readable error item. Interruption and retry behavior is preserved. ## ✅ Validation (draft) - Both bugs failed first in isolated service fixtures. - All 16 focused cases now pass. Coverage includes device-only revalidation, changed identity rejection, canonical and alias lookup, rejection of a moved/retargeted alias and unprovable legacy alias, successful suspension through an alias-owned checkout, interrupted acquisition, retries, and final failure settlement. - The first complete changed-file check passed formatting, lint, GraphQL validation, both knip passes, affected-package typechecks, and 197 tests. The same check is running for the final canonical-path/alias correction. Local review: 3 rounds with gpt-6.1-terra (xhigh) and Claude Opus 5.5 (high), approved for the scoped diff. Final Opus verdict: APPROVE. Terra confirmed the in-scope fixes and reported only the verified pre-existing cross-volume behavior retained as a follow-up. ## 🔍 Investigation 1. **Why did the number change?** - Read-only `stat`, `mount`, and `diskutil` inspection showed the affected APFS filesystem takes `st_dev` from its current BSD block-device number, while the saved checkout and Git directory inode numbers are unchanged. - Apple's [IOMediaBSDClient source](https://github.com/apple-oss-distributions/IOStorageFamily/blob/main/IOMediaBSDClient.cpp#L3305-L3374) gives each media device the first free minor-number slot when it registers, and reboot rebuilds that allocation. - Registration/enumeration order is more precise than “mount order”. Disk images, simulator/Cryptex devices, and external disks can influence it. - The evidence doesn't show which competing registration shifted this boot's number. Private host inventory and logs are excluded from this public PR. 2. **Will it recur?** - It can, on some reboots or reattachments. It is not inevitable on every reboot. - It isn't macOS-only: [glibc's documentation](https://github.com/bminor/glibc/blob/master/manual/filesys.texi#L1873-L1877) explicitly doesn't promise stable device numbers across reboots or crashes. - This PR's active-checkout proof is platform-independent. No Linux runtime reproduction was performed. 3. **Whose bug is it?** - LastCode [PR #508](#508), source commit `424c0114bdaf9cb31d3583239da88fc18a1a2b30`, introduced the comparison. Current blame lands on the compiled `incubator` carry, whose contribution metadata preserves that source. - `origin/main` has no suspension service. Upstream device comparisons protect current file descriptors, locks, temporary tokens, provider outcome files, clone eligibility, and filesystem boundaries. No equivalent persisted checkpoint/worktree-start identity comparison was found. - The apparently unaffected older conversation uses a checkout created after the reboot, which already records the new device number. - Checkout age alone does not determine admission. Other pre-reboot directories already have current-device authority records; the catalog has no identity-registration timestamp, so when those identities were recorded is unknown. Threads without a saved authority record also bypass this reconciliation. No successful post-reboot acquisition of an attached record with both device fields still stale was verified. - A second reported case in a different repository and provider has the same unchanged-inode/device-renumbering pattern, supporting a shared admission defect. 4. **What else is affected?** - **Not affected.** Storage cleanup and GeneratedDependencies capture current identities per pass, and WorktreeConsumers captures current process/file identities. No equivalent stale-admission issue was found. Git's index stat cache is refreshed from current stats and doesn't block startup. - **Affected, left conservative.** Saved snapshot manifests and interrupted restore/fresh/disposal journals persist device identities and can refuse recovery after renumbering. They retain data. This PR leaves those guards alone because an absent original checkout can't satisfy the complete active-checkout proof. - **Stale approvals.** Generated build provenance and manual build-review signatures also include `dev`, so old cleanup approval can go stale. That requires fresh review/build; it never authorizes deletion. ## 🚧 Deliberate limits - **Follow-ups.** Snapshot/journal recovery remains conservative. Mixed canonical/alias paths among multiple owners are also a pre-existing refusal case; no change is made to that policy. A pre-existing cross-volume path can accept a source-device-only change while the common Git device stays unchanged; this PR does not broaden or replace those existing recreation/rebind rules. That separate identity-policy question remains open. - **Not changed.** Saved formats; old deletion consent (never silently reused); exhausted runs (not repaired retrospectively); installed application data (not edited). - **Known caveat.** Issue #677 tracks unrelated tiptap unused-patch drift. It's outside this change and will be reported if encountered during validation. ## 🩹 Recovery after installing a build with this fix Once the old stuck run has been interrupted through normal thread controls, send a new continuation. Installing alone does not reschedule an exhausted background operation. Carry-Group: incubator Implemented with Codex gpt-6.1-sol (xhigh) in T3 Code through the Codex harness. Carry-Source-Ref: refs/lastcode/carry-sources/pr-684/9e4a92deaf2c42a0d1720cbc927a505a7771c531 Carry-Source-Base: 6b7fc1c Carry-Source-Head: 9e4a92d
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
Recovery limits
Recovery is local. It needs the saved data plus the original Git repository. It is not an off-machine backup.
Validation
Not covered
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.
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.