Skip to content

fix(workspace): revalidate renumbered checkouts and settle acquisition failures - #684

Merged
lastobelus merged 3 commits into
lastcode/mainfrom
lastcode/workspace-device-renumbering
Nov 10, 2026
Merged

lastobelus merged 3 commits into
lastcode/mainfrom
lastcode/workspace-device-renumbering

Conversation

@lastobelus

@lastobelus lastobelus commented Nov 10, 2026 •

Copy link
Copy Markdown
Owner

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 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 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, 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 apps/web: pinned tiptap task packages drift from ranged extension-list on fresh resolution #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.

Accept a device-only change only when canonical checkout and Git paths, all directory inodes, and the same-volume relationship still match. Settle final acquisition failures through the existing pre-start failure path.

Carry-Group: incubator

Carry-Observation: Active-checkout admission and provider startup failure handling belong to the saved-workspace suspension feature.
@lastobelus lastobelus changed the title fix(workspace): reopen unchanged checkouts after device renumbering fix(workspace): revalidate renumbered checkouts and settle acquisition failures Nov 10, 2026
Resolve the owner and saved checkout paths before checking device-only identity changes, and inspect the canonical source. Cover canonical and aliased saved bindings.

Carry-Group: incubator
Keep the recorded canonical path as the historical location for device revalidation. Preserve equivalent aliases for lookup and capture through the canonical root; refuse renumbered legacy aliases whose prior location cannot be proved.

Carry-Group: incubator
@lastobelus
lastobelus marked this pull request as ready for review November 10, 2026 00:29
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-10T00:36:57.764570Z 9e4a92d 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

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 9e4a92deaf

ℹ️ 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 448d597 into lastcode/main Nov 10, 2026
37 of 74 checks passed
@lastobelus
lastobelus deleted the lastcode/workspace-device-renumbering branch November 10, 2026 00:45
lastobelus added a commit that referenced this pull request Nov 10, 2026
## Problem

`lastcode-pr-gates` ignored the structured summary comment that Codex posts automatically on a PR. A PR with a finished, clean automatic review therefore still looked unreviewed to the gate.

## What changed

`scripts/lastcode-pr-gates.ts` now reads that summary as review evidence. It counts only when the author is the existing trusted Codex bot, `code_review.status` is `completed`, the commit is the full exact PR head SHA, and both findings flags are booleans.

Clean requires both flags to be false. If either is true, the summary is recorded as evidence but is not clean, so the findings keep blocking. Summaries feed the same aggregation as manual comments and reviews: a manual finding still blocks even when the automatic summary is clean. A newer manual request remains pending; summary edits cannot establish that it was answered. The existing handled marker clears automatic findings only when posted after the summary's latest edit.

There are no guidance or doc changes.

## Testing

- Fixtures match real metadata fetched from PR #684.
- Six regression cases failed before the initial fix; two ordering regressions failed before the review fixes.
- Gate and CLI tests: 53 passed. `check:changed`: passed. The known #677 unused-patch check was skipped because no dependency files changed.
- Optional Quick CI stopped before checks because main advanced; GitHub CI remains the required gate.

Carry-Group: build-ci

Local review: Terra xhigh and Opus 5.5 high, two parallel rounds; both approved the final code. Review fixes prevent old handled markers from clearing edited findings and unrelated summary edits from answering newer manual requests.

Implementation: GPT-6.1 Sol, Codex harness.

Carry-Source-Ref: refs/lastcode/carry-sources/pr-687/5b326f35d58f90a71efa45de435d8114222e9f89
Carry-Source-Base: 5d364e9
Carry-Source-Head: 5b326f3
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