Skip to content

fix(node-host): honor umask in Git transfer mode assertions - #140771

Merged
steipete merged 1 commit into
mainfrom
steipete/fix-worker-transfer-file-modes-0906
Sep 7, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/fix-worker-transfer-file-modes-0906

Conversation

@steipete

@steipete steipete commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Related: #140696, #140628

What Problem This Solves

Resolves a problem where native Testbox landing gates fail seven node-worker Git transfer cases under umask 0002, including PRs that do not change node-host. The tests expected literal 0644/0755, while Git correctly checked out 0664/0775.

Why This Change Was Made

Worker workspace manifests and file matching use Git executable-bit semantics, as documented in docs/gateway/cloud-workers.md. Git-base materialization delegates to git checkout-index, whose file creation uses 0666 or 0777 subject to umask. The test now derives those full permission expectations from process.umask(). Downloaded replacements still require exact 0755, matching the client's explicit chmod.

The canonical materialization and matching owners remain unchanged. No production behavior, public API, configuration, or compatibility export changes.

User Impact

No runtime behavior change. Maintainers can validate unrelated changes on Testbox without these false permission failures. Executable-bit changes, unchanged-base blob reuse, contents, symlinks, and atomic replacement remain covered.

Evidence

  • Clean-main baseline a7f2413c4b0b899e7b9733fea6070d027bbac1b7: focused Testbox suite failed 7 cases, with 5 passed and 1 existing Windows-only test skipped. Errors were 436 != 420 and 509 != 493.

  • Provider blacksmith-testbox, lease tbx_01m1wyd1knvd25jx20byc3zehh, Actions run 34079614439.

  • Same-lease probes: umask returned 0002; git config --show-origin --get-all core.sharedRepository returned no values; stat -c '%a %n' showed a fresh regular file 664, a Git-checked-out regular file 664, and Git-checked-out executable 775. Global/system config is disabled for worker Git commands.

  • Baseline command: node scripts/crabbox-wrapper.mjs run --id tbx_01m1wyd1knvd25jx20byc3zehh --timing-json -- node scripts/run-vitest.mjs src/node-host/node-worker-transfer-client.git.test.ts.

  • Local focused suite passed under the normal mask and under umask 002: 12 passed, 1 existing Windows-only test skipped each. The unpatched suite reproduced all seven failures locally under umask 002.

  • Codex autoreview through P2: no actionable findings.

  • Patched Testbox focused suite: 12 passed, 1 existing Windows-only test skipped, using node scripts/crabbox-wrapper.mjs run --timing-json -- node scripts/run-vitest.mjs src/node-host/node-worker-transfer-client.git.test.ts. Provider blacksmith-testbox, lease tbx_01m1x0k1fqnyc6y25ksyrt3qsz, Actions run 34081747692.

  • node scripts/check-changed.mjs: passed. The first run encountered seven unrelated type errors from a stale local @openclaw/fs-safe 0.8.1 install; pnpm install --frozen-lockfile aligned it with the branch's existing 0.8.3 pin, and the retry passed. No Windows execution was performed for this POSIX-only assertion change.

  • Native review artifacts validated with READY FOR /prepare-pr and zero findings. OPENCLAW_TESTBOX=1 scripts/pr prepare-run 140771 passed using hosted evidence for published head 9ab6eef9d8a6a398447f46a2976eb9d4ba584d1e.

  • node scripts/watch-pr-ci.mjs 140771 9ab6eef9d8a6a398447f46a2976eb9d4ba584d1e returned GREEN, pending=0, for CI run 34082418079.

Keep full permission assertions aligned with Git checkout's umask-filtered
file creation, while retaining exact modes for chmod'ed downloads.

Proof: node scripts/run-vitest.mjs src/node-host/node-worker-transfer-client.git.test.ts
Passes locally under normal and 002 masks and on Testbox (12 passed).
@clawsweeper

clawsweeper Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Sep 7, 2026
@steipete
steipete marked this pull request as ready for review September 7, 2026 04:15
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 7, 2026
@clawsweeper

clawsweeper Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 7, 2026, 12:29 AM ET / 04:29 UTC.

ClawSweeper review

What this changes

The PR makes Git-transfer permission assertions respect the process umask while retaining exact permissions for downloaded replacements.

Merge readiness

✅ Ready for maintainer review

This remains a useful, narrowly scoped correction: current main retains the faulty permission expectations. No actionable correctness or security findings were found.

Priority: P2
Reviewed head: 9ab6eef9d8a6a398447f46a2976eb9d4ba584d1e

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused correction supported by the production and Git contracts, with relevant before/after validation reported and no actionable findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The external-contributor gate does not apply to this maintainer-authored test correction. The captured body reports before/after runs of the Git-transfer suite locally and on Testbox, directly exercising the assertions changed here.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The external-contributor gate does not apply to this maintainer-authored test correction. The captured body reports before/after runs of the Git-transfer suite locally and on Testbox, directly exercising the assertions changed here.
Evidence reviewed 8 items Introduced assertions preserve both permission contracts: The verified merge-base-to-head patch changes only permission expectations. Git-created regular and executable files use umask-filtered modes; changed tracked files still require exactly 0755. Content, blob reuse, symlink, and atomic-replacement assertions remain intact.
Production Git materialization: The workspace initializer invokes git checkout-index for eligible base paths. Its command environment disables global and system Git configuration.
Independent Git permission contract: Git v2.50.0 create_file selects 0777 for executable entries and 0666 otherwise, then calls open with O_CREAT, allowing the operating system to apply umask. This dependency inspection is relevant because the tested production initializer directly executes Git checkout. Source: https://raw.githubusercontent.com/git/git/v2.50.0/entry.c.
Findings None None.
Security None None.

How this fits together

Node workers reconstruct workspaces from Gateway manifests, Git objects, and downloaded files. These tests verify the resulting files, permissions, symlinks, and workspace replacement behavior.

flowchart TD
  A[Gateway workspace manifest] --> B[Worker workspace transfer]
  C[Git objects] --> B
  B --> D[Git checkout applies umask]
  B --> E[Downloaded files receive chmod]
  D --> F[Workspace assertions]
  E --> F
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +4. Total +4 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 6 2 +4
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 6 2 +4

Review metrics

None.

Technical review

Best possible solution:

Keep permission assertions aligned with each file-creation path while preserving the existing transfer integrity and replacement coverage.

Do we have a high-confidence way to reproduce the issue?

Yes: the current-main suite assumes 0644/0755, while its Git checkout path produces 0664/0775 under umask 0002. The supplied body reports this reproduction; this review did not execute it.

Is this the best way to solve the issue?

Yes: adjusting the expectations to Git's creation contract is narrower than changing production permissions or forcing the test environment's umask.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 91764e29f154.

Labels

Label changes:

  • add P2: This bounded assertion defect causes false native validation failures under a normal POSIX umask without changing runtime behavior.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The external-contributor gate does not apply to this maintainer-authored test correction. The captured body reports before/after runs of the Git-transfer suite locally and on Testbox, directly exercising the assertions changed here.

Label justifications:

  • P2: This bounded assertion defect causes false native validation failures under a normal POSIX umask without changing runtime behavior.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The external-contributor gate does not apply to this maintainer-authored test correction. The captured body reports before/after runs of the Git-transfer suite locally and on Testbox, directly exercising the assertions changed here.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit 6223cf8 into main Sep 7, 2026
178 checks passed
@steipete
steipete deleted the steipete/fix-worker-transfer-file-modes-0906 branch September 7, 2026 04:32
@steipete

steipete commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 8, 2026
…#140771)

Keep full permission assertions aligned with Git checkout's umask-filtered
file creation, while retaining exact modes for chmod'ed downloads.

Proof: node scripts/run-vitest.mjs src/node-host/node-worker-transfer-client.git.test.ts
Passes locally under normal and 002 masks and on Testbox (12 passed).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant