Repository navigation
fix: let macOS launch with ready credentials when the PostgreSQL secret is unavailable - #202102
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 lets native startup prepare runtime pins without resolving the PostgreSQL secret when local client credentials are already ready. Example: The Gateway service has OPENCLAW_TEST_NATIVE_CREDENTIALS_DSN, but the desktop-launched app does not.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR addresses a source-verifiable launch failure still present on main, and no actionable code defect was found. Priority: P1 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe macOS app invokes its bundled Doctor command before admitting native credential consumers; that command checks local credential readiness and delegates runtime-pin preparation to the daemon's existing local SQLite owner. flowchart TD
A[macOS app launch] --> B[Bundled Doctor command]
B --> C[Local credential readiness]
C -->|Ready| D[Configured state engine]
D --> E[Daemon service operation lock]
E --> F[Local runtime pin store]
C -->|Recovery required| G[Resolved database and Doctor maintenance]
Technical reviewBest possible solution: Keep the ready path local while preserving the existing service lock, runtime-pin migration owner, and database-backed credential recovery path. Do we have a high-confidence way to reproduce the issue? Current main resolves PostgreSQL connection secrets before returning from the native ready-credential path, and the app treats that command's failure as failed credential preparation; the PR reports a matching red/green subprocess regression, which was inspected but not rerun. Is this the best way to solve the issue? The change repairs the unnecessary secret dependency at the existing owner boundary, preserves required recovery, and adds one regression covering both successful local preparation and refusal when recovery actually needs shared state. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f91bc9900e81. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +21, Tests +35, Docs +3. Total +59 across 5 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. 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 November 19, 2026, 5:52 PM ET / 22:52 UTC. |
|
Merged via squash.
|
…aw#202102) Co-authored-by: VACInc <[email protected]>
Keep already-ready local credential preparation independent from PostgreSQL connection resolution, while retaining the existing pin migration owner and full connection requirements for credential recovery. From 5e2f35e7a4158b7596549db65bec9e4f26057259 (original 6594caf). Co-authored-by: VACInc <[email protected]> Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit f022591638c8f555e4d3634c339eb274cf02d361) (cherry picked from commit 384759cd29ab46fc52fc8b22fb6c933cddba26ac)
…law#194384) * docs: clarify PostgreSQL conformance coverage * fix(cron): keep one-shot finalization working on PostgreSQL 16 * test(database): reuse cron conformance for JSON conversion regression * test(postgres): accept fractional explain row counts (cherry picked from commit 7ab0143) Release adaptation: Only engine-owned jsonValue and retained cron enabled JSON replacement; preserve native boolean type with PG16 explicit ::json and SQLite json(). Omit unrelated PG docs/EXPLAIN test edits; retained one-shot enabled-transition caller present on baseline. Follow-up dispositions: e029e18 docs: document isolated PostgreSQL restore drills (openclaw#202704); 49f0740 fix(database): report disabled memory after a port (openclaw#202630); a80b564 fix: keep database workers healthy after silent connection loss (openclaw#201856); 3d91af2 fix(config): reject reserved PostgreSQL schema prefixes (openclaw#202097); 835d722 fix: catch incompatible ownership before porting to SQLite (openclaw#202101); 67796a6 fix: keep scheduled Git backups current on PostgreSQL (openclaw#201870); cc849dd fix: recover lease heartbeats after a PostgreSQL connection loss (openclaw#201858); 6594caf fix: prepare macOS runtime pins without the PostgreSQL secret (openclaw#202102); 6ca56cd docs: clarify PostgreSQL storage and backup coverage (openclaw#202086); a079190 fix(postgres): chat history slows under concurrent reads (openclaw#190129); 2ff4256 feat(database): keep PostgreSQL rollback captures in PostgreSQL (openclaw#196236); 96c685b feat(backup): restore PostgreSQL stores into a staging database for restore drills (openclaw#194808); fb83d65 fix: reduce transcript allocation when preparing native context seeds; 71ec4d2 fix(config): keep Workboard PostgreSQL upgrades readable (openclaw#194648); b6ed907 perf(sessions): persist active transcript facts for hydration (openclaw#193682) Validation: Baseline cron generated json(bound text) on PostgreSQL where json(text) is unavailable; helper and focused boolean regression retained. Exact PostgreSQL16 server proof unavailable; focused SQLite/helper tests queued. diff check passed. Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 38fdd9b52704d588d9ca24ef8e391d644961c985) (cherry picked from commit fb935e6912388314851b05cb698ef038b83bbd07)
Summary
High Level TLDR
The macOS app could quit during launch when its bundled CLI could not resolve the Gateway's PostgreSQL connection secret. The CLI now prepares local runtime pins without looking up that secret when client credentials are ready.
What Problem This Solves
A launch from the desktop can inherit a different environment from the Gateway service. If an env SecretRef is provided only to the service, the app's launch-time Doctor command fails and the app asks the user to recover already-usable credentials.
User Impact
A profile with ready credentials can finish launch preparation even when the PostgreSQL secret is available only to the Gateway service. If the credential receipt needs recovery, the operator still needs access to the matching shared state store.
Root Cause
doctor --client-credentials --fix --non-interactiveasked for a fully resolved database selection before it checked whether credential work was needed. The PostgreSQL engine resolver threw on the missing environment variable. The real command returned exit 1 withThe CLI command failed.on the baseline.Why This Change Was Made
The runtime pin owner only needs the configured shared-state engine to determine whether a legacy SQLite pin source exists. The ready path passes that engine to the existing pin owner under the service operation lock. Required credential recovery still resolves the database connection and runs through the existing Doctor maintenance path.
Evidence
Real behavior proof
The regression boots a disposable PostgreSQL 17 fixture with ready local credentials. It replaces the config's connection string with an env SecretRef and withholds that variable from the built CLI subprocess. The app's exact
doctor --client-credentials --fix --non-interactivecommand exits 0, completes the local pin receipt, and preserves the device identity. Replacing the anchor makes the credential receipt stale. The same Doctor path in JSON mode then exits 2 and reportsConfigure a resolvable PostgreSQL DSN.Before:
expected 1 to be +0. After:prepares native runtime pins without the PostgreSQL secret when credentials are readypassed in 6.3 s.What was not tested
Signed macOS app launch, macOS launch latency, a latest-stable macOS app upgrade, and native exec approvals during a PostgreSQL outage were outside the Linux CLI proof. No paid model calls were used for the product test.
Verification
max_locks_per_transaction=512.git diff --checkpassed.6a2dee198389520cccbab4dc50141820178fe9e5, including all four PostgreSQL conformance shards and the PostgreSQL 16 smoke.