vxpu/router: expire idle instances and stop reconcile loop cleanly #866
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.40) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 311 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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 #866"
general
weight: 0.35
codebot-robot
Handle keep-alive expiry and clean shutdown for instances owned by
ModelReconciler, deferred from #842.
Keep-alive expiry on resync (no per-instance timers):
reaches Passed, not while it is NotLoaded (waiting in the queue or
waiting for pod scheduling), Loading, or Checking. A resync reload of
the same generation after executor eviction does not reset the clock.
sync.Map) so Touch on the serving request hot path (executorEndpoint,
GetVocab cache hits, proxyChat completion, streamed proxyGenerate
chunks, and matching SetDesired calls) performs one lock-free lookup
and one atomic store without acquiring r.mu or contending with
readers or the reconcile loop.
the keep-alive duration (defaulting to VXPU_EXECUTOR_KEEP_ALIVE /
3600s, configurable via WithKeepAlive).
for teardown so the reconcile loop closes pooled connections and
deletes its executor pod once and leaves it down through later
resyncs.
Clean shutdown and restart pod adoption:
watcher, and async manifest rewrites) with a WaitGroup so Stop
cancels in-flight work, wakes blocked Wait callers with Unavailable,
shuts down the work queue, and waits for all goroutines to exit
before returning.
loop so shutdown returns promptly even while a pod is Pending.
design, logging that they were left running for adoption after a
restart. Document this behavior and what a restarted router does
with pre-existing pods (adopts matching pods on LoadModel, replaces
mismatched image/placement pods, and leaves unrequested pods
untouched) in vxpu/docs/design.md.
Tests under -race verify idle expiry deletes the pod once and stays
down across resyncs, serving requests extend the keep-alive window,
slow pod scheduling longer than keep-alive does not expire an instance
before it passes, shutdown returns promptly with no reconciler or
workqueue goroutines left running, and a restarted router adopts
matching pods and replaces mismatched ones.
Fixes #864