Skip to content

fix: create private runtime dir atomically - #923

Merged
myles332 merged 1 commit into
mainfrom
myles/descriptor-publish-eexist
Nov 7, 2026
Merged

myles332 merged 1 commit into
mainfrom
myles/descriptor-publish-eexist

Conversation

@myles332

@myles332 myles332 commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

The v0.2.25 release CI failed twice in remote_host::discovery_tests, once on aarch64 (42312029741) and once on x86_64 (42316412615). Both times descriptor.publish(...) returned File exists (os error 17).

ensure_private_dir creates /tmp/orx-<uid>. It checked exists() and then called create_dir, so when concurrent callers raced on a fresh machine, the losers got EEXIST. A loser could also see the new directory before its chmod 0700 and reject it as unsafe. Two orx processes starting together could hit the same race, not just tests.

The directory is now created at mode 0700 in one step. On AlreadyExists, the existing directory goes through the same symlink, type, owner and mode checks. The rules for what counts as safe are unchanged. A dangling symlink now gets the "Unsafe" message instead of a raw EEXIST. Both IO errors now carry the path.

A sweep of src/ and crates/ found no other exists()-guarded create_dir or create_new. The Windows branch of runtime_path uses create_dir_all and is unaffected.

  • New test concurrent_callers_all_get_one_private_runtime_dir (16 threads on a barrier) failed 3 of 3 runs against the old function and passed 5 of 5 with the fix
  • cargo fmt --check, cargo clippy -D warnings, cargo build --locked, cargo test --locked: 1725 unit tests passed. The tests/sshd.rs latency test failed once under load and passed 3 of 3 alone; it is unrelated.
  • Reviewed by four independent agents: no blockers
  • PR CI green on Linux, macOS and Windows

Assisted-by: claude-opus-5.5

ensure_private_dir checked exists() and then called create_dir, so two
orx processes or test threads creating /tmp/orx-<uid> together could
fail with EEXIST. A loser could also see the directory before its chmod
and reject it as unsafe. This failed the v0.2.25 release CI twice in
remote_host discovery tests.

Create the directory with mode 0700, and on AlreadyExists verify the
existing one with the same safety checks.

Assisted-by: claude-opus-5.5
@greptile-apps

greptile-apps Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] This PR appears safe to merge.

Summary

Creates the Unix runtime directory with private permissions in one step.

  • Remote-host processes can share one safely created Unix runtime directory.

No actionable issues found. Tests were inspected but not run during this review.

Reviews (1) · Last reviewed commit: "fix: create private runtime dir atomical..." · Reviewed by Greptile

@myles332
myles332 merged commit c9123a6 into main Nov 7, 2026
13 checks passed
@myles332
myles332 deleted the myles/descriptor-publish-eexist branch November 7, 2026 00:53
qianyuliu pushed a commit to CMCC-AI/OpenResearch that referenced this pull request Nov 16, 2026
- 在 src/local/chat/mod.rs 的 set_chat_session_env 中统一将 ORX_DATA_DIR 锚定到当前仪表盘规范化数据目录,并收敛各 harness 调用点(alphaXiv#962)
- 在 src/output.rs 与 src/main.rs 捕获短生命周期 CLI 的 stdout BrokenPipe 并安静退出,在只读查询命令中新增 Store::open_for_reading 降级支持(alphaXiv#962)
- 在 src/commands/remote_host.rs 使用 DirBuilder::mode(0o700) 原子创建私有运行时目录并在 AlreadyExists 时校验权限归属(alphaXiv#923)
- 在 src/compute.rs 为 git archive 注入 core.autocrlf=false 与 core.eol=lf,在 ui/src/markdownTarget.ts 兼容字面量百分号文件名并重编 ui/dist(alphaXiv#730、alphaXiv#786)
qianyuliu pushed a commit to CMCC-AI/OpenResearch that referenced this pull request Nov 17, 2026
- 更新 `releases.md` 与 `release-notes/v0.2.24-mobilesci.1.md`,完整反映 `.7.1` 后新增能力、阶段 1/2 加固及 `hosted-local` 启动器状态
- 刷新 `upstream-v0.2.24-backports.md` 与 `upstream-v0.2.25-review-2026-11-09.md` 回移台账,标注已适配落地的 `alphaXiv#985`/`alphaXiv#952`/`alphaXiv#981`/`alphaXiv#990`/`alphaXiv#962`/`alphaXiv#923`/`alphaXiv#730`/`alphaXiv#786`/`alphaXiv#909`/`alphaXiv#747`/`alphaXiv#903`
- 补充 `start-mobilesci.md` 与 `runtime-and-deployment.md` 中的本地多用户托管模式(5400)说明,消除文档与仓库入口漂移
- 修订 `next-cycle-plan.md`,明确 Gate 1 发版上线与 Phase 3 增量重构、上游按需跟踪及重型需求准入边界
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