Repository navigation
fix: initialize private stores under Linux setgid parents - #188464
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR normalizes newly created private Linux store directories from inherited mode 02700 to 0700. Example: Create control/services.sqlite beneath a Linux state root with mode 02700.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this PR addresses a concrete Linux first-use failure still present on main, and review found no actionable introduced defect. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe shared private-store preparation owner receives credential or daemon-store paths and creates private filesystem entries before the callers open their SQLite databases. flowchart LR
A[Credential store caller] --> C[Private store preparation]
B[Daemon runtime pin caller] --> C
C --> D[Exclusive filesystem creation]
D --> E[Linux setgid normalization]
E --> F[Private SQLite file]
Technical reviewBest possible solution: Retain the focused recovery in the shared store creator while preserving private-directory admission and existing store contents. Do we have a high-confidence way to reproduce the issue? Current main and the locked dependency show the exact failure path, and the PR reports a failing-base/passing-head native regression; this read-only review executed no reproduction. Is this the best way to solve the issue? The repair serves both existing callers through their shared owner, narrowly restores the intended 0700 result, and introduces no competing storage owner or configuration option. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 1d6f75fd7450. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +67, Tests +68, Other +2. Total +137 across 3 files. Added test files: 1. View PR surface stats
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 30, 2026, 11:49 AM ET / 15:49 UTC. |
Backport the bounded private-store permission repair from #194307 and the required startup placement from #197009 and first-create fix from #188464. Keep descriptor identity, ownership, link and world-access refusals, and Doctor current-authority admission. Do not re-open sibling stores after each shared-state commit. Adapt Kubernetes documentation to the stable branch. Exclude the companion performance instrumentation, benchmarks and unrelated Telegram fixture edits. (cherry picked from commit bc914b5) (partially cherry picked from commit 2598631) (cherry picked from commit 3a70caa) Co-authored-by: sallyom <[email protected]> Co-authored-by: Peter Steinberger <[email protected]> Co-authored-by: Josh Avant <[email protected]> Co-authored-by: RomneyDa <[email protected]>
What Problem This Solves
Fixes first-use setup and private-store writes on Linux when a containing state directory has inherited setgid permissions.
User Impact
Private control and credential stores can initialize on the first attempt while their parent directories and existing data stay intact. Other unsafe-directory and permission failures remain refusals; no operator configuration or dependency change is required.
Why This Change Was Made
Linux can create a directory with mode
02700even whenmkdirrequests0700. The private creation helper then reports a published directory that failed admission. The shared store creator now normalizes only that exact Linux case through a no-follow, current-owner descriptor, verifies the named directory and parent identities, and confirms the final0700mode. The normal private creation path stays enabled.Evidence
Native Linux x64, Node
26.12.1, full frozen dependencies including@openclaw/fs-safe0.26.14; tested base4cc05039cfa184303ff73e6acc91750c678b6c0a; final candidatec3aef28e9da099ebc27f371efc96856e593f9cc6.The new first-create regression fails on the unmodified owner with the expected
helper-failed/insecure-permissionsrefusal. With the repair, all four cases pass, including forbidden group/sticky modes and failed normalization. The test file takes 3.25 seconds including wrapper overhead.Tooling limitation: the native run used existing Crabbox
0.78.1, below the current guide’s0.79.2minimum for direct leases. Those hash-bound results are supporting observations; the run is not claimed as fully compliant. Independent current-head hosted proof has now passed as detailed below; no gate was waived.Existing client-credential tests: 19 passed, one Darwin-only case skipped on Linux. Existing runtime-pin tests: 10 passed. Targeted type-aware lint, infra test typecheck, format and
git diff --checkpass.Added one exact 68-line regression allocation under the current test-cost policy; the shared baseline is unchanged. Hosted test-line ratchets and broader CI have passed.
Canonical autoreview (GPT-6.1 Sol, P0–P2) reviewed the complete local candidate against the tested base: scoped-clean, no actionable findings. Exact locked dependency source was supplied. The helper refused additional unchanged credential-store caller context by filename policy; that independent-review limitation remains, and the caller was inspected directly and exercised by its existing suite. Local ClawSweeper was unavailable on this host; the actual hosted final-head review has now completed with no actionable findings. No duplicate request was posted while queued.
Hosted CI41079702062 completed successfully. Actual checkout
d885f412d4ad390bc483712890c5e6bc63bde507merges final candidate into base3c8bd4daf66d6958442ad95ae6d361b3e0a3a648. The owner4cases, runtime-pin10cases, and credential19passed/1Darwin-onlyskip suites ran under pinned Bun1.4.4-canary.1+191755ec1(openclaw-v1.4.4-20261026-191755ec11-webkit-b82bc917e9), with Node24.22.1 as the driver and fs-safe0.26.14. These hosted Bun results are distinct from native Node26 observations.At2026-10-30T15:32:50Z the final head is mergeable/CLEAN; all127attached contexts are success/skip/neutral, including required aggregate CI, dependency and security-sensitive review gates. No native non-Linux or rebuilt-release claim is inferred from selected/skipped jobs. The subsequent exact-head ClawSweeper review has completed as recorded below.
Actual final-head ClawSweeper review completed at2026-10-30T15:49:42Z: findings0, Before merge:None, ready for maintainer review. It could not open the downstream first-use artifact and therefore independently verified source/owner-boundary evidence rather than that entire product replay. That limitation remains explicit; no source changes followed this review.
Commands:
OPENCLAW_VITEST_RUNTIME=node node scripts/run-vitest.mjs run src/infra/private-store-file.test.ts --maxWorkers=1; repeat withsrc/daemon/runtime-pin-state.test.ts src/infra/client-credential-store.test.ts; targetedrun-oxlint.mjs,run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.infra.json --incremental, andrun-format.mts --check.This focused proof covers native Linux x64. It does not establish native macOS/Windows behavior, a rebuilt current-main release, or deployed-fleet delivery. The recovery is Linux-only; broader proof belongs to PR CI and normal release qualification.