sync: the start-time failures and tombstones-schema-ahead exit inconsistently #38
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#38
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?
What happens
sync._run(src/messages_mind_mcp/sync.py) maps a failure to an exit status in two places, and the two places treat the same code differently.tombstones-schema-ahead(tombstones.py:38) exits1, so the loop is restarted.store-schema-ahead(store.py:196,:224) is inSTOP_CODESand exits3. Both mean that the file was written by a newer version of the service, and a restart cannot fix either.store-unavailableandtombstones-unreadableare retried when they occur during a pass: the loop waitspoll_secondsand tries again. When they occur at start, before the loop, the process ends with1.The README table that #32 adds records this behaviour as it is. #32 changes no behaviour.
What to decide
tombstones-schema-aheadtoSTOP_CODES, so that it exits3likestore-schema-ahead.Decisions
tombstones-schema-aheadjoinsSTOP_CODES.Acceptance criteria
tombstones-schema-aheadandstore-schema-aheadgive the same exit status. A test proves it.synccodes shows the new exit status of each changed code.Blocked by
Filed under: operator word "Grant" sha256:78b7d0379d5e
Triage
## Decisions.8a1e4f0, so theBlocked byedge is removed. Work onsync.pyandREADME.mdstill runs one item at a time (CONV-37).ready-for-agent.Agent Brief
Category: bug
Summary:
syncuses one exit rule for each failure code, at start and during a pass.Current behavior:
tombstones-schema-aheadexitsEXIT_FAILED(1), so a supervisor restarts the loop.store-schema-aheadis inSTOP_CODESand exitsEXIT_STOP(3). Both codes mean that a newer version of the service wrote the file. A restart cannot fix either.store-unavailableandtombstones-unreadableduring a pass are retried: the loop prints the error line, waitspoll_secondsand tries again. When the same codes occur at start, whilesyncopens the Mirror or the Tombstone store before the loop, the process exitsEXIT_FAILED.Desired behavior:
tombstones-schema-aheadis inSTOP_CODES.syncexitsEXIT_STOPfor it, with--onceand in the loop.syncprints the samesync=error code=...line as during a pass, waitspoll_seconds, and opens the stores again. A stop request ends the wait.STOP_CODESstill stopssync, at start and during a pass.--once,syncmakes one attempt and exits with the status for the code, as today.Key interfaces:
STOP_CODESin the sync module.syncand its open of the Mirror and the Tombstone store before the first pass.synccodes: its exit column and its "The loop" column. The document tests read this table.Acceptance criteria:
tombstones-schema-aheadandstore-schema-aheadgive the same exit status.store-unavailableandtombstones-unreadable, a test proves that a failure at start is retried in the loop and that a later open succeeds.STOP_CODESat start still ends the loop withEXIT_STOP.make checkpasses.Out of scope:
✅ SVD architect gate: dev/messages-mind-mcp#38 sync-the-start-time-failures-and-tombstones-schema-ahead-exi
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:
20261115T151108Z-d4a3e94fChange: In src/messages_mind_mcp/sync.py: (1) add "tombstones-schema-ahead" to STOP_CODES (:102-104) so _status (:640-643) returns EXIT_STOP. (2) Add RETRY_AT_START_CODES = frozenset({"store-unavailable", "tombstones-unreadable"}). (3) Extract the start open (:658-675) into _open_stores(cfg, secrets) -> (tombstones, conn); it closes the Tombstone store if _open_mirror fails, following the close-on-BaseException shape at :341-347. (4) Extract the failed_at record (:709-715) into _start_failure. (5) Wrap _open_stores in a retry loop in _run. On a coded error it records the failure and prints the same sync=error line. It returns _status when stop is None or the code is not in RETRY_AT_START_CODES; otherwise it calls stop.wait(poll_seconds) and returns EXIT_OK if the stop is set. The pass loop (:677-705) stays unchanged inside closing(tombstones)/closing(conn). In README.md:92-94, change store-unavailable and tombstones-unreadable to 'Tries again.' and tombstones-schema-ahead to '| 3 | Stops. |'. Write the new tests in tests/test_sync.py with the Stop(threading.Event) double from :600-639.
Files:
src/messages_mind_mcp/sync.py·README.md·tests/test_sync.pyDecision: dispatch this spec (
svd:go)?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-15-sync-the-start-time-failures-and-tombstones-schema-ahead-exi.md— next:codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-15-sync-the-start-time-failures-and-tombstones-schema-ahead-exi.mdspec-verify-dispatch Half B for dev/messages-mind-mcp#38 sync-the-start-time-failures-and-tombstones-schema-ahead-exi completed integration verify.
5d8a48884dtests/conftest.py:14: in
import tiktoken
E ModuleNotFoundError: No module named 'tiktoken'; spec-prescribed filter could not be collected (python3 -m pytest tests/test_sync.py -k retried_at_start): ImportError while loading conftest '/Users/piers/.codex/workflow-runs/spec-verify-dispatch/20261115T152146Z-5b437d91/worktree/tests/conftest.py'.
tests/conftest.py:14: in
import tiktoken
E ModuleNotFoundError: No module named 'tiktoken'; spec-prescribed filter could not be collected (python3 -m pytest tests/test_sync.py -k stop_request_ends_the_wait): ImportError while loading conftest '/Users/piers/.codex/workflow-runs/spec-verify-dispatch/20261115T152146Z-5b437d91/worktree/tests/conftest.py'.
tests/conftest.py:14: in
import tiktoken
E ModuleNotFoundError: No module named 'tiktoken'; spec-prescribed filter could not be collected (python3 -m pytest tests/test_sync.py -k "once_makes_one_attempt or tombstone_setup_failure"): ImportError while loading conftest '/Users/piers/.codex/workflow-runs/spec-verify-dispatch/20261115T152146Z-5b437d91/worktree/tests/conftest.py'.
tests/conftest.py:14: in
import tiktoken
E ModuleNotFoundError: No module named 'tiktoken'
tests/conftest.py:14: in
import tiktoken
E ModuleNotFoundError: No module named 'tiktoken'
tests/conftest.py:14: in
import tiktoken
E ModuleNotFoundError: No module named 'tiktoken'
tests/conftest.py:14: in
import tiktoken
E ModuleNotFoundError: No module named 'tiktoken'
tests/conftest.py:14: in
import tiktoken
E ModuleNotFoundError: No module named 'tiktoken'
tests/conftest.py:14: in
import tiktoken
E ModuleNotFoundError: No module named 'tiktoken'; no denial signature
tests/conftest.py:14: in
import tiktoken
E ModuleNotFoundError: No module named 'tiktoken'; no denial signature
tests/conftest.py:14: in
import tiktoken
E ModuleNotFoundError: No module named 'tiktoken'; no denial signature
tests/conftest.py:14: in
import tiktoken
E ModuleNotFoundError: No module named 'tiktoken'; no denial signature
tests/conftest.py:14: in
import tiktoken
E ModuleNotFoundError: No module named 'tiktoken'; spec-prescribed filter could not be collected (python3 -m pytest tests/test_sync.py -k retried_at_start): ImportError while loading conftest '/Users/piers/.codex/workflow-runs/spec-verify-dispatch/20261115T152146Z-5b437d91/worktree/tests/conftest.py'.
tests/conftest.py:14: in
import tiktoken
E ModuleNotFoundError: No module named 'tiktoken'; spec-prescribed filter could not be collected (python3 -m pytest tests/test_sync.py -k stop_request_ends_the_wait): ImportError while loading conftest '/Users/piers/.codex/workflow-runs/spec-verify-dispatch/20261115T152146Z-5b437d91/worktree/tests/conftest.py'.
tests/conftest.py:14: in
import tiktoken
E ModuleNotFoundError: No module named 'tiktoken'; spec-prescribed filter could not be collected (python3 -m pytest tests/test_sync.py -k "once_makes_one_attempt or tombstone_setup_failure"): ImportError while loading conftest '/Users/piers/.codex/workflow-runs/spec-verify-dispatch/20261115T152146Z-5b437d91/worktree/tests/conftest.py'.
tests/conftest.py:14: in
import tiktoken
E ModuleNotFoundError: No module named 'tiktoken'
spec-verify-dispatch Half B for dev/messages-mind-mcp#38 sync-the-start-time-failures-and-tombstones-schema-ahead-exi completed integration verify.
5d8a48884d5d8a488: ci/woodpecker/pr/validation green. Local focused suite 663 passed; ruff check, ruff format --check and mypy clean. All 8 scenario rows collect.codex-svd ship --run-id 20261115T152146Z-5b437d91 --confirm-merge)