Repository navigation
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: stale review; fresh review needed. Summary Next step Review history (5 earlier review cycles)
|
cd3e18d to
68c9b84
Compare
|
@clawsweeper re-review Head
|
|
🦞👀 Re-review progress:
|
|
🦞👀 Re-review progress:
|
68c9b84 to
4265307
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
95a8b99 to
c7ef18f
Compare
c7ef18f to
052e603
Compare
An fsGroup volume remount re-applies group permissions across the state volume, and the private stores refuse to open state they own at a widened mode. restorePrivateStateStoreModes repaired an enumerated list that held only the SQLite stores and the capture root, so a remounted installation still refused the two stores whose names are minted at runtime: the managed GitHub identity profiles, and the enrolled Codex worker's codex-runtime bundle. git push then failed with a reconnect hint that could not help, and codex.app-server stayed unavailable. Enumerate both families through the owners that mint them - isManagedGitHubProfileId per scope generation below credentials/github, the hashed agent key for agent-scoped identities, and the regular files directly inside codex-runtime - and admit the scope root that holds them before reading it, so a symlinked scope stops the search instead of lending the repair to another tree. The repair stays an enumerated list, keeps every downstream admission check strict, and still skips symlinks, foreign-owned paths and world bits. Every store admits itself, so a state directory that holds only some of them is repaired for what it holds: a capture-only volume, or stores whose databases live under a custom path, no longer waits for an unrelated store to exist.
052e603 to
62dd894
Compare
What Problem This Solves
Fixes: after a Kubernetes PVC remount with
fsGroup,openclaw gateway runrepairs the SQLite credential store but managed GitHub identities still failgit push("Reconnect or change GitHub Identity") and Codex workers reportWorker Codex configuration directory is unsafe— their private stores stay group-writable (2770dirs /0660files) because the startup repair only enumerated.update-captures,client/credentials.sqlite, andcontrol/services.sqlite, missingcredentials/github/<scope>/<profileId>andcodex-runtime.User Impact
Users running openclaw on Kubernetes or Podman who have enrolled managed GitHub identities or Codex workers keep them after a PVC remount — no reconnect, no re-enroll. Unaffected installations see no change.
Why This Change Was Made
Extend
restorePrivateStateStoreModesto enumerate two minted-store families through their owners' naming contracts:credentials/github/system,credentials/github/personal, and every 64-hex hashed agent key undercredentials/github/agents/<key>, then every child matchingisManagedGitHubProfileId(ghp_[a-f0-9]{32})<stateDir>/codex-runtime(direct child of state root)Each minted store is restored as a whole: directory first (descriptor-bound,
O_NOFOLLOW, uid-match), then every regular file directly inside.namesPlainDirectoryChainSyncrefuses symlinked ancestors above the store so an alias atcredentialsorcredentials/githubcannot lend the repair to another tree.Review follow-up: repair owned stores without requiring unrelated ones
The previous revision bailed out entirely when the state directory contained neither
<stateDir>/.update-capturesnor an existing SQLite store, as a workaround for test fixtures that stubOPENCLAW_STATE_DIRat synthetic roots. That pre-check was wrong twice over:<stateDir>/.update-captures, while the capture root is the sibling<stateDir>.update-captures;mainalready repaired.The pre-check is gone. Every store admits itself through its own descriptor, so a state directory that holds only some stores is repaired for what it holds, and the repair makes no decision about stores it cannot see. Two regressions pin that, both with no SQLite store present: a capture root mounted alone, and minted GitHub/Codex stores mounted alone.
Evidence
All repair paths run through
openclaw doctor --non-interactive --repair, which invokesensureOpenClawStatePermissionsviadoctor-config-preflight.ts:100andgateway-lock.ts:531(gateway startup path).Red/green on the reviewed defect
Same filesystem layouts, same code path, only
src/state/openclaw-state-db-permissions.tsdiffers:5cebd16)2770, not repaired0700, repairedcodex-runtimeonly (no SQLite)2770/0660, not repaired0700/0600, repairedDriver-lane GHA upgrade proof (external repo)
Public repo
github.com/SunnyShu0925/oc-privatestore-upgrade-proof, run 42953923900, checked out at42653076a7b7b3ad36e1fcc64ce1a1b138288785. Recipe: install latest stable[email protected]→ fixtures widened to2770/0660→ driverdoctorconfirms what it can and cannot repair → tarball built from this PR head (stamped2026.11.4, see note) →openclaw updateinstalls it over the stable driver → candidatedoctor --repairrepairs every private store → data retained.The candidate carries the version stamp
2026.11.4because this branch still declares2026.11.2inpackage.json; without a stamp above the driver's2026.11.3,openclaw updatewould treat the candidate as a downgrade. The stamp is the only change CI makes to the packaged tree —dist/and every source file come from this head..update-captures/client/credentials.sqlitecredentials/github/system/ghp_*credentials/github/personal/ghp_*credentials/github/agents/<64hex>/ghp_*codex-runtime/¹ The two minimal layouts run against the candidate binary, after the upgrade step has replaced the driver. Both contain only the capture root / the minted stores when doctor starts; doctor then creates its own state database inside them, which is why the log later lists
client/credentials.sqlitebeside the repaired stores. The reviewed-head red check for both layouts is in the table above.Raw proof log (trimmed to the permission checks)
Regression tests
15 test declarations (16 cases) in
src/state/openclaw-state-db-permissions.test.tscovering minted-store enumeration, descriptor admission (O_NOFOLLOW+ uid-match), ancestor alias refusal, Codex bundle repair, and the two minimal layouts above. No new test file; the added lines are covered byconfig/test-lines-allocations/fsgroup-remount-minted-stores.txt(181 lines, the ceiling growth the ratchet grants this diff).CI note
After rebasing onto current
main, the previously-redsessions-rewind.storage.test.tsandtelegram-model-picker-prepared-gateway.e2e.test.tsshards are green:mainfixed the former in #196702, and the latter was an intermittent e2e flake. This head still fails four shards on tests this diff does not touch:src/cli/gateway-cli/run-loop.direct-stop-active-work.process.test.ts— timing assertion on the shared runner's systemd shutdown budget;test/loopback-ask-user-telegram-channel.test.ts— Telegram loopback flake;src/gateway/server-close.session-rewind.test.ts— session-rewind race;ui/src/e2e/screen-requester-routing.e2e.test.ts— UI e2e flake (this file differs frommainonly becausemainadvanced past the rebase point via fix(ui): restore settings browser fixture capabilities #197001; the PR does not touch it).All four are byte-identical to the rebase base (or, for the UI file, untouched by this diff), none appear in
git diff --name-only, and the changed code only narrows modes on paths the process already owns. The priorsessions-rewind.storagefailure was independently reproducible on #192552 (agentic-gateway-methods-hosted-4, job 129605811557).