Repository navigation
fix(relayer,sdk): retry transient recall drops and surface all-dropped recalls (#1036) - #1362
Conversation
ducnmm
left a comment
There was a problem hiding this comment.
[P2] Prepare new SDK release versions for the changed runtime payloads
This changes the TypeScript and Python SDK runtime/API (including the new all-dropped error and recall options), but their versions remain 0.1.12 and 0.2.2, which are already published. The stable release workflows skip publishing an existing version, so these SDK changes would not reach package users after promotion without a new release. The main-promotion version guard also fails against current main with packages/sdk: runtime payload changed but version 0.1.12 was not increased (received 0.1.12). Update the affected SDK version manifests and synchronized package/docs changelogs before shipping these payloads. No full Rust, sidecar, or SDK test suites were rerun locally in this review; the release guard was run against this exact head.
|
Thanks @ducnmm for the review. I have updated both SDK version manifests and synchronized their changelogs:
Re-requesting review. |
ducnmm
left a comment
There was a problem hiding this comment.
The affected SDK versions are now updated to TypeScript 0.1.13 and Python 0.2.3. The main-promotion version guard and manual manifest/changelog verifier pass. One remaining documentation mismatch is noted below; no runtime change is requested for this point.
|
|
||
| ### Added | ||
|
|
||
| - `MemWalRecallAllDroppedError` (`name = "MemWalRecallAllDropped"`, `code = "RECALL_ALL_DROPPED"`) is thrown by `recall` and `recallManual` when every vector search match is dropped during Walrus blob download or SEAL decryption. It exposes `total`, `droppedCount`, and `namespace`. (#1036, #1070) |
There was a problem hiding this comment.
The new all-dropped handler is implemented in recall() only. recallManual() still directly returns the /api/recall/manual response and neither performs this check nor accepts onDropped, so claiming that it throws this error gives callers an unsupported guarantee. Please restrict this entry and the matching docs changelog to recall(). Also, the ignore-mode result in the entry below exposes dropped_count; droppedCount belongs to the thrown error object.
There was a problem hiding this comment.
Fixed in 6da4d1c: restricted the MemWalRecallAllDroppedError claim to recall() and updated the { onDropped: "ignore" } payload field to dropped_count in both CHANGELOG.md and docs/sdk/changelog.mdx.
|
@harrymove-ctrl Please preserve the existing Please align the SDK implementations, mocks, documentation and tests. Add regression coverage showing that an omitted policy returns the all-dropped result, while explicit |
|
|
@harrymove-ctrl Thanks for updating the default policy to Please preserve the existing This requires reverting both the relayer’s pre-drop Please align the docs and regression tests for healthy, partial-drop, and all-dropped responses, including legacy relayer responses. We can keep retries and degraded-result handling together in this PR once the |
|
@ducnmm Addressed in 3b29a5b. Preserved existing usable items total semantics by reverting the relayer's pre-drop total calculation to results.len() and reverting SDK normalization that altered total from 0 to dropped_count on all-dropped recalls. Aligned API reference docs, changelogs, and regression tests across healthy, partial-drop, all-dropped, and legacy responses. |
d09d6fa to
9e5102a
Compare
|
Rebased onto dev cleanly. All 390 TypeScript SDK tests and 513 Python SDK tests pass with zero lint errors. Re-requested review. |
ducnmm
left a comment
There was a problem hiding this comment.
Reviewed recall compatibility, retry boundaries, and middleware degradation handling. The default policy preserves degraded results and usable-item total semantics; typed errors remain opt-in. TypeScript SDK tests passed (390), and focused Python client/mock tests passed (95). Rust/MCP tests and live upstream-outage checks were not rerun locally.
…nd all dropped recalls
9e5102a to
e92b264
Compare
|
Rebased cleanly onto latest dev (commit e92b264), resolving mcp/tools/recall.ts conflict with the newly merged empty-namespace diagnostics. All 390 SDK unit tests pass; re-requesting review. |
Summary
Fixes #1036
Fixes #1070
When every vector match in
POST /api/recallfailed Walrus blob download or SEAL decryption during a transient upstream flake, the relayer dropped all matches without retrying within the request deadline and returned HTTP200withresults: []andtotal: 0. Becausetotalused the post-drop result length and nodegradedwire flag was set, callers saw a response identical to a genuinely empty namespace.Root Cause
download_and_decrypt_blobsand the SEAL sidecar (/seal/decrypt,/seal/decrypt-batch) dropped failed blob downloads and transient key-server RPC failures on the first attempt instead of retrying within the remaining request deadline.DecryptOutcome::permanent_from_errorchecked"fetch_keys failed"before permanent SEAL substrings (NoAccessError,InvalidCiphertext,InvalidPersonalMessageSignature,Not enough shares), misclassifying permanent key-fetch rejections as transient and omitting sidecarBatchDecryptError.code.routes/recall.rssetRecallResponse.total = results.len()(post-drop count) and emitted nodegradedwire flag when matches were dropped.@mysten-incubation/memwal(TypeScript SDK) andmemwal(Python SDK) lacked adegradedflag, normalized pre-droptotalhandling, and anonDropped/on_droppedpolicy option to either inspect the degraded result or opt into a typed error when every matched memory was dropped.Changes by Surface
services/server):stage::run_with_deadlinetask-local context withremaining_budget()andbackoff_if_budget_allows(backoff, min_headroom)so retries only run when at least 1000ms of request budget remains.download_ciphertext_with_retry(200ms backoff) anddecrypt_chunk_with_retry(250ms backoff, retrying either a whole-chunk 503UpstreamUnavailableor only theDecryptOutcome::Failed { permanent: false }subset).BatchDecryptError.codefrom the sidecar and prioritized permanent SEAL codes/messages before generic"fetch_keys failed"matching so permanent errors are never retried.build_recall_responseto settotalto the pre-drop match count (hit_count.max(results.len() + dropped_count)) and emitdegraded: truewheneverdropped_count > 0(skip_serializing_if = "is_false"for clean responses).services/server/scripts):retryTransientSealDecryptRpc(up to 2 attempts, 250ms backoff) aroundcreateDecryptSealClient()andfetchKeysin/seal/decryptand/seal/decrypt-batch, skipping permanent SEAL errors immediately.memwal_recallMCP tool to inspectdropped_count > 0empty responses (as well asMemWalRecallAllDroppedError) and surfaceisError: truewith an explicit dropped-blob diagnostic message.packages/sdk):degraded?: booleanonRecallResultandonDropped?: "ignore" | "throw"(defaulting to"ignore") onRecallOptionsacrossMemWalandMemWalMock.onDropped: "ignore"), an all-dropped recall returns the degradedRecallResult(results: [],degraded: true,dropped_count, and pre-droptotal) without throwing.MemWalRecallAllDroppedError(name = "MemWalRecallAllDropped",code = "RECALL_ALL_DROPPED", exposingtotal,droppedCount, andnamespace), thrown whenonDropped: "throw"is selected.withMemWalAI SDK middleware to report degraded all-dropped recalls viaonRecallError, avoid caching empty context on transient failure, and proceed gracefully with generation.packages/python-sdk-memwal):MemWalRecallAllDropped(code = "RECALL_ALL_DROPPED"),degraded: bool = FalseonRecallResult, andon_dropped: str = "ignore"("ignore"or"throw") acrossMemWal,MemWalSync,MemWalMock,MemWalMockSync, andRecallParams.on_droppedreturns the degradedRecallResult, while expliciton_dropped="throw"raisesMemWalRecallAllDropped.Verification
cargo test --bin memwal-server(engine::stage::tests,storage::seal::tests,engine::walrus_seal::tests,routes::recall::tests),cargo build --features ci-offline-onchain --bin memwal-server, andcargo clippy --bin memwal-serverpassed.node --test --import tsx ./mcp/__tests__/recall-max-distance.test.ts ./__tests__/sidecar-seal-routes.test.ts(25 passed).pnpm --filter @mysten-incubation/memwal build && pnpm --filter @mysten-incubation/memwal test(379 passed, 0 failed).uv run --extra dev ruff check memwal/ tests/anduv run --extra dev pytest -q(520 passed, 0 failed).@mysten-incubation/memwal-mcp,@mysten-incubation/oc-memwal,check-compatibility-contract.mjs,check-docs-code-sync.mjs,check-docs-freshness.mjs, andverify-manual-sdk-release.mjsall passed.dev&Local vs devE2E Reproduction: Verified livedev(https://relayer.dev.memwal.ai) empty-namespace recall returns{ results: [], total: 0 }cleanly while all-dropped recall (degraded: true, dropped_count: 3, total: 3as well as legacytotal: 0, dropped_count: 2) returns the normalized degraded result by default and raisesMemWalRecallAllDroppedError/MemWalRecallAllDroppedwhenonDropped: "throw"/on_dropped="throw"is passed.