Skip to content

feat(cli): show "waking up worker" hint on KEDA cold starts#167

Merged
eddietejeda merged 1 commit into
mainfrom
feat/runtime-wakeup-hint
Jun 19, 2026
Merged

feat(cli): show "waking up worker" hint on KEDA cold starts#167
eddietejeda merged 1 commit into
mainfrom
feat/runtime-wakeup-hint

Conversation

@eddietejeda

Copy link
Copy Markdown
Contributor

What

When a command hits a KEDA scale-to-zero runtimedb worker that's asleep, the request hangs while the worker cold-starts and the user gets no feedback. This adds a spinner that, on a confirmed cold start, explains the wait: "waking up worker after inactivity...".

Pairs with the control-plane endpoint on monopoly (feat/runtime-status-endpoint), which this probes.

How

New block_with_wakeup(api, msg, fut) in sdk.rs:

  • Shows a spinner with the command's message.
  • Races the request against a ~1.5s timer via tokio::select!. If the request is still pending past the threshold, it probes the control plane's GET /v1/workspaces/<id>/runtime/status and, when the worker is asleep/waking, upgrades the spinner message.
  • Warm requests pay nothing: the probe only fires after the delay and is dropped the instant the real response lands.
  • The probe omits X-Workspace-Id so it reaches the always-warm control plane, not the KEDA interceptor (which would wake the worker). Best-effort: any failure -> Unknown -> no message change.

Scope

Wired into top-level worker-bound commands: list/get/create/update/delete/refresh across databases, connections, datasets, tables, context, embedding providers, queries, jobs, indexes, plus query execute. Existing spinners were converted (not doubled). Polling loops, pagination, rayon scans, and internal helpers stay on plain block().

Testing

  • Unit tests for RuntimeState parsing and the probe (asleep/non-2xx/unscoped), incl. asserting the probe sends no X-Workspace-Id.
  • Full suite green (203 unit + integration); cargo fmt clean; no new clippy warnings.

Wrap worker-bound commands in block_with_wakeup: show a spinner and, if the
request hasn't returned within ~1.5s, probe the control plane's
/v1/workspaces/<id>/runtime/status and upgrade the message when the worker is
cold. Warm requests pay nothing — the probe only fires after the delay and is
dropped the instant the real response lands. The probe omits X-Workspace-Id so
it reaches the always-warm control plane, not the KEDA interceptor.

Wired into list/get/create/update/delete/refresh across databases, connections,
datasets, tables, context, embedding providers, queries, jobs, indexes, and
query execute. Polling loops, pagination, rayon scans, and internal helpers
stay on plain block().
@codecov

codecov Bot commented Jun 19, 2026

Copy link
Copy Markdown

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed: clean implementation. The cold-start probe degrades to Unknown on all failure paths and never affects control flow, the X-Workspace-Id omission is correct and tested, the select loop cancels the probe the moment the real request lands, and the stderr/TTY-gated spinner keeps scripting output clean. Good test coverage.

@eddietejeda eddietejeda merged commit 17e9e27 into main Jun 19, 2026
14 checks passed
@eddietejeda eddietejeda deleted the feat/runtime-wakeup-hint branch June 19, 2026 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant