fix: make every LLM operation cancellable - #1764
Conversation
|
Important Review skippedToo many files! This PR contains 110 files, which is 10 over the limit of 100. To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch. Upgrade to a paid plan to raise the limit. This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry. ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (110)
You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
📊 Benchmark Results✅ All benchmarks passed
Updated: 2026-08-05T17:16:23.282Z · Commit: 3c24f59 |
|
CI evidence note:
PR #1764 changes only the LLM cancellation surface and generated contract/docs outputs; it does not change the generated-app smoke runner, verification manifest, create-croco-app, tenant-core, or CI workflow. Branch protection requires |
ebfe595 to
9adc41c
Compare
Outcome
All public LLM generation, streaming, structured generation, tool, and embedding operations now accept a shared optional
AbortSignaland forward it throughLlmService, model implementations, and the OpenAI transport.Pre-abort and mid-flight cancellation produce stable Croco Problems. Cancelled work emits no completion or usage-success event, including the race after an OpenAI stream yields its final usage chunk. The
@Llmdecorator forwards per-call cancellation through its optional second argument.Fixes #1711
Reviewer context
Completion-event publication is the terminal success commit point: cancellation is checked synchronously immediately before publication, and a later abort cannot retract an event already being delivered.
The API documentation generator found existing tracked drift in other public surfaces. Those deterministic generated files are included because
docs:api:checkcompares the complete generated tree and passes only with the full synchronized output.Verification
pnpm --filter @croco/llm-core test— 151 passedpnpm --filter @croco/llm-openai test— 36 passed, 1 live test skippedpnpm public-api:check— 115 package snapshots matchpnpm problem-registry:check— 577/577 codes matchpnpm docs:api:check— generated API docs matchpnpm changeset-required:check -- --base origin/trunk --head HEAD— passedpnpm check— passed (24/25; one not applicable)Review gates
@croco/llm-core,@croco/llm-openai, and@croco/problems-coreare synchronized. Dependencies and lockfile are unchanged.Residual risk
Outbound cancellation remains transport-dependent by contract; the OpenAI transport forwards the caller signal directly. No model retry or billing policy changed.