Repository navigation
fix(pm-aggregator): create metadata DB parent directory before opening (#13293) - #13346
Merged
Merged
Conversation
#13293) openMetadataStore opened the metadata DB without ensuring its parent directory exists; bun:sqlite creates the file but not its parents, so a clean environment (no ~/.local/state/pm-aggregator yet) crashed server boot with SQLITE_CANTOPEN. Create the parent with mkdirSync recursive before opening (:memory: exempt); genuine open failures still throw. Adds two regression tests: a missing nested parent directory is created and the store opens; an unhealable parent still fails closed.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 59 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix for #13293: pm-aggregator server boot crashed in clean environments with SQLITE_CANTOPEN.
Change (2 files, +42):
openMetadataStoreinpm-stack/aggregator/src/metadata-ingestion.tsnow creates the metadata DB's parent directory (mkdirSync(dirname(path), { recursive: true }),:memory:exempt) before opening — mirroring the other state stores' mkdir-on-write. Genuine open failures still throw; only the missing-directory case self-heals. Two regression tests intest/metadata-ingestion.test.ts: a missing nested parent is created and the store opens withpm_metadata_itemsinstalled; an unhealable parent (a regular file in the path) still throws, fail-closed.Verification (laptop, this branch):
bun test test/metadata-ingestion.test.ts— 15 pass / 0 fail, 67 expect() calls (mutation check by the original author: disabling the mkdir line fails exactly the new missing-directory test).bun run src/server.ts(fixtures source) →/api/health200{"status":"ok"},~/.local/state/pm-aggregator/pm-metadata.sqlitecreated by the boot, zero SQLITE_CANTOPEN in the log. (FreePM_AGG_PORT/PM_AGG_FRESHNESS_PORToverrides used — the defaults collide with the laptop's live pm-stack services; unrelated to this change.)test/boot.test.ts,test/actions.test.ts,test/break-glass-route-9608.test.ts): paired comparison against the pristine base commit in the same environment — failure sets identical between base and this branch (spawned-server reachability flakes on the loaded laptop; zero SQLITE_CANTOPEN anywhere). Break-glass suite passes.bunx tsc --noEmitclean.History: fix authored by Lane WU, held by a platform execution-risk flag (record on #13293), cleared by Drew's batch approval 2026-11-23; landed by the recovery agent after the first landing agent ended silently.
{ "direct_parent": null, "links": [], "lineage": { "design": null, "roadmap_item": null, "priority": null }, "pm_meta": 1, "provenance": { "queue_id": null, "scheduled_start": null, "picked_up_at": null, "work_started_at": null, "created_at": "2026-11-23T14:01:58Z", "session_id": null, "lane": null, "host": "htch-runtime", "worktree": null, "model": null, "lane_start_issues": [], "workspace_ref": null, "auth_subject": "archer", "stamped_by": "fleet 0.1.0 (native)" } }Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.