Pearl th-e979ac: unified backoff+jitter retry on the dolt read-only lock-flap#267
Merged
Conversation
…ock-flap Consolidates the two scattered one-shot self-heals (run_cli doctor-retry, run_with_self_heal respawn-retry) into one retry_on_lock_flap(op, recover) helper: recover once (clear local orphan / force-respawn), then exponential backoff + jitter until success or a bounded budget (default 30s, env override). Every dolt write funnels through it — pearls create/update/close, th msg send/reply, push, memory — so a concurrent writer's transient "database is read only" is waited out transparently everywhere instead of failing fast in CLI mode. Non-lock errors propagate immediately. Drops the th-mail skill's hand-rolled retry. No new dep (jitter from SystemTime). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TwUg6nyMqXHzFDsibzTKmp
🦋 Changeset detectedLatest commit: 62ce8cd The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
brentrager
enabled auto-merge (squash)
July 25, 2026 19:54
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.
Problem
The transient
Error 1105: cannot update manifest: database is read only— a concurrent writer (usually another agent's push) briefly holding the single-writer Dolt lock — failed fast: CLI mode ranauto_doctor, found no orphan, and returned the error immediately; server mode force-respawned once and gave up. Agents (and the th-mail flow) hand-retried it ad-hoc.Fix — one funnel, all commands (answers "does this apply to all dolt commands?")
Consolidates the two scattered one-shot self-heals (
run_clidoctor-retry +run_with_self_healrespawn-retry) into a singleretry_on_lock_flap(op, recover)helper that every dolt write funnels through:smooth-dolt serve; server: force-respawn a wedged child) — clears a genuinely stuck local holder.SMOOTH_DOLT_LOCK_RETRY_BUDGET_SECS, default 30s).Non-lock errors (syntax, transport, corruption) propagate immediately; budget exhaustion returns the read-only error with a
th pearls doctor --reaphint rather than hanging.Now covers
th pearls create/update/close,th msg send/reply,th pearls push, and memory writes alike — the flap is waited out transparently everywhere. The th-mail skill's hand-rolled retry guidance is dropped since the store self-heals. No new dependency (jitter fromSystemTime).Dedup (answers "fewer hooks / dedup of efforts")
Before: two independent inline retries + a skill-level manual retry, none with real backoff. After: one helper, one backoff/jitter/budget policy, called from both modes. The transport-error and sync-timeout paths stay separate (distinct failure modes).
Tests
5 new (
lock_flap_tests): retries-then-succeeds + recover-exactly-once, non-lock propagates without recover, success-first never recovers, jitter within [0.5,1.5)×, constants sane. Full crate suite: 179 passed; clippy/fmt clean.🤖 Generated with Claude Code