fix(staleness): skip auto-import when store is read-only (GH#1089)

Track whether the store was actually opened read-only (vs just requested)
since the fallback logic may change opts.ReadOnly. Use this to skip
auto-import in staleness checks - importing would fail anyway if the
store is read-only.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
beads/crew/emma
2026-01-18 16:39:48 -08:00
committed by Steve Yegge
parent c8ffcce621
commit 4bc0b698a8
2 changed files with 9 additions and 3 deletions

View File

@@ -46,7 +46,8 @@ func ensureDatabaseFresh(ctx context.Context) error {
// Database is stale - auto-import to refresh (bd-9dao fix)
// For read-only commands running in --no-daemon mode, auto-import instead of
// returning an error. This allows commands like `bd show` to work after git pull.
if !noAutoImport {
// Skip auto-import if store is read-only - it can't write anyway (GH#1089)
if !noAutoImport && !storeIsReadOnly {
autoImportIfNewer()
return nil
}