fix(embeddings): restore provider-backed batches on current main - #970
Conversation
Signed-off-by: Seongho Bae <me@seonghobae.me>
Signed-off-by: Seongho Bae <me@seonghobae.me>
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughProvider 임베딩 배치가 durable claim fencing, 예약·시작 분리, 취소, deadline, owner 검증 및 provider usage를 지원합니다. 휴리스틱 토큰 추정은 제거되고 Rust 기반 권위적 카운터와 fail-closed 예산 처리가 추가되었습니다. Structured synthesis, 모델 검색, HTTP 계약 및 Docker 빌드도 갱신되었습니다. Changes임베딩 배치 및 토큰 회계
Structured 요청 및 HTTP 계약
Estimated code review effort: 5 (Critical) | ~120 minutes Merge Risk: 🟡 Moderate · up to The PR restores durable provider-backed embedding batches and native token packing, but jobs can remain non-terminal after claim failure, and configured durable deployments can silently lose cross-process recovery when the required client is unavailable. These bounded availability and deployment risks should be fixed or explicitly accepted before merge. Sequence Diagram(s)sequenceDiagram
participant Client
participant CostRoutingCoordinator
participant ProviderEmbeddingBatchBackend
participant JobRegistryFactory
participant EmbeddingProvider
Client->>CostRoutingCoordinator: 임베딩 배치 예약 및 시작
CostRoutingCoordinator->>ProviderEmbeddingBatchBackend: reserve 및 start
ProviderEmbeddingBatchBackend->>JobRegistryFactory: 실행 claim 획득
ProviderEmbeddingBatchBackend->>EmbeddingProvider: embed_with_usage 호출
EmbeddingProvider-->>ProviderEmbeddingBatchBackend: 벡터와 provider usage 반환
ProviderEmbeddingBatchBackend->>JobRegistryFactory: claim 검증 및 terminal 상태 게시
Client->>CostRoutingCoordinator: 결과 및 usage 조회
CostRoutingCoordinator-->>Client: 완료, 실패 또는 취소 문서 반환
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 40.42% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 381 functions across 66 files. (8 skipped: 7 unsupported, 1 too large.) ✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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 |
Signed-off-by: Seongho Bae <me@seonghobae.me>
Signed-off-by: Seongho Bae <me@seonghobae.me>
Signed-off-by: Seongho Bae <me@seonghobae.me>
Signed-off-by: Seongho Bae <me@seonghobae.me>
Signed-off-by: Seongho Bae <me@seonghobae.me>
Signed-off-by: Seongho Bae <me@seonghobae.me>
Signed-off-by: Seongho Bae <me@seonghobae.me>
Signed-off-by: Seongho Bae <me@seonghobae.me>
Signed-off-by: Seongho Bae <me@seonghobae.me>
Signed-off-by: Seongho Bae <me@seonghobae.me>
Signed-off-by: Seongho Bae <me@seonghobae.me>
…ain' into fix/pr970-review-20260831 # Conflicts: # contextual_orchestrator/batch_routing.py # contextual_orchestrator/cost_router.py
Signed-off-by: Seongho Bae <me@seonghobae.me>
Signed-off-by: Seongho Bae <me@seonghobae.me>
Signed-off-by: Seongho Bae <me@seonghobae.me>
Signed-off-by: Seongho Bae <me@seonghobae.me>
…-constraint-current-pr970 fix(routing): restore request endpoint constraints
…-actionable-telemetry fix(telemetry): retain actionable provider failure evidence
commented
Sep 1, 2026
|
Security follow-up after stacked PR #989 merged: exact-head 073b87b restores the shared fail-closed provider-message boundary. Only the exact JSON-object schema diagnostic is canonicalized; other provider prose containing messages/content is suppressed before caller or telemetry exposure. Regression covers natural-language request echo. Focused provider taxonomy/telemetry/reliability suite: 88 passed; Ruff and diff checks passed. |
Signed-off-by: Seongho Bae <me@seonghobae.me> (cherry picked from commit 97f722d) Signed-off-by: Seongho Bae <me@seonghobae.me>
Signed-off-by: Seongho Bae <me@seonghobae.me> (cherry picked from commit 6905473) Signed-off-by: Seongho Bae <me@seonghobae.me>
(cherry picked from commit f6b4591) Signed-off-by: Seongho Bae <me@seonghobae.me>
commented
Sep 1, 2026
|
Combined-stack exact-head verification at |
commented
Sep 1, 2026
|
Resolved the current-head unavailable-aggregate finding in 858a13e. |
commented
Sep 1, 2026
|
Current exact-head verification at |
commented
Sep 1, 2026
|
Exact current head |
…r988 fix(workflow): integrate single-copy prompts with endpoint routing
commented
Sep 1, 2026
|
Exact current head |
commented
Sep 1, 2026
|
Current-head upstream RCA (
Expected safe operator signal for this incident is equivalent to: |
| total_cost_amount += float(record.cost_amount) | ||
| currency_code = record.currency_code | ||
| aggregate_usage_recorded = True |
There was a problem hiding this comment.
🟡 Unpriced embeddings appear free
When provider usage is aggregate-only, price_known remains true for an unpriced model. The completed batch reports zero cost instead of unknown cost.
| total_cost_amount += float(record.cost_amount) | |
| currency_code = record.currency_code | |
| aggregate_usage_recorded = True | |
| total_cost_amount += float(record.cost_amount) | |
| price_known = price_known and record.price_known | |
| currency_code = record.currency_code | |
| aggregate_usage_recorded = True |
Was this helpful? React with 👍 or 👎 to provide feedback.
| | [0003](0003-cost-aware-sync-batch-routing.md) | Cost-aware sync-versus-batch routing | Accepted | Chen et al. (2023) FrugalGPT arXiv:2305.05176; Ong et al. (2024) RouteLLM arXiv:2406.18665; Ding et al. (2024) Hybrid LLM arXiv:2404.14618 | | ||
| | [0004](0004-msa-leaf-composition.md) | MSA leaf — standalone and callable | Accepted | NIST SP 800-204 independent deployability; planning ADR 0001 fail-closed judge composition | | ||
| | [0005](0005-verbose-debug-logging.md) | Verbose/debug logging with a redaction safety net | Accepted | OWASP Logging Cheat Sheet; NIST SP 800-92 log management; Python `logging` HOWTO | | ||
| | [0005](0005-provider-embedding-lease-and-token-accounting.md) | Provider-embedding lease and token-accounting boundary | Accepted | Redis distributed-lock ownership/fencing guidance; PyO3 modules; OpenAI public cl100k mappings | |
| with self._local_locks_guard: | ||
| lock = self._local_locks.get(lock_name) | ||
| if lock is None: | ||
| lock = threading.Lock() | ||
| self._local_locks[lock_name] = lock | ||
|
|
||
| @contextmanager | ||
| def acquired_local_claim(): | ||
| with lock: | ||
| yield _ClaimLease() | ||
|
|
||
| return acquired_local_claim() |
Summary
Replaces the integration path attempted in #857 after #969. #857 remains open pending acceptance of this replacement.
Verification
All evidence uses synthetic inputs only.
Summary by CodeRabbit
새로운 기능
개선 사항
unavailable로 표시하며, 관련 예산은 안전하게 차단합니다.