Skip to content

feat(object-store): D165 transient object-store failures answer a retryable 503 - #695

Merged
fazpu merged 6 commits into
mainfrom
feat/d165-object-store-unavailable
Nov 29, 2026
Merged

fazpu merged 6 commits into
mainfrom
feat/d165-object-store-unavailable

Conversation

@fazpu

@fazpu fazpu commented Nov 29, 2026

Copy link
Copy Markdown
Member

Implements the accepted D165 design (#693,
plan/designs/object_store_unavailable_design.md).

Why

On 2026-11-28 08:30 UTC, one ingest of an unchanged document answered HTTP 500 on remember.dev, from a botocore
ClientError in the raw-original write. The S3 client deliberately makes one attempt per request, so a transient
object-store failure surfaced as an unhandled 500 that clients could not tell from a bug. The SDKs did not decode
retryable on /ingest.

What changes

  • Adapter (adapters/selfhost/minio.py): transient provider failures are classified per call and raised as
    ObjectStoreUnavailableError. These are HTTP 5xx, throttling, RequestTimeout, connect/read timeouts, closed
    connections and stream errors. The error is a direct Exception subclass exported from rememberstack.model and keeps the
    provider cause chained. Existing-key, absence and NotImplemented handling is unchanged. Automatic boto retries stay off.
  • HTTP: answers 503 {"detail": {"code": "object_store_unavailable", "message", "retryable": true}} and logs once at ERROR
    under D158, without provider text.
  • MCP: in-process MCP maps the error to the same retryable tool error.
  • SDKs: the Python and TypeScript SDKs decode the code first, only at 503, with retryable taken from the wire. They still
    never replay writes automatically.
  • Workers: the error counts as a dependency outage and uses the existing staggered backoff.
  • Docs: the HTTP, SDK and observability reference pages are updated.

Nothing touches retrieval, extraction or identity.

Tests

The design's §8 tests:

  • adapter: a transient matrix across all operations, exactly one client call on transient write failures, multipart abort,
    and the base class and export boundary;
  • HTTP: the 503 envelope with a single redacted log record on ingest, references, archive and unarchive;
  • SDKs (Python and TypeScript), MCP (bridge and in-process), worker retry and dead-letter logging, and work-ledger dependency
    backoff.

Local results (Antigravity run):

  • unit pack 4,107 passed;
  • TypeScript client 676 passed, with generated, parity, typecheck and package checks;
  • ruff, pyright, import contracts, test inventory, storage-capture fixture, OpenAPI export (0 diff), client-API check,
    docs-truth (public and cloud) and the llms check all pass.

The PostgreSQL and MinIO integration tests run in CI.

Process

  • Implemented by Antigravity (Gemini 4 Neon High).
  • Reviewed by an independent Claude reviewer, because GPT-6.2 sol is unavailable until 2026-12-02; a GPT re-review is planned
    then.

Contributor agreement

Signing on behalf of a legal entity (leave blank if accepting individually):

🤖 Generated with Claude Code

https://claude.ai/code/session_01VYytLf2PUQ2RVpEZYENzsq

fazpu and others added 4 commits November 29, 2026 04:52
…ailableError (D165)

Define ObjectStoreUnavailableError as a direct Exception subclass in
rememberstack.model.object_store (re-exported from rememberstack.model only)
with a fixed Rule-4-safe message and closed-allowlist diagnostic attributes.
Map transient S3 ClientErrors and botocore transport/stream failures across
all MinIOObjectStore network calls and StreamingBody.read() sites while
keeping retries disabled (total_max_attempts=1) and all semantic/permanent
paths unchanged.

Co-Authored-By: Gemini 4 Neon <noreply@google.com>
…P, MCP, and workers (D165)

- Register HTTP 503 handler on FastAPI app answering retryable
  object_store_unavailable with one Rule-4-safe D158 ERROR record.
- Map ObjectStoreUnavailableError in in-process MCP write/archive backends
  with the same single D158 ERROR log record and retryable ToolError.
- Add ObjectStoreUnavailableError to workers._dependency_unavailable so
  WorkLedger.fail applies staggered dependency-outage backoff.
- Add HTTP, MCP, worker, and WorkLedger acceptance tests and refresh the
  storage-capture source-digest fixture.

Co-Authored-By: Gemini 4 Neon <noreply@google.com>
…pt clients (D165)

Decode HTTP 503 object_store_unavailable before /query/* and /readiness
branches in both SDKs, taking retryable from the wire boolean, rejecting
non-503 statuses, and preserving no-auto-retry on writes. Add SDK unit,
HTTP, and Python-TypeScript parity tests and regenerate client metadata.

Co-Authored-By: Gemini 4 Neon <noreply@google.com>
…elds (D165)

Update the six docs pages specified in D165 §7 (errors, HTTP API, ingest,
Python SDK, TypeScript SDK, observability) and regenerate llms-full.txt.

Co-Authored-By: Gemini 4 Neon <noreply@google.com>
@fazpu

fazpu commented Nov 29, 2026

Copy link
Copy Markdown
Member Author

Implementation review, round 1 (independent Claude reviewer; head e5d1bb7): APPROVE

The code matches D165:

  • Adapter: per-call translation, with existing-key, absence and NotImplemented handling running first; the transient
    sets match §1; guards and yields sit outside translation; multipart abort is kept; total_max_attempts=1.
  • Error type: a direct Exception subclass exported from rememberstack.model.
  • HTTP: a 503 envelope with one safe ERROR record.
  • MCP: in-process MCP logs once.
  • SDKs: both decode the code first, only at 503, with retryable from the wire and no replay.
  • Workers: a one-line _dependency_unavailable change.
  • Docs and generated files: docs include the post-commit caveat; generated artefacts are consistent; all CI passes.

Non-blocking findings, addressed before merge:

  1. test_before_write_guard_failure_propagates_unchanged (test_minio_store.py:1365) cannot fail. Make the guard raise an
    error the translator would wrap, such as SlowDown/503 or EndpointConnectionError, and assert identity. Add multipart
    (before upload_part and before complete), abort_uploads, remove_empty_folder_markers and purge_objects cases.
  2. test_retrying_ingest_after_object_store_503_succeeds uses a fake ingestor. Add an e0-level test with the real
    UploadIngestor:
    • write_bytes lands the bytes and then raises ObjectStoreUnavailableError once: the retry gives created=True;
    • purge_objects fails after commit: the retry gives created=False;
    • in both cases there are no duplicate rows.
  3. Set D165 to "accepted; implemented" in decisions.md and in the design header.
  4. In observability/page.mdx:82, write "An unexpected MCP tool failure (internal_error) keeps …".
  5. Make _object_store_unavailable(*, error=...) keyword-only (mcp.py:105).
  6. Comment the unreachable SSLError guard in _translate_transient_errors, or drop it.

fazpu and others added 2 commits November 29, 2026 05:22
)

Co-Authored-By: Gemini 4 Neon <noreply@google.com>
- Strengthen test_before_write_guard_failure_propagates_unchanged to raise
  translator-wrappable errors (SlowDown/503, EndpointConnectionError), assert
  identity, and cover single-part, multipart (create, upload_part, complete),
  abort_uploads, remove_empty_folder_markers, and purge_objects paths.
- Add real UploadIngestor E0 retry tests for post-write and post-commit
  purge_objects ObjectStoreUnavailableError with zero duplicate rows.
- Mark D165 accepted; implemented in decisions.md and the design header.
- Clarify observability/page.mdx:82 for unexpected MCP tool failures
  (internal_error) and regenerate website/public/llms-full.txt.
- Make _object_store_unavailable(*, error=...) keyword-only in mcp.py.
- Drop the unreachable SSLError guard in _translate_transient_errors and
  document concrete subclass exclusion on _TRANSIENT_BOTOCORE_ERRORS.
- Regenerate src/tests/fixtures/storage_capture/live_corpus_profile.json.

Co-Authored-By: Gemini 4 Neon <noreply@google.com>
@fazpu
fazpu merged commit 4e1b293 into main Nov 29, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant