#15383·langflow

Cooperatively cancelled memory ingestion is recorded as completed

Author: LiuzikaiiCreated Sep 24, 2026Updated Sep 30, 2026
Labelsbugjira

Bug Description

A Memory Base ingestion job cancelled through its persisted job status can finish with COMPLETED rather than CANCELLED. This reports success even though ingestion deliberately aborted and may have removed partial writes.

Reproduction

  1. Start a Memory Base ingestion through the existing JobService.execute_with_status(..., ingest_memory_task, ...) path.
  2. Cancel its active job while it is waiting to write, or while the vector backend is writing documents. Asset deletion uses cancel_in_flight_jobs_by_asset for this.
  3. Let the ingestion task observe the cancellation and return.
  4. Read the same job from the database.

Actual final status: completed. Expected: cancelled.

Two deterministic tests use the real JobService and SQLite transactions, inject cancellation before writing or during a partial write, and read the final persisted row. Both fail with completed != cancelled before the fix. They also check that message ingestion metadata/cursors are not advanced and partial writes are cleaned up.

Root cause

ingest_memory_task returns a normal dictionary on both cooperative cancellation paths. execute_with_status interprets any normal return as success and unconditionally writes COMPLETED. The wrapper already recognizes CancelledError("LANGFLOW_USER_CANCELLED") and records CANCELLED, but these ingestion paths do not use that contract.

Expected behavior

Propagate the recognized cancellation after required cleanup, retain the finished timestamp and cancellation status, and avoid stamping messages or advancing the ingestion cursor.

Duplicate checks

Checked cancellation/ingestion/status issues and PRs across all states, discussions and path history. #13827 concerns swallowed cancellation in message persistence; #15357 concerns concurrent JSON metadata patches. Neither addresses these normal-return paths in Memory Base ingestion.

Impact and severity

Severity: Medium. A cancelled/partially cleaned-up ingestion is reported as successful. The fix uses the existing job-wrapper cancellation contract; successful ingestion and persisted job schemas remain compatible.

Environment

Verified on main@df9711c952a8e798e8fbbad8f25fe60be5ff6018 and release-1.13.0@33cedec5b299c7e2e8072627b8ef62460254da5b; the affected source is identical on both. Linux, Python 3.12.14. Tests use each branch’s locked dependencies.