Skip to content

fix(source): preserve original custom_id on cancellation - #601

Merged
lioraron merged 3 commits into
mainfrom
fix-598-cancel-custom-id
Jul 17, 2026
Merged

fix(source): preserve original custom_id on cancellation#601
lioraron merged 3 commits into
mainfrom
fix-598-cancel-custom-id

Conversation

@j-mok-dev

Copy link
Copy Markdown
Collaborator

Why is this PR needed?

After #584 merged, E2E tests (Cancel/InProgress, Cancel/IdempotentRetry, Expiration) regressed in CI (#596, #598, #599). The root cause was PlanFileSource.Produce generating synthetic RequestItems with new UUIDs as CustomID when the context was cancelled, breaking the OpenAI batch contract that every input request must appear in the output or error file under its original custom_id.

What does this PR do?

  1. source_planfile.go: Remove the ctx.Err() fast-path that skipped I/O
    and fabricated a new UUID. Produce now always reads the input line so each
    item retains its original custom_id. Context cancellation is still handled
    downstream by the dispatcher drain path.

  2. source_planfile_test.go: Update the cancellation unit test to assert that
    every produced item carries the original custom_id from the input file
    (not a synthetic UUID equal to RequestID).

  3. dev-deploy-dispatcher.sh: Work around a Kind/Colima issue where
    kind load docker-image fails on Apple Silicon with multi-platform OCI
    images (content digest ... not found). Uses docker save | ctr import
    without --all-platforms, and skips loading if the image already exists in
    the node.

How was this tested?

  • Unit tests added/updated/verified (make test passes)
  • Integration/e2e tests added/updated/verified
  • Full E2E suite passes locally with dispatcher enabled (ENABLE_DISPATCHER=true make test-e2e): 53 PASS including Cancel/InProgress, Cancel/IdempotentRetry, Expiration, and all TestDispatcher subtests

Checklist

  • Commits are signed off (git commit -s) per DCO
  • Code follows project contributing guidelines
  • Pre-commit checks pass (make pre-commit)
  • Unit tests pass (make test)
  • E2E tests pass (make test-e2e)

Related Issues

Fixes #598
Fixes #596
Fixes #599

PlanFileSource.Produce previously created synthetic RequestItems with
new UUIDs as CustomID when ctx was cancelled, losing the original
custom_id from the input file.  This broke the OpenAI batch contract:
clients could not match error-file rows back to their input requests.

Always read the input line regardless of context state so each item
retains its original custom_id for the dispatcher drain path.

Fixes #598

Signed-off-by: Jooyeon Mok <jmok@redhat.com>
kind load docker-image passes --all-platforms to ctr import, which
fails on Apple Silicon when the OCI index references amd64 manifests
not present locally.  Use docker save | ctr import (without
--all-platforms) as a fallback, and skip loading entirely when the
image already exists in the Kind node.

Signed-off-by: Jooyeon Mok <jmok@redhat.com>
@github-actions github-actions Bot added the bug Fixes incorrect behavior label Jul 17, 2026
@lioraron
lioraron merged commit cf9b438 into main Jul 17, 2026
6 checks passed
@lioraron
lioraron deleted the fix-598-cancel-custom-id branch July 17, 2026 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Fixes incorrect behavior

Projects

None yet

2 participants