Skip to content

fix(state): repair minted private stores after an fsGroup remount - #196394

Closed
shuisadev wants to merge 0 commit into
openclaw:mainfrom
shuisadev:fix/private-store-repair-minted-stores
Closed

shuisadev wants to merge 0 commit into
openclaw:mainfrom
shuisadev:fix/private-store-repair-minted-stores

Conversation

@shuisadev

@shuisadev shuisadev commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

After a Kubernetes PVC remount with fsGroup, openclaw gateway run repairs the SQLite credential store but a managed GitHub identity still fails git push ("Reconnect or change GitHub Identity") and codex.app-server reports Worker Codex configuration directory is unsafe. The startup repair enumerated .update-captures, client/credentials.sqlite, and control/services.sqlite only — managed GitHub profiles at <stateDir>/credentials/github/<scope>/<profileId> and Codex runtime bundle at <stateDir>/codex-runtime were never on the list, so after remount they stay 2770/0660 and their owners refuse to open them.

Solution

Extend restorePrivateStateStoreModes to enumerate both minted-store families through their owners' naming contracts:

  • GitHub: credentials/github/system, personal, and every 64-hex hashed agent key under agents/<key>, then generations matching isManagedGitHubProfileId (ghp_[a-f0-9]{32})
  • Codex: <stateDir>/codex-runtime (direct child, its own descriptor admission already refuses aliases)

Each minted store is restored as a whole: directory first (descriptor-bound, O_NOFOLLOW, uid-match), then every regular file directly inside. A new namesPlainDirectoryChainSync refuses symlinked ancestors above the store so an alias at credentials or credentials/github cannot lend the repair to another tree.

User Impact

Kubernetes/Podman installations whose PVC was remounted keep their managed GitHub identity and enrolled Codex worker — no reconnect, no re-enroll. Unaffected installations see no change.

Evidence

All runs use the shipped openclaw doctor --non-interactive --repair, invoking ensureOpenClawStatePermissions via doctor-config-preflight.ts:100 and gateway-lock.ts:531. Fixture: isolated OPENCLAW_STATE_DIR with SQLite stores, one managed GitHub identity per scope (system/personal/agent-key), codex-runtime bundle, widened to 2770 dirs / 0660 files exactly as kubelet applies on remount.

Driver-lane upgrade proof (GHA)

Run: oc-privatestore-upgrade-proof/actions/runs/42773528559 on ubuntu-24.04 (glibc 2.39). Driver = [email protected] (latest-stable), candidate = tarball built from PR head fdd83603.

Store Driver (stable) after doctor Candidate (PR) after doctor
state/openclaw.sqlite* (control) 0600 ✅ repaired 0600 ✅ repaired
client/credentials.sqlite (control) — not yet created 0600 ✅ repaired
control/services.sqlite (control) — not yet created 0600 ✅ repaired
credentials/github/system/<ghp_*> 2770/0660 ❌ NOT repaired 0700/0600 ✅ repaired
credentials/github/personal/<ghp_*> 2770/0660 ❌ NOT repaired 0700/0600 ✅ repaired
credentials/github/agents/<key>/<ghp_*> 2770/0660 ❌ NOT repaired 0700/0600 ✅ repaired
codex-runtime bundle 2770/0660 ❌ NOT repaired 0700/0600 ✅ repaired

Upgrade output: openclaw update --tag file:<candidate.tgz> --yes → exit 0, package-install 27.8s, updater-runtime-retention 23.5s, candidate-doctor 11.2s, database snapshot 0.047s.

Data retention after upgrade: All hosts.yml intact (proof-system-user, proof-personal-user, proof-agent-user), all credential markers present (proof-credential-marker-*-20261110), codex config.json/bundle.marker/worker-0.pid unchanged.

VERDICT: PASS — stable driver reproduces the exact omission (controls repaired, minted stores still widened); candidate restores every private store while retaining all credentials and runtime data.

Symlinked ancestor refusal

Scenario Before 19305539 Head fdd83603
credentials → external tree holding github/system/<id> external tree chmodded (bug) external untouched; real stores still repaired
credentials/github → external tree holding system/<id> same bug same fix

Regression tests

Extended src/state/openclaw-state-db-permissions.test.ts in place (98 net lines):

  • RED on revert 5d89656a2bd: expected 1528 to be 448 (0o2770 vs 0o700)
  • GREEN on head fdd83603: 14 passed (14)
  • Allocation: config/test-lines-allocations/fsgroup-remount-minted-stores.txt

CI attribution (pre-existing)

Failure Run Related to this PR? Notes
checks-fast-baseline-ratchets (test-lines over) 42781191142 ❌ zero Main itself over ceiling; merged PR #196504 failed identically on the same check. Allocation is on maintainer lane.
checks-node-changed-compact-large-22-3 42781191142 ❌ zero sessions.fork AssertionError in server-methods/sessions-rewind.storage.test.ts — imports no module from src/state/. No changed path intersects this file.
Security High ×6 / Scan changed paths earlier run 42777458055 ❌ zero GitHub installation API rate-limit transient (429). Resolved on rerun.

@clawsweeper

clawsweeper Bot commented Nov 10, 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.

@shuisadev
shuisadev marked this pull request as ready for review November 10, 2026 02:28
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: M labels Nov 10, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 10, 2026
@clawsweeper

clawsweeper Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Extend private-store permission repair to managed GitHub identity profiles and enrolled Codex worker bundles after an fsGroup remount.

Example: A PVC remount leaves codex-runtime at 2770 and its files at 0660.

  • Before: Existing repair skips the bundle, and the worker rejects its configuration directory.
  • After: Repair restores the owned directory to 0700 and regular files to 0600 without changing their contents.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Useful, focused repair with applicable shipped-CLI upgrade evidence and no actionable code finding; CI failure attribution remains unsettled.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (linked_artifact): The supplied Ubuntu stable-to-candidate run exercises the real updater and Doctor against widened GitHub profiles and codex-runtime, records repaired modes and retained synthetic content, and reports ancestor-alias refusal; the changed production module is identical at the proof revision and reviewed head, although this sandbox could not download raw artifact logs.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: After a PVC remount, existing GitHub identities and enrolled Codex workers remain unusable because startup repair skips their private stores.
Reason: The patch restores the established remount-recovery contract without adding configuration, changing credential authority, or requiring users to reconnect.

Merge readiness

✅ Ready for maintainer review

This PR fixes a concrete omission that remains on current main, with no discrete patch defect found; failed CI checks still need attribution before landing.

Priority: P1
Reviewed head: 23e572d47951725996398bd2bedf5403d698f608

Before merge

None.

Findings

None.

Agent review details

How this fits together

Gateway startup and admitted Doctor repair normalize installation-owned private stores before their credential and worker readers enforce private permissions.

flowchart TD
  A[PVC remount widens modes] --> B[Gateway startup or admitted Doctor repair]
  B --> C[Existing private store repair owner]
  C --> D[SQLite stores]
  C --> E[Managed GitHub profiles]
  C --> F[Codex runtime bundle]
  E --> G[Strict private store readers]
  F --> G
Loading

Technical review

Best possible solution:

Extend the existing descriptor-bound repair owner to the omitted store families while preserving strict downstream admission and shared-root permissions.

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

Current-main repair omits both store families, whose production readers explicitly reject the widened modes; the contributor also supplies stable-to-candidate CLI evidence, but no target code was executed during this review.

Is this the best way to solve the issue?

The change repairs the omission in the existing owner, retains its descriptor admission, and adds bounded discovery rather than a competing repair mechanism.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Private-store restoration and shared-root behavior keeps the original intent (bc914b5: Repair fsGroup-broadened installation stores before admission while preserving shared roots, descriptor checks and best-effort handling.)
  • GitHub profile naming and scope layout keeps the original intent (824fde2: Maintain scoped managed credential generations and hashed agent directories for repository-worker credentials.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Taj Salawu: Raw commit bc914b5 adds src/state/openclaw-state-db-permissions.ts:185 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: bc914b586dd3; files: src/state/openclaw-state-db-permissions.ts)
  • RoboClaw: Raw commit 824fde2 adds src/agents/github-tool-profile-path.ts:33 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 824fde2bfab6; files: src/agents/github-tool-profile-path.ts)

PR surface

Source +159, Tests +130, Docs +11, Other +13. Total +313 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 177 18 +159
Tests 1 153 23 +130
Docs 1 16 5 +11
Config 0 0 0 0
Generated 0 0 0 0
Other 1 13 0 +13
Total 4 359 46 +313

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Production versus regression-test growth Production +159 net lines; tests +130 net lines Growth adds bounded minted-store discovery, shares existing mutation admission, and extends remount and alias-refusal coverage without new persistent state.

Labels

Label changes:

No label changes.

Label justifications:

  • P1: A normal fsGroup remount can disable established managed GitHub and enrolled-worker workflows despite the existing startup repair.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Resolve the formatting check and classify the session-fork and clone-identity failures using matching base evidence or a head-versus-revert comparison.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (9 earlier review cycles; latest 8 shown)
  • reviewed 2026-11-10T03:46:07.515Z sha c2a89ef00962b50351512553b27e63884021f9fa :: needs real behavior proof before merge. :: none
  • reviewed 2026-11-10T03:52:27.461Z sha c2a89ef00962b50351512553b27e63884021f9fa :: needs real behavior proof before merge. :: none
  • reviewed 2026-11-10T04:12:11.140Z sha c2a89ef00962b50351512553b27e63884021f9fa :: needs real behavior proof before merge. :: none
  • reviewed 2026-11-10T04:49:31.937Z sha 87840c9a01136edd12466ce03946614b6e6a1ca7 :: needs real behavior proof before merge. :: none
  • reviewed 2026-11-10T06:37:18.142Z sha 87840c9a01136edd12466ce03946614b6e6a1ca7 :: needs real behavior proof before merge. :: none
  • reviewed 2026-11-10T07:10:44.542Z sha fdd8360303eadf7d9b969d266dd2e73670ae3402 :: needs real behavior proof before merge. :: none
  • reviewed 2026-11-10T07:36:36.366Z sha fdd8360303eadf7d9b969d266dd2e73670ae3402 :: needs maintainer review before merge. :: none
  • reviewed 2026-11-10T07:52:28.011Z sha 0f32c3aeb09d89536a3796da53f8218b3eb8830b :: needs maintainer review before merge. :: none

Reviewed November 10, 2026, 4:57 AM ET / 09:57 UTC (Revision 10).

@shuisadev
shuisadev force-pushed the fix/private-store-repair-minted-stores branch from 1930553 to c2a89ef Compare November 10, 2026 03:34
@clawsweeper

clawsweeper Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. label Nov 10, 2026
@clawsweeper

clawsweeper Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@shuisadev
shuisadev force-pushed the fix/private-store-repair-minted-stores branch from c2a89ef to 87840c9 Compare November 10, 2026 04:42
@clawsweeper

clawsweeper Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper

clawsweeper Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 10, 2026
@clawsweeper

clawsweeper Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 10, 2026
@clawsweeper

clawsweeper Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 10, 2026
@shuisadev
shuisadev force-pushed the fix/private-store-repair-minted-stores branch from a66b709 to 23e572d Compare November 10, 2026 09:18
@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: L and removed size: M labels Nov 10, 2026
@shuisadev
shuisadev force-pushed the fix/private-store-repair-minted-stores branch from 6bb52d9 to 23e572d Compare November 10, 2026 09:47
@openclaw-barnacle openclaw-barnacle Bot added size: M and removed scripts Repository scripts size: L labels Nov 10, 2026
@shuisadev

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 10, 2026
@shuisadev
shuisadev force-pushed the fix/private-store-repair-minted-stores branch 2 times, most recently from 48258d1 to 6ff4b85 Compare November 10, 2026 12:55
@shuisadev shuisadev closed this Nov 10, 2026
@shuisadev
shuisadev force-pushed the fix/private-store-repair-minted-stores branch from 0bd2f21 to c321c03 Compare November 10, 2026 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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