ktx/packages/cli/test
Andrey Avtomonov c3d8cedb0b
feat(cli): add ingest LLM rate-limit governor with paced retries (#261)
* feat(cli): add ingest rate limit governor

* feat(cli): wire ingest rate-limit config

* feat(cli): report provider rate-limit signals

* feat(cli): show ingest rate-limit waits

* fix(cli): complete rate-limit event coverage

* fix(cli): abort ingest provider calls cleanly

* fix(cli): propagate ingest cancellation

* fix(cli): reject pre-aborted ingest rate-limit waits

* fix(cli): honor Claude rate-limit reset waits

* fix(cli): retry thrown Codex rate-limit failures

* fix(cli): type Claude rate-limit result details

* fix(cli): emit ingest rate-limit countdowns from rejected signals

* fix(cli): report ai sdk rate-limit header utilization

* fix(cli): gate LLM rate-limit retries on the governor budget

The AI SDK and Codex runtimes retried 429 / opaque rate-limit failures up
to 6-7 times with no backoff when constructed without a RateLimitGovernor
(scan, memory, setup) or with pacing disabled, ignoring Retry-After and
worsening the limit. The outer retry loop only cooperates with the
governor's pause, so without active pacing there is no backoff to apply.

Route the retry bound through a single source: RateLimitGovernor
.maxRetryAttempts(), which returns retry.maxAttempts when enabled and 1
(no outer retry) when absent or disabled. All three runtimes (ai-sdk,
codex, claude-code) now use it, so ingest.rateLimit.retry.maxAttempts
genuinely controls attempts and the hard-coded 6 (plus Codex's off-by-one
extra attempt) is gone. Backend-native retry (e.g. the AI SDK's maxRetries)
still handles transient 429s.

Also correct the ktx.yaml docs for maxWaitMs (caps each wait, not the whole
run) and maxAttempts, and sync uv.lock ktx-sl/ktx-daemon to 0.9.0.
2026-06-05 12:10:27 +02:00
..
commands feat(cli): shell completion for commands, flags, and entity names (#244) 2026-05-31 23:44:33 +02:00
completion feat(cli): shell completion for commands, flags, and entity names (#244) 2026-05-31 23:44:33 +02:00
connectors test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
context feat(cli): add ingest LLM rate-limit governor with paced retries (#261) 2026-06-05 12:10:27 +02:00
fixtures test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
io test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
llm feat: add codex llm backend for ktx runtime work (#253) 2026-06-02 13:57:11 +02:00
telemetry feat(cli): add ingest LLM rate-limit governor with paced retries (#261) 2026-06-05 12:10:27 +02:00
admin-reindex.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
admin.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
cli-program-telemetry.test.ts feat(cli): shell completion for commands, flags, and entity names (#244) 2026-05-31 23:44:33 +02:00
cli-program.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
command-tree.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
connection-recovery.test.ts feat(cli): consistent connection setup recovery and build-time gate (#257) 2026-06-03 11:08:46 +00:00
connection.test.ts fix(telemetry): preserve driver error class and code in connection_test (#260) 2026-06-04 14:51:14 +02:00
context-build-view.test.ts Emit ingest_completed once per target on every ingest path 2026-06-02 20:03:27 +02:00
database-tree-picker.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
demo-assets.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
demo-metrics.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
doctor.test.ts feat: add codex llm backend for ktx runtime work (#253) 2026-06-02 13:57:11 +02:00
embedding-resolution.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
example-smoke.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
index.test.ts feat(cli): shell completion for commands, flags, and entity names (#244) 2026-05-31 23:44:33 +02:00
ingest-query-executor.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
ingest-report-file.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
ingest-viz.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
ingest.test-utils.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
ingest.test.ts feat: add codex llm backend for ktx runtime work (#253) 2026-06-02 13:57:11 +02:00
knowledge.test.ts feat(cli): shell completion for commands, flags, and entity names (#244) 2026-05-31 23:44:33 +02:00
local-adapters.test.ts feat(query-history): scope mining to modeled schemas by default (#258) 2026-06-03 17:19:42 +02:00
local-scan-connectors.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
managed-local-embeddings.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
managed-mcp-daemon.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
managed-python-command.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
managed-python-daemon.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
managed-python-http.test.ts feat(query-history): scope mining to modeled schemas by default (#258) 2026-06-03 17:19:42 +02:00
managed-python-runtime.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
mcp-http-server.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
mcp-server-factory.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
memory-flow-interactive.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
memory-flow-tui.test.tsx test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
next-steps.test.ts feat(cli): guide next action at end of ktx setup, not reruns (#256) 2026-06-03 01:00:21 +02:00
notion-page-picker.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
print-command-tree.test.ts feat(cli): shell completion for commands, flags, and entity names (#244) 2026-05-31 23:44:33 +02:00
progress-port-adapter.test.ts feat(cli): stream plain ktx ingest progress to stderr (KLO-726) (#251) 2026-06-01 23:31:31 +02:00
project-dir.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
project-resolver.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
prompt-navigation.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
proxy-env.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
public-ingest-copy.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
public-ingest.test.ts feat(query-history): scope mining to modeled schemas by default (#258) 2026-06-03 17:19:42 +02:00
reveal-password-prompt.test.ts feat(setup): wizard prompt tweaks and quieter query-history filter output (#259) 2026-06-04 14:11:08 +02:00
runtime-requirements.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
runtime.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
scan.test.ts feat(telemetry): include error details for failures (#254) 2026-06-02 17:23:51 +02:00
setup-agents.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
setup-context.test.ts feat(cli): consistent connection setup recovery and build-time gate (#257) 2026-06-03 11:08:46 +00:00
setup-databases.test.ts feat(setup): wizard prompt tweaks and quieter query-history filter output (#259) 2026-06-04 14:11:08 +02:00
setup-demo-tour.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
setup-embeddings.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
setup-interrupt.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
setup-models.test.ts feat: add codex llm backend for ktx runtime work (#253) 2026-06-02 13:57:11 +02:00
setup-project.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
setup-prompts.test.ts feat(setup): wizard prompt tweaks and quieter query-history filter output (#259) 2026-06-04 14:11:08 +02:00
setup-ready-menu.test.ts feat(cli): guide next action at end of ktx setup, not reruns (#256) 2026-06-03 01:00:21 +02:00
setup-runtime.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
setup-secrets.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
setup-sources-notion.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
setup-sources.test.ts feat(setup): wizard prompt tweaks and quieter query-history filter output (#259) 2026-06-04 14:11:08 +02:00
setup.test.ts feat(query-history): scope mining to modeled schemas by default (#258) 2026-06-03 17:19:42 +02:00
sl.test.ts feat(cli): shell completion for commands, flags, and entity names (#244) 2026-05-31 23:44:33 +02:00
source-mapping.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
sql.test.ts feat(query-history): scope mining to modeled schemas by default (#258) 2026-06-03 17:19:42 +02:00
standalone-smoke.test.ts feat(cli)!: remove fast mode; ktx ingest always builds enriched context (KLO-721) (#237) 2026-05-29 17:41:04 +02:00
status-project.test.ts feat: add codex llm backend for ktx runtime work (#253) 2026-06-02 13:57:11 +02:00
text-ingest.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
tree-picker-state.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
tree-picker-tui.test.tsx test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
viz-fallback.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00