Skip to content

🔒 fix: Refuse a Pathname Root That Changes Before It Is Held - #361

Merged
danny-avila merged 1 commit into
mainfrom
danny-avila/held-root-refusal
Oct 24, 2026
Merged

danny-avila merged 1 commit into
mainfrom
danny-avila/held-root-refusal

Conversation

@danny-avila

Copy link
Copy Markdown
Collaborator

Summary

This is a follow-up to #360, which merged at 16e7fce before its second review pass. That pass found one issue in the new descriptor anchoring.

withAnchoredParentCreation captures a pathname-only root's identity and then opens it by descriptor. If the root was replaced by another real directory between those two steps, the open raises WorkspaceRootAccessError. The fallback then ran the mutation again without an anchor. When the replacement directory already contained the requested parent, a write_file or import_file could succeed against a root inode other than the one this request inspected. That undoes the point of anchoring for the request.

Now a WorkspaceRootAccessError from that open rejects the request as INVALID_PATH before the mutation runs. withWorkspaceRoot raises that error only while opening the root, so nothing has been written at that point and the rejection is atomic. A root that is no longer a real directory at its registered path still never gets an anchor and is refused by the unanchored path, as before.

Compatibility and deploy

This is worker-only. No protocol, Code API or LibreChat change. It narrows a race and changes nothing in the common path. Ship it with #360 when updating workers. The Skynet worker needs both.

Testing

  • packages/code: npm run build (tsc) is clean. node --test dist/workspace.test.js dist/workspace-import.test.js on Node 24.16.0: 103 tests, 102 pass, 1 skipped, as on main.
  • The race window lies between captureWorkspaceRootIdentity and WorkspaceRootAccess.open inside one call, and neither function has a seam a test can use without mocking the module. The change is the single branch shown in the diff. The tests from 🪜 fix: Create Missing Parents on Pathname-Only Roots So Imports Land #360 cover the surrounding cases: a pathname-only root replaced by a symlink before the request creates nothing, and parent creation never follows a symlink out of the root.

A pathname-only root replaced between its identity capture and its open is
refused as INVALID_PATH instead of rerunning the mutation unanchored against
the replacement.
@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 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-23T14:39:01.171031Z 73253f3 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

Copy link
Copy Markdown

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

Reviewed commit: 73253f35b1

ℹ️ 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 (second pass, head 73253f3)

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: 73253f35b1

ℹ️ 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 (third and final pass, head 73253f3). This is the final review: please report blocking issues only.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 73253f35b1

ℹ️ 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 aaef081 into main Oct 24, 2026
37 of 38 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