Pace mailmind requests and retry transient rate limits #38

Merged
piers merged 2 commits from feat/svd-dev-people-mind-mcp-35-pace-the-mailmind-client-20-p-3cf65163 into main 2026-11-02 04:19:03 +00:00
Collaborator

Add configurable token-bucket pacing with a 4 requests/s default and burst of 10. Reopen MCP sessions for bounded rate-limit retries, honour Retry-After, and retain accepted pages and completed evidence calls within each pass. Preserve persisted state and value-free error codes.

Add deterministic pacing and HTTP retry tests. Validation: pristine baseline 143 passed; focused tests 59 passed; neighbouring suites 167 passed; make check passed with 282 passed and 5 skipped. Source distribution and wheel built successfully. Standards self-review found no remaining issues.

Closes #35
Co-Authored-By: gpt-6.1-sol noreply@openai.com

Add configurable token-bucket pacing with a 4 requests/s default and burst of 10. Reopen MCP sessions for bounded rate-limit retries, honour Retry-After, and retain accepted pages and completed evidence calls within each pass. Preserve persisted state and value-free error codes. Add deterministic pacing and HTTP retry tests. Validation: pristine baseline 143 passed; focused tests 59 passed; neighbouring suites 167 passed; make check passed with 282 passed and 5 skipped. Source distribution and wheel built successfully. Standards self-review found no remaining issues. Closes #35 Co-Authored-By: gpt-6.1-sol <noreply@openai.com>
Add configurable token-bucket pacing with a 4 requests/s default and burst of 10. Reopen MCP sessions for bounded rate-limit retries, honour Retry-After, and retain accepted pages and completed evidence calls within each pass. Preserve persisted state and value-free error codes.

Add deterministic pacing and HTTP retry tests. Validation: pristine baseline 143 passed; focused tests 59 passed; neighbouring suites 167 passed; make check passed with 282 passed and 5 skipped. Source distribution and wheel built successfully. Standards self-review found no remaining issues.

Closes #35
Co-Authored-By: gpt-6.1-sol <noreply@openai.com>
Persist accepted cursors with pending interactions and preserve full-pass status on resume. Save checkpoints only after fetch failures; retain stored state after ingest rollback.

Add resume, rollback and malformed-page regression coverage. make check passes: 288 passed, 5 skipped, 4 deselected; lint, formatting and mypy clean.

Closes #35
Co-Authored-By: gpt-6.1-sol <noreply@openai.com>
Owner

Architect verification (host, scratch worktree)

Check Baseline 2224edd 61c11cc (dispatch) c27d5f6 (integrate rework, PR head)
tests/test_mailmind.py 53 59 passed 65 passed
neighbours (test_mailmind test_config_cli test_carddav test_vcard_sync) 143 passed 167 passed 173 passed
full static suite 260 passed 282 passed 288 passed, 9 skipped
mypy / ruff check / ruff format clean clean clean
merge onto main 685a131 (git merge-tree) n/a clean clean
nested .git under worktree 0 0 0

The 9 skips are Radicale (3), deploy integration (4) and the two embed model tests (no models/ in the scratch worktree). Not a PR effect.

Scope note for the merger

The gate ruled D1 in-pass resume only (see the Agent Adjustments section of the spec and the gate comment on #35) and filed #36 for the cross-pass checkpoint. The dispatch commit 61c11cc honoured that ruling. The integrate rework round then read the spec's Test Strategy table literally, called the missing checkpoint a blocker, and added it in c27d5f6: MailmindSource.resumable = True, per-page self.state with cursor, pending and full, and a failure-path UPSERT_STATE in sync.run_pass guarded by fetched_ok (fetch failures checkpoint; ingest rollback keeps the loaded state).

Read as code, c27d5f6 is the spec's own worked design for #36 and matches the issue's acceptance criterion 3 as written. Six new tests cover resume at both cursors, ingest rollback, malformed page replay, and the stored shape. The one item it does not settle is a size bound on pending for a large first pass (#36 item 3).

Two merge options:

  1. Merge the PR head c27d5f6. #35 closes with the issue's full acceptance list delivered; #36 narrows to the size bound.
  2. Merge at the gated scope. The architect pushes a revert of c27d5f6 to this branch first; #36 keeps the whole decision.

Architect recommendation: option 1. The guard is the one the spec designed, the shared run_pass change is nine lines behind a resumable opt-in that only the mailmind Source sets, and the behaviour is what #35 asked for. The runner's post-gate scope change is filed against dev/stables separately.

## Architect verification (host, scratch worktree) | Check | Baseline 2224edd | 61c11cc (dispatch) | c27d5f6 (integrate rework, PR head) | |---|---|---|---| | `tests/test_mailmind.py` | 53 | 59 passed | 65 passed | | neighbours (`test_mailmind test_config_cli test_carddav test_vcard_sync`) | 143 passed | 167 passed | 173 passed | | full static suite | 260 passed | 282 passed | 288 passed, 9 skipped | | mypy / ruff check / ruff format | clean | clean | clean | | merge onto main 685a131 (`git merge-tree`) | n/a | clean | clean | | nested `.git` under worktree | 0 | 0 | 0 | The 9 skips are Radicale (3), deploy integration (4) and the two embed model tests (no `models/` in the scratch worktree). Not a PR effect. ## Scope note for the merger The gate ruled D1 **in-pass resume only** (see the Agent Adjustments section of the spec and the gate comment on #35) and filed #36 for the cross-pass checkpoint. The dispatch commit 61c11cc honoured that ruling. The integrate rework round then read the spec's Test Strategy table literally, called the missing checkpoint a blocker, and added it in c27d5f6: `MailmindSource.resumable = True`, per-page `self.state` with `cursor`, `pending` and `full`, and a failure-path `UPSERT_STATE` in `sync.run_pass` guarded by `fetched_ok` (fetch failures checkpoint; ingest rollback keeps the loaded state). Read as code, c27d5f6 is the spec's own worked design for #36 and matches the issue's acceptance criterion 3 as written. Six new tests cover resume at both cursors, ingest rollback, malformed page replay, and the stored shape. The one item it does not settle is a size bound on `pending` for a large first pass (#36 item 3). Two merge options: 1. **Merge the PR head c27d5f6.** #35 closes with the issue's full acceptance list delivered; #36 narrows to the size bound. 2. **Merge at the gated scope.** The architect pushes a revert of c27d5f6 to this branch first; #36 keeps the whole decision. Architect recommendation: option 1. The guard is the one the spec designed, the shared `run_pass` change is nine lines behind a `resumable` opt-in that only the mailmind Source sets, and the behaviour is what #35 asked for. The runner's post-gate scope change is filed against dev/stables separately.
piers merged commit 5e0a500118 into main 2026-11-02 04:19:03 +00:00
Sign in to join this conversation.
No description provided.