Repository navigation
fix(macos): prepare independent identity root with positive schema before native credential admission - #208265
SunnyShu0925 wants to merge 1 commit into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. |
|
Codex review: stale review; fresh review needed. Summary Next step Review history (1 earlier review cycle)
|
…fore native credential admission When the identity root and execution root differ, the Mac app only prepared the execution root through its matching CLI migration owner before admitting both roots via native credential import. An independent identity root holding a positive-schema shared state file (schema-15/WAL with feature tables) was rejected by the restricted native reader before any matching migration owner could repair it, blocking startup even after the default location was successfully fixed. Add a dual-root preparation overload to ClientCredentialStartup that prepares the execution root first, then checks the identity root's existing shared state file header. Only when the identity root is independent and its shared SQLite file has a positive user_version does it send a second preparation through the same bundled matching CLI command. Version-zero native sources, missing files, and collapsed roots continue through the existing native import owner unchanged. Both preparations remain inside the existing StaleGatewayServiceReplacement protection closure. The restricted native reader is not loosened, and no new migration implementation or TypeScript production change is added. Add unit tests covering: shared roots (single preparation), independent version-zero identity root (no second preparation), independent positive-schema identity root (second preparation with correct root ordering), execution-root failure (no identity attempt), identity-root failure (no admission), missing identity file (no second preparation). Closes openclaw#207468
e13a4ae to
78dbd3c
Compare
|
Thanks — closing this as superseded. #208315 (merged, closes #207468) fixes the same startup failure and is already on The maintainer-approved shape also deliberately avoids one thing this PR added: deciding from the raw SQLite header. Sending an arbitrary positive This PR is also No code from here is needed; nothing else in the repo depends on it. |
Closes #207468
What Problem This Solves
A Mac app whose identity root and execution root point to different directories could not start if the identity root held a schema-15/WAL shared state file with feature tables; the app only prepared the execution root, then the restricted native reader rejected the unprepared identity root before any matching migration owner could repair it. After this fix, the app also prepares the independent identity root through its bundled matching CLI command before native admission, so both roots pass the readiness check and startup succeeds.
MenuBar.swiftresolves separateidentityRootandexecutionRootpaths butClientCredentialStartup.prepareonly accepted a single execution root. The bundleddoctor --client-credentials --fixran only for the execution root, thenDeviceCredentialAccess.prepareAppRootsimmediately admitted both roots via native credential import. The restricted native reader (OpenClawNativeStateSQLite.readOnlyCredentialSource) only accepts version-zero, DELETE-mode, credential-only sources — a schema-15/WAL shared state file with feature tables is rejected before the existing CLI migration owner can repair it.prepare(executionRoot:identityRoot:...)overload that prepares the execution root first, then checks the identity root's shared SQLite file header. Only when the identity root is independent and itsuser_version > 0does it send a second preparation through the same bundled matching CLI command.ClientCredentialStartup.swift(dual-root overload +SharedStateHeaderread-only header check + canonical-path root comparison),MenuBar.swift(pass identity root to new overload),ClientCredentialStartupTests.swift(7 new test cases including symlink-alias parameterization).StaleGatewayServiceReplacementprotection closure structure, version-zero native import owner, table allowlist, schema version constants, and all existing single-root tests.Why This Change Was Made
The root cause is the startup composition layer missing canonical preparation of the identity root, not the final migration writer (which already handles migration) or the native reader (whose restrictions are correct).
prepareAppRootsand independent native admission); made visible by 5f40d22 (fix: migrate client credentials automatically before startup #178998, execution-root-only preparation immediately before dual-root admission).canonicalPath(same normalization asDeviceCredentialAccess) so symlink aliases to the execution root are not double-prepared. No new migration implementation or TypeScript production change.User Impact
Users with a legacy identity location (App Group container or
~/Library/Application Support/OpenClaw) that holds a schema-15/WAL shared state file can now start the Mac app directly after the default location is fixed, instead of manually locating and repairing the second location. Existing single-root installations are unaffected.Evidence
Unit tests —
ClientCredentialStartupTests.swiftsynthetic app-bundle fixture with capture-script CLI mock (base d88223e):canonicalPath(identity) == canonicalPath(exec))[executionRoot][executionRoot][executionRoot][executionRoot]user_version=15WAL shared file[executionRoot, identityRoot]user_version=15[executionRoot]user_version=15[executionRoot, identityRoot]Test command (requires macOS):
Checks:
git diff --checkclean; no debug output, no TODO/FIXME, no AI signatures.GHA proof (macos-latest, real
swift test/ real packaged app):e13a4ae(missingawait)await)d88223e+ test overlayfix/macos-legacy-identity-root-207468fix/macos-legacy-identity-root-207468