Skip to content

fix(retain): reject async append without document_id at submit time - #5651

Merged
nicoloboschi merged 2 commits into
mainfrom
fix/async-retain-append-validation
Oct 16, 2026
Merged

nicoloboschi merged 2 commits into
mainfrom
fix/async-retain-append-validation

Conversation

@nicoloboschi

Copy link
Copy Markdown
Collaborator

Fixes #5415.

  • submit_async_retain now runs the same update_mode='append' checks as the sync path (needs a document_id; needs store_document_text on). One shared helper, _validate_retain_update_modes.
  • These raise InvalidRetainRequestError (subclass of ValueError), so POST /memories with async: true returns 400 instead of 200 + a failed operation.
  • The worker treats InvalidRetainRequestError as non-retryable, so a row that still hits it at run time fails at once instead of after ~4 minutes of retries.

Tests: engine-level async rejection, HTTP 400 for both async and sync, non-retry classification.

…5415)

The queued path never checked update_mode='append' against document_id, so the
item was accepted, failed in the worker, and was retried for minutes before
being marked failed. Both paths now share one check, raising a new
InvalidRetainRequestError (a ValueError, so HTTP answers 400). The worker treats
it as non-retryable, for any row that still meets it at run time (e.g. bank
config changed to store_document_text=false after submit).
…h paths

Review fix: the 200 -> 400 change for async retain had no blackbox story.
@nicoloboschi
nicoloboschi merged commit c8b7b33 into main Oct 16, 2026
117 checks passed
@nicoloboschi
nicoloboschi deleted the fix/async-retain-append-validation branch October 16, 2026 09:56
@nicoloboschi nicoloboschi mentioned this pull request Nov 3, 2026
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.

Async retain accepts update_mode=append without document_id, then fails after retries

1 participant