Mail peer pass reports a local store error as mailmind-unavailable and drops the sync_log row #87

Closed
opened 2026-11-04 14:20:13 +00:00 by svc-svd-writer · 2 comments
Collaborator

This was generated by AI during triage.

What happens

A local store error during a Mail peer pass is reported as mailmind-unavailable. When the store also refuses the sync_log write, the pass leaves no sync_log row, and nothing records that the write failed.

Seen live on rc.9, 2026-11-04 (peoplemind-piers):

  • 14:13:33Z: the Mail rebuild that starbase/iac#338 started activated (generation 37).
  • 14:13:35.36Z: Mail Mind logged its last mail_peer_evidence_v1 call, outcome: ok.
  • 14:13:35.40Z: the sync container logged source=mail kind=mailmind status=error code=mailmind-unavailable.
  • 14:13:35.44Z: the Litestream sidecar logged copy_file_range: no space left on device. The 1Gi data volume was full (starbase/iac#339 grows it).
  • sync_log has no row for this pass. The last mail row is id 545 (mailmind-rebuild, 14:02:56Z).

Mail Mind was up. The fault was the local disk, and the log named the wrong component.

Cause

_peer_pass in src/people_mind_mcp/sync.py (lines 667–676):

except Exception as exc:
    code = exc.code if isinstance(exc, SourceError) else "mailmind-unavailable"
    ...
    try:
        with transaction(conn):
            conn.execute(INSERT_SYNC_LOG, (..., code))
    except sqlite3.Error:
        pass
    raise SourceError(code) from None
  • Any exception that is not a SourceError, including sqlite3.Error from a store write in _mail_drain, becomes mailmind-unavailable.
  • A failed sync_log write is dropped silently.

The worker loop already maps sqlite3.Error and StoreError to store-unavailable (sync.py:740), and the embed worker does the same (sync.py:758). The Mail peer pass hides those errors from the loop by turning them into a SourceError first.

What to change

  • In _peer_pass, record sqlite3.Error and StoreError as store-unavailable (or the StoreError code), not mailmind-unavailable. Then re-raise them so the worker loop prints code=store-unavailable.
  • Keep mailmind-unavailable for transport failures from the Mail client (sources/mailpeer.py already raises SourceError for those).
  • When the error-row write to sync_log fails, print one line, source=<name> kind=mailmind sync_log=lost code=<code>, in place of pass.

Acceptance

  • A test makes a store write in _mail_drain raise sqlite3.OperationalError("database or disk is full"). The pass raises an error whose code is store-unavailable, and the worker output is code=store-unavailable.
  • A test where the sync_log insert also fails asserts the sync_log=lost line and no other change in behaviour.
  • The existing tests for mailmind-unavailable, mailmind-busy and mailmind-rebuild pass unchanged.

Out of scope

  • The CardDAV pass (sync.py:131–160) records non-SourceError failures as sync-failed and has the same silent except sqlite3.Error: pass. Leave it unchanged here.
  • No change to retry counts, timeouts or pending-address attempts.

Filed under: operator word "yes, proceed" sha256:ddb61daa709f

> *This was generated by AI during triage.* ## What happens A local store error during a Mail peer pass is reported as `mailmind-unavailable`. When the store also refuses the `sync_log` write, the pass leaves no `sync_log` row, and nothing records that the write failed. Seen live on rc.9, 2026-11-04 (`peoplemind-piers`): - 14:13:33Z: the Mail rebuild that starbase/iac#338 started activated (generation 37). - 14:13:35.36Z: Mail Mind logged its last `mail_peer_evidence_v1` call, `outcome: ok`. - 14:13:35.40Z: the sync container logged `source=mail kind=mailmind status=error code=mailmind-unavailable`. - 14:13:35.44Z: the Litestream sidecar logged `copy_file_range: no space left on device`. The 1Gi data volume was full (starbase/iac#339 grows it). - `sync_log` has no row for this pass. The last mail row is id 545 (`mailmind-rebuild`, 14:02:56Z). Mail Mind was up. The fault was the local disk, and the log named the wrong component. ## Cause `_peer_pass` in `src/people_mind_mcp/sync.py` (lines 667–676): ```python except Exception as exc: code = exc.code if isinstance(exc, SourceError) else "mailmind-unavailable" ... try: with transaction(conn): conn.execute(INSERT_SYNC_LOG, (..., code)) except sqlite3.Error: pass raise SourceError(code) from None ``` - Any exception that is not a `SourceError`, including `sqlite3.Error` from a store write in `_mail_drain`, becomes `mailmind-unavailable`. - A failed `sync_log` write is dropped silently. The worker loop already maps `sqlite3.Error` and `StoreError` to `store-unavailable` (`sync.py:740`), and the embed worker does the same (`sync.py:758`). The Mail peer pass hides those errors from the loop by turning them into a `SourceError` first. ## What to change - In `_peer_pass`, record `sqlite3.Error` and `StoreError` as `store-unavailable` (or the `StoreError` code), not `mailmind-unavailable`. Then re-raise them so the worker loop prints `code=store-unavailable`. - Keep `mailmind-unavailable` for transport failures from the Mail client (`sources/mailpeer.py` already raises `SourceError` for those). - When the error-row write to `sync_log` fails, print one line, `source=<name> kind=mailmind sync_log=lost code=<code>`, in place of `pass`. ## Acceptance - A test makes a store write in `_mail_drain` raise `sqlite3.OperationalError("database or disk is full")`. The pass raises an error whose code is `store-unavailable`, and the worker output is `code=store-unavailable`. - A test where the `sync_log` insert also fails asserts the `sync_log=lost` line and no other change in behaviour. - The existing tests for `mailmind-unavailable`, `mailmind-busy` and `mailmind-rebuild` pass unchanged. ## Out of scope - The CardDAV pass (`sync.py:131–160`) records non-`SourceError` failures as `sync-failed` and has the same silent `except sqlite3.Error: pass`. Leave it unchanged here. - No change to retry counts, timeouts or pending-address attempts. Filed under: operator word "yes, proceed" sha256:ddb61daa709f
Author
Collaborator

⏸ SVD architect gate: dev/people-mind-mcp#87 mail-peer-pass-reports-a-local-store-error-as-mailmind-unava

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 effort medium

Run: 20261104T213742Z-bcf9022c

Held because: CLEAN but 3 open risk(s) (2 verification · 1 decision) — HOLD-ALL parks everything. The risks, verbatim:

Open risks:

  1. Should peoplemind sync --once print store=error code=store-unavailable for a Mail store fault (the lean, via cli.main at cli.py:149-150, consistent with vCard/CardDAV store faults)? Or should cli._sync also catch StoreError and print the per-source source=mail kind=mailmind status=error code=store-unavailable line? The second option adds cli.py to the written set. [decision]
  2. The live-cause claim (the rc.9 mailmind-unavailable came from a sqlite3.Error in _mail_drain) is timestamp-inferred. Post-deploy check: on the next ENOSPC or forced store fault in a Mail pass, the sync container must log source=mail kind=mailmind status=error code=store-unavailable and either a sync_log row with error='store-unavailable' or a sync_log=lost code=store-unavailable line. If it still logs mailmind-unavailable, the fault came in as a non-store exception and needs a new issue. [verification]
  3. No pass/fail baseline was measured in Half A (target repo is read-only). Before the first edit, re-measure uv run python3 -m pytest tests/test_mailpeer.py -m "not integration" and make check on the pristine base. After the change, assert the failure set is unchanged apart from the three new passing tests. [verification]

Change: Edit only the except Exception as exc: block of _peer_pass in src/people_mind_mcp/sync.py:667-676. Classify sqlite3.Error/StoreError first: code = StoreError.code, or "store-unavailable" for sqlite3.Error. Otherwise keep today's lines 668-670 unchanged: SourceError.code, else "mailmind-unavailable", with HTTP 401/403 giving "mailmind-auth". Replace except sqlite3.Error: pass around the error-row INSERT_SYNC_LOG with print(f"source={source.name} kind=mailmind sync_log=lost code={code}"). Raise StoreError(code) from None for store faults and SourceError(code) from None otherwise. This mirrors open_writer's wrap at store.py:177-182. The worker loop at sync.py:739-741 already prints code=<StoreError.code>, so it needs no change. Do not touch the CardDAV/vCard handler at sync.py:131-160 or cli.py.

Files: src/people_mind_mcp/sync.py · tests/test_mailpeer.py

Decision: accept the 3 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):

  • add label svd:go — approve; Half-B dispatch accepts exactly this spec (open risks accepted)
  • add label svd:fire beside svd:go — approve AND authorise the Half-B fire from the phone; never on its own
  • add label svd:skip — park it; dispatch refuses it and the issue stays for a human
  • add label svd:respec — discard this spec; the next Half-A run re-produces it with this record as prior-attempt context

Spec: /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-04-mail-peer-pass-reports-a-local-store-error-as-mailmind-unava.md — next: codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-04-mail-peer-pass-reports-a-local-store-error-as-mailmind-unava.md

### ⏸ SVD architect gate: dev/people-mind-mcp#87 mail-peer-pass-reports-a-local-store-error-as-mailmind-unava **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 effort `medium` **Run:** `20261104T213742Z-bcf9022c` **Held because:** CLEAN but 3 open risk(s) (2 verification · 1 decision) — HOLD-ALL parks everything. The risks, verbatim: **Open risks:** 1. Should `peoplemind sync --once` print `store=error code=store-unavailable` for a Mail store fault (the lean, via cli.main at cli.py:149-150, consistent with vCard/CardDAV store faults)? Or should cli._sync also catch StoreError and print the per-source `source=mail kind=mailmind status=error code=store-unavailable` line? The second option adds cli.py to the written set. [decision] 2. The live-cause claim (the rc.9 mailmind-unavailable came from a sqlite3.Error in _mail_drain) is timestamp-inferred. Post-deploy check: on the next ENOSPC or forced store fault in a Mail pass, the sync container must log `source=mail kind=mailmind status=error code=store-unavailable` and either a sync_log row with error='store-unavailable' or a `sync_log=lost code=store-unavailable` line. If it still logs mailmind-unavailable, the fault came in as a non-store exception and needs a new issue. [verification] 3. No pass/fail baseline was measured in Half A (target repo is read-only). Before the first edit, re-measure `uv run python3 -m pytest tests/test_mailpeer.py -m "not integration"` and `make check` on the pristine base. After the change, assert the failure set is unchanged apart from the three new passing tests. [verification] **Change:** Edit only the `except Exception as exc:` block of `_peer_pass` in src/people_mind_mcp/sync.py:667-676. Classify `sqlite3.Error`/`StoreError` first: code = StoreError.code, or "store-unavailable" for sqlite3.Error. Otherwise keep today's lines 668-670 unchanged: SourceError.code, else "mailmind-unavailable", with HTTP 401/403 giving "mailmind-auth". Replace `except sqlite3.Error: pass` around the error-row INSERT_SYNC_LOG with `print(f"source={source.name} kind=mailmind sync_log=lost code={code}")`. Raise `StoreError(code) from None` for store faults and `SourceError(code) from None` otherwise. This mirrors open_writer's wrap at store.py:177-182. The worker loop at sync.py:739-741 already prints `code=<StoreError.code>`, so it needs no change. Do not touch the CardDAV/vCard handler at sync.py:131-160 or cli.py. **Files:** `src/people_mind_mcp/sync.py` · `tests/test_mailpeer.py` **Decision:** accept the 3 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`): - add label `svd:go` — approve; Half-B dispatch accepts exactly this spec (open risks accepted) - add label `svd:fire` **beside** `svd:go` — approve AND authorise the Half-B fire from the phone; never on its own - add label `svd:skip` — park it; dispatch refuses it and the issue stays for a human - add label `svd:respec` — discard this spec; the next Half-A run re-produces it with this record as prior-attempt context <sub>Spec: `/Users/piers/.local/state/exhaust/groupthink/specs/2026-11-04-mail-peer-pass-reports-a-local-store-error-as-mailmind-unava.md` — next: `codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-04-mail-peer-pass-reports-a-local-store-error-as-mailmind-unava.md`</sub>
Author
Collaborator

spec-verify-dispatch Half B for dev/people-mind-mcp#87 mail-peer-pass-reports-a-local-store-error-as-mailmind-unava completed integration verify.

  • PR: #89
  • Branch: feat/svd-dev-people-mind-mcp-87-mail-peer-pass-reports-a-loca-847d81f4
  • Commit: 82f83658fa
  • Build: none
  • Test: green
  • Reader audit clean: True
  • Spec fidelity: True
  • Ready for merge: True
  • Check ci/woodpecker/pr/validation: green https://ci.groupthink.asia/repos/73/pipeline/55/1
  • Checks: required ci/woodpecker/pr/validation resolved pass by CI-wait poll
  • Warning: Live-cause verification (Open Risk 2) remains post-deploy: confirm store-unavailable on the next Mail store fault.
  • Warning: sync --once now prints store=error code=store-unavailable for a Mail store fault (cli.py unchanged, exit code 1), as ruled at the architect gate.
  • Warning: Full make check was not re-run here; ruff check, ruff format --check and mypy passed, and tests/test_mailpeer.py passed (108 tests).
  • CI wait: ci/woodpecker/pr/validation -> pass
  • Decision: review the PR and merge? (codex-svd ship --run-id 20261104T215151Z-847d81f4 --confirm-merge)
spec-verify-dispatch Half B for dev/people-mind-mcp#87 mail-peer-pass-reports-a-local-store-error-as-mailmind-unava completed integration verify. - PR: https://git.groupthink.asia/dev/people-mind-mcp/pulls/89 - Branch: feat/svd-dev-people-mind-mcp-87-mail-peer-pass-reports-a-loca-847d81f4 - Commit: 82f83658fa0cb6ebc7e5eab2da1bf1f82250544e - Build: none - Test: green - Reader audit clean: True - Spec fidelity: True - Ready for merge: True - Check ci/woodpecker/pr/validation: green https://ci.groupthink.asia/repos/73/pipeline/55/1 - Checks: required ci/woodpecker/pr/validation resolved pass by CI-wait poll - Warning: Live-cause verification (Open Risk 2) remains post-deploy: confirm store-unavailable on the next Mail store fault. - Warning: sync --once now prints store=error code=store-unavailable for a Mail store fault (cli.py unchanged, exit code 1), as ruled at the architect gate. - Warning: Full make check was not re-run here; ruff check, ruff format --check and mypy passed, and tests/test_mailpeer.py passed (108 tests). - CI wait: ci/woodpecker/pr/validation -> pass - Decision: review the PR and merge? (`codex-svd ship --run-id 20261104T215151Z-847d81f4 --confirm-merge`)
svc-svd-writer 2026-11-04 22:04:00 +00:00
  • closed this issue
  • removed the
    svd:go
    label
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
dev/people-mind-mcp#87
No description provided.