Skip to content

[GB-HOUSEKEEPER] Litestream: keep the WAL across restarts so startup does not write a ~4 GB snapshot - #2132

Merged
jaywedgeworth22 merged 1 commit into
mainfrom
GB-Housekeeper/um-litestream-restart-snapshot
Dec 4, 2026
Merged

jaywedgeworth22 merged 1 commit into
mainfrom
GB-Housekeeper/um-litestream-restart-snapshot

Conversation

@jaywedgeworth22

@jaywedgeworth22 jaywedgeworth22 commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Add a read-only SQLite WAL guard that starts after database restore and before startup scripts that open the database. Its idle connection prevents those scripts from becoming the last read-write connection to close, which can reset the WAL and cause Litestream to upload a full-database snapshot on the next restart.
  • Start the guard only when Litestream is enabled and the database file exists. The startup wrapper waits briefly for readiness, logs a warning if it does not become ready, and otherwise leaves it running for the container’s lifetime.
  • Add startup-config checks to ensure the guard starts before the backup, subscription-link audit and index checks, and migration, and runs without the dd-trace preload.
  • Update Litestream documentation with the WAL reset cause, guard behavior, and expected snapshot behavior: the first start after this change may still snapshot, while subsequent restarts should continue incrementally if the guard remains active.
  • Include the guard script in production app watch paths.

Testing

  • Added startup-config assertions for the guard’s ordering and execution environment. No test-run results are provided.

…~4 GB snapshot.  Holds one idle read-only SQLite connection (scripts/sqlite-wal-guard.mjs) from before the startup scripts until the container ends.
@kody-ai

kody-ai Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Code Review Could Not Complete ⚠️

The review failed before suggestions could be generated.

Reason: Rate limit reached on the provider (openai). Try again in a few minutes.

openai · gpt-6-luna · HTTP 429 · generalist

Provider said: Rate limit reached for gpt-6-luna in project proj_amEJPWcCdTmwUHS7U8jmAdgx organization [redacted] on tokens per min (TPM): Limit 200000, Used 194639, Requested 17551. Please try again in 3.657s. Visit https://platform.openai.com/account/rate-limits to learn more.

After fixing the issue, comment @kody review on this PR to re-run the review.

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Validate Business Logic: Ask Kody to validate your code against business rules by adding a comment with the @kody -v business-logic command.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ✅

Access your configuration settings here.

​

@swu-gb-housekeeper

Copy link
Copy Markdown
Contributor

@kody start-review

@kody-ai

kody-ai Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Automatic approval held

Kody's assessment:

The PR title or description changed after risk assessment.

@kody-ai

kody-ai Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Code Review Could Not Complete ⚠️

The review failed before suggestions could be generated.

Reason: Rate limit reached on the provider (openai). Try again in a few minutes.

openai · gpt-6-luna · HTTP 429 · generalist

Provider said: Rate limit reached for gpt-6-luna in project proj_amEJPWcCdTmwUHS7U8jmAdgx organization [redacted] on tokens per min (TPM): Limit 200000, Used 187235, Requested 17553. Please try again in 1.437s. Visit https://platform.openai.com/account/rate-limits to learn more.

After fixing the issue, comment @kody review on this PR to re-run the review.

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Validate Business Logic: Ask Kody to validate your code against business rules by adding a comment with the @kody -v business-logic command.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ✅

Access your configuration settings here.

​

@jaywedgeworth22
jaywedgeworth22 merged commit 5547fe4 into main Dec 4, 2026
12 of 13 checks passed
@jaywedgeworth22
jaywedgeworth22 deleted the GB-Housekeeper/um-litestream-restart-snapshot branch December 4, 2026 00:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant