← Back to Pull requests

fix(inkless:switch): send each partition alone when a batched control-plane init fails [KC-839] #883

Closed
unknown closed this pull request without merging on Nov 19, 2026 11:04 UTC
View on GitHub
unknown unknown commented on Nov 19, 2026 10:46 UTC
Author

AwaitingMetadata.sendBatch sends every queued partition to the control plane in one initDisklessLog call. The Postgres control plane applies the call in one transaction, so a partition whose content it rejects fails the call for the whole batch. The broker then retried every partition of the batch together, and the queue added each partition that reached AwaitingMetadata later to the same failing batch. No control-plane row appeared for those partitions, and produce to them failed until leadership moved.

InitDisklessLogJob now throws ControlPlaneRequestRejectedException when PostgreSQL rejects the content of the request. A rejection is an error with SQLState class 22 or 23, such as the timestamp_t domain check, or with P0001, which the init function raises. If the control plane rejects a batch of several requests, the broker sends each request alone. The other partitions of the batch then complete. A partition that the control plane still rejects stays in AwaitingMetadata and retries with the usual backoff. Each failed attempt logs an error with the exception, and the AwaitingMetadataPartitions, OldestAwaitingMetadataAgeMs, and InitRetriedPerSec metrics show the partition.

A lost connection or a pool timeout doesn't depend on the requests. After such a failure, the broker retries the whole batch with the queue backoff and doesn't send the partitions alone. If such a failure happens during the per-partition pass, the pass stops, and the remaining partitions retry without a call of their own.

Testing

InitDisklessLogManagerTest uses a control plane that rejects every call that contains partition 0. The other partition of the first batch completes after the per-partition resend, and so does a partition that arrives while partition 0 retries. Partition 0 stays tracked in AwaitingMetadata, and the gauge and the retry meter count it. Without the fix, the broker resends the whole batch and the test fails.
Other InitDisklessLogManagerTest cases check that a failing call with one request makes one call, that a failure that isn't a rejection retries the batch without per-partition calls, and that a failure during the per-partition pass stops it.
JobUtilsTest checks which SQLStates count as a rejection, including a Hikari pool timeout.
PostgresControlPlaneTest checks that a producer state timestamp of -6 fails the call with ControlPlaneRequestRejectedException.

Fixes KC-839.

🤖 Generated with Claude Code

Diff: 315 lines (+236 / -79) across 3 files Reviewer: giuseppelillo Review duration: 18m
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 315 lines diff across 3 files
0.40
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.344
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #883"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 40.4% (MEDIUM) · Higher = larger blast radius
40.4%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 60.5% · Lower = rushed or shallow review
60.5%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 15.9% · Safe to merge
15.9%
Repository