From 59e32e35296bde93046d44ea12ffd1465ef0c24c Mon Sep 17 00:00:00 2001 From: Steve Yegge Date: Sat, 13 Dec 2025 06:57:10 -0800 Subject: [PATCH] fix(sync): add multi-repo support to hash update after restore The previous fix didn't handle the multi-repo case - it used bare 'jsonl_content_hash' key but daemon uses 'jsonl_content_hash:'. Now properly computes repoKey for multi-repo support. --- cmd/bd/sync.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cmd/bd/sync.go b/cmd/bd/sync.go index ec03f150..ecef9274 100644 --- a/cmd/bd/sync.go +++ b/cmd/bd/sync.go @@ -669,9 +669,14 @@ Use --merge to merge the sync branch back to main branch.`, } else { // Update jsonl_content_hash to match the restored file // This prevents daemon/CLI from seeing a hash mismatch and re-importing - // which would trigger re-export and dirty the working directory (bd-c83r race fix) + // which would trigger re-export and dirty the working directory (bd-lw0x race fix) + // Uses repoKey for multi-repo support (bd-ar2.10, bd-ar2.11) + hashKey := "jsonl_content_hash" + if rk := getRepoKeyForPath(jsonlPath); rk != "" { + hashKey += ":" + rk + } if restoredHash, err := computeJSONLHash(jsonlPath); err == nil { - if err := store.SetMetadata(ctx, "jsonl_content_hash", restoredHash); err != nil { + if err := store.SetMetadata(ctx, hashKey, restoredHash); err != nil { debug.Logf("sync: failed to update hash after restore: %v", err) } }