Skip to content

feat(worker): Reserve private checkpoint directories - #438

Merged
danny-avila merged 2 commits into
mainfrom
danny-avila/checkpoint-directory-lease
Dec 5, 2026
Merged

danny-avila merged 2 commits into
mainfrom
danny-avila/checkpoint-directory-lease

Conversation

@danny-avila

Copy link
Copy Markdown
Collaborator

What changes

Adds an internal, Linux-only reservation for an existing checkpoint directory. There is no runtime wiring, staging, reading, or enablement. This branches from main independently of #437.

  • Walks a bounded canonical absolute path without following symlinks. Requires trusted ancestors and a worker-owned 0700 leaf. Checks ext4/XFS using descriptor-targeted statfs corroborated by the descriptor's mount ID.
  • Takes a nonblocking advisory flock on the directory inode. Under that lock: revalidate → await isolation verification and grant pins → revalidate → run the async operation → release pins → close. There is no lock file to clean up.

The reservation is not an isolation policy. A future caller must perform complete admission against all grants, keep them pinned until release, and unwind partial pins if admission fails.

Verification

  • Worker build, tsc --noEmit, and git diff --check.
  • Real WSL/ext4: 14 focused tests passed, including tmpfs rejection, rejection and callback cleanup, inode replacement, cross-process contention, crash release, and existing process-lock/snapshot tests. One non-Linux-only test skipped.

@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review — pass 1 of 3 for exact head b9cb88150a0f44a273e962ea06e029f8c24d0b51. Please review the directory reservation, path and filesystem admission, and grant-pin/lock cleanup contracts.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 5, 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-12-05T03:04:20.188341Z 66cb969 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.

@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: b9cb88150a

ℹ️ 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 on lines +24 to +25
const options = { skip: !linux, timeout: 10_000 };
const base = process.env.CHECKPOINT_TEST_ROOT ?? homedir();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Gate reservation integration tests on filesystem support

On Linux hosts whose home directory is on overlayfs, Btrfs, or another unsupported filesystem, these tests run unconditionally even though successful reservation requires ext4/XFS. With the default fixture root on overlayfs in this environment, four focused tests failed at filesystem admission before exercising their intended cleanup or contention assertions. Since npm test includes this file, this breaks the standard test suite in such environments. Probe the fixture filesystem and skip the success-dependent integration tests when unsupported, or require an explicitly configured supported fixture root; keep the unsupported-filesystem rejection test separate.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in 66cb969. Auto-detected unsupported fixture roots now skip only tests that need a successful reservation. Explicit fixture roots remain strict. WSL verified ext4 success and tmpfs rejection, including the default-skip behavior. Production filesystem admission is unchanged.

@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review

Pass 2 of 3 on head 66cb969.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 66cb969773

ℹ️ 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".

@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review

This is the final review for this PR (pass 3 of 3) of head 66cb969. Please flag only blocking issues: correctness, security, or data loss.

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 66cb969773

ℹ️ 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".

@danny-avila
danny-avila merged commit 904382d into main Dec 5, 2026
31 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