Sync start retry follow-ups from the PR #83 reviews: lock over-claim, secret re-read test, 3.12 loop crash #84
Labels
No labels
boundary:crosses
bug
enhancement
epic
needs-info
needs-triage
ready-for-agent
ready-for-human
svd:go
svd:hold
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
dev/messages-mind-mcp#84
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Findings from the two fresh reviews of PR #83 (#78) at
70992f3. Neither review found a blocker. Line numbers are at70992f3.Should fix first (privacy and explicit docs)
docs/install-single-host.md:195,README.md:103). It says "Otherwise the Rebuild refuses withsync-running." During the 60 s gap between launchd restarts, no process holds the lock. Take an operator who moves the Mirror aside with no export configured and does not stop the agent. The restarted agent makes a fresh empty Mirror and Tombstone store and syncs Forgotten messages back, and the Rebuild then refuses withrebuild-store-present. Only "stop the agent first" covers that window. State the risk plainly in both documents, and drop the claim that the lock covers it.sync.py:762). The mutationcfg = reloaded[0], which keeps the old secrets, survives every test. Under that mutant, a salt or key changed during the wait runs a pass (exit 0) where the code at the head gives exit 2 or 3. That is the core stale-secret risk of #78. Add a test where the salt changes during the wait, and one where the key changes.store.py:240).open_writer(create=False)callspath.resolve(), which raisesRuntimeErroron a loop on 3.12.suppress(StoreError)in_start_failure(sync.py:724) does not catch it. At the base the output wassync=error code=tombstones-unreadableand the loop retried. At the head it issync=error code=internaland the process exits. CatchRuntimeErrorandValueErrorthere, or useos.path.abspath.Should fix (documents)
sync.py:134,README.md:103). A second config with another Mirror and the sametombstone_pathruns beside a held lock. So does a symlinked Mirror reached through its other spelling. Say so in README, or derive the lock path frompath.resolve().OSErrormaps tostore-unavailable, which retries at start for ever (sync.py:146-149,sync.py:116). On NFS or SMB,flockcan fail outright (ENOLCK,ENOTSUP), and sync then never starts. README says only that the lock "may not stop a sync on another host". Add that sync can then never start and logsstore-unavailable, or map these errors to a stop code.store-unreadable(exit 3) and is nowstore-unavailable(exit 1, retried), per the updated test attests/test_config_cli.py:1880-1888. An unreadable Tombstone or export parent still givesstore-unreadable. Record the change in README, or make the two consistent.README.md:101lists onlyconfig=errorandsecret=errorfor a refused reload, but a reload with[feeder]removed printssync=error code=feeder-missing(exit 2).README.md:15and:32describesync --reconcilewith no word that it now refuses while the agent runs.Test gaps (mutations that survived)
O_NOFOLLOW(sync.py:140): no test plants a symlink at<mirror>.lock. DroppingO_CLOEXEC, and mode0o600changed to0o644, also survive.self.release()(sync.py:150), or callingrelease()before the new lock is taken: no test reloads to a differentstore.path. "The lock follows the config across a reload" is untested.feeder-missingcheck (sync.py:740): no test removes[feeder]during the wait. With the mutant, the CLI printsinternal. The in-loop salt check cannot fire after a reload, becausestart(…, "sync")always reads the salt. Delete it, or say why it stays.lock.holdafter therebuild-store-presentcheck (sync.py:810): no test holds the lock while a Mirror is present.os.close(fd)on async-runningrefusal (sync.py:142-144): low impact, because the process exits.Notes
tombstones-missing. The head starts an empty Tombstone store and runs a pass. This is safe only while "an unmarked Mirror means no Tombstone was ever written" holds. Every Forget and Rebuild path marks before it writes, unless an older Mirror copy is put back. Consider one README sentence on restoring an old Mirror copy.<mirror>.lock(0600) and maybe the Mirror directory. A planted lock file with mode 0666 keeps 0666, and nothing checks its owner, mode or type. This is low risk inside the 0700 store directory.sync-running. This fails closed.Acceptance criteria
Triage decisions (2026-11-16)
The operator accepted these decisions ("Yes, #84 next, my way"). Run SVD on this issue before #75.
docs/install-single-host.mdand README state plainly: the lock does not cover the gap between launchd restarts; if the agent is not stopped and no export is configured, a restarted agent makes fresh empty stores and can sync Forgotten messages back. So stop the sync agent before you move the Mirror or run a Rebuild. A documents test asserts the sentence.open_writer(create=False), build the URI frompath.absolute(), notpath.resolve(), and also mapRuntimeErrorandValueErrorto aStoreError. A test with a symlink-loop Mirror path asserts the start code (tombstones-unreadable) and a retry on Python 3.12.flockfails outright). Document it: on a filesystem whereflockfails (for example NFS or SMB), sync never starts and logsstore-unavailable. Do not add a code.store-unavailable(exit 1, retried).sync=error code=feeder-missingoutcome of a refused reload, and thatsync --reconcilerefuses withsync-runningwhile the agent runs.Blocked by
Filed under: #78 merge gate, fresh reviews of PR #83 at
70992f3.The operator accepted the triage decisions on 2026-11-16. They are in the issue body under "Triage decisions (2026-11-16)". #78 is closed (PR #83,
c67adfd). State: ready-for-agent.⏸ SVD architect gate: dev/messages-mind-mcp#84 sync-start-retry-follow-ups-from-the-pr-83-reviews-lock-over
Status: CLEAN after 0 rework round(s) · 0 blocking defect(s) · 0 lens(es) INCONCLUSIVE (could not run) · 0 lens(es) DEGRADED (deterministic denial) · complexity
standard· dispatch effortmediumRun:
20261116T020109Z-2af5723dHeld because: CLEAN but 5 open risk(s) (2 verification · 3 decision) — HOLD-ALL parks everything. The risks, verbatim:
Open risks:
uv run python3 -c "import sys; print(sys.version_info[:2])"prints (3, 12). Then check thatuv run python3 -m pytest --basetemp "$(mktemp -d)/t" tests/test_sync.py -k symlink_loopfails with RuntimeError on the pristine base with only the new test added, and passes on the branch. [verification]git diff c67adfd -- src/messages_mind_mcp/sync.pyshows only the Step 2 comment (no mutation committed). [verification]Change: Item 3: in store.open_writer (store.py:231-269), change line 240 from path.resolve().as_uri() to path.absolute().as_uri(), and widen the except at line 266 to (OSError, RuntimeError, ValueError, sqlcipher.Error, StoreError). This mirrors the catch shape at tombstones.py:205 and :261. _store_error (store.py:221-228) already maps these to store-unavailable, which _start_failure's suppress(StoreError) at sync.py:722-726 absorbs, so the loop prints tombstones-unreadable and retries. Item 10: sync.py:743 gets only a comment: the salt check can fire only on the first attempt, because a reload goes through start(…,"sync") and "sync" is in TOMBSTONE_SALT_VERBS (startup.py:20). There is no other sync.py logic change. Documents: rewrite install doc :195 and README :103 to say the lock does not cover the gap between launchd restarts, and what then happens (items 1, 4, 5). Add the item 6 sentence, the item 7 feeder-missing reload outcome (:101) and the --reconcile sync-running note (:15, :32), the item 13 old-Mirror sentence in Forget and recovery, and the item 14 lock-file known limit in SECURITY "What the sync worker limits". Keep every phrase that tests/test_sync_documents.py:157-193 asserts. Tests mirror BoundedStop/_bound_open_stores/configuration (tests/test_sync.py:31-57, 370-381), the reload-test shape at tests/test_config_cli.py:2225-2327, /dev/fd counting at test_sync.py:1147, and the pytest.raises(StoreError, match=...) pattern at test_store.py:430-444. The PR body carries a mutation log: 11 hand mutations, each shown to fail its test.
Files:
src/messages_mind_mcp/store.py·src/messages_mind_mcp/sync.py·tests/test_store.py·tests/test_sync.py·tests/test_config_cli.py·tests/test_sync_documents.py·README.md·SECURITY.md·docs/install-single-host.mdDecision: accept the 5 open risk(s) above and dispatch this spec (
svd:go), or park (svd:skip) / re-spec (svd:respec)?Your call (when this issue is held at the gate via
svd:hold):svd:go— approve; Half-B dispatch accepts exactly this spec (open risks accepted)svd:firebesidesvd:go— approve AND authorise the Half-B fire from the phone; never on its ownsvd:skip— park it; dispatch refuses it and the issue stays for a humansvd:respec— discard this spec; the next Half-A run re-produces it with this record as prior-attempt contextSpec:
/Users/piers/.local/state/exhaust/groupthink/specs/2026-11-16-sync-start-retry-follow-ups-from-the-pr-83-reviews-lock-over.md— next:codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-16-sync-start-retry-follow-ups-from-the-pr-83-reviews-lock-over.mdspec-verify-dispatch Half B for dev/messages-mind-mcp#84 sync-start-retry-follow-ups-from-the-pr-83-reviews-lock-over completed integration verify.
3fa2084c19codex-svd ship --run-id 20261116T021501Z-540984b4 --confirm-merge)