cdx-manager 0.24.7 → 0.24.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -1
- package/VERSION +1 -1
- package/changelogs/CHANGELOGS_0_24_7.md +7 -0
- package/changelogs/CHANGELOGS_0_24_8.md +24 -0
- package/changelogs/CHANGELOGS_0_24_9.md +18 -0
- package/checksums/release-archives.json +22 -0
- package/docs/cli.md +8 -1
- package/package.json +1 -1
- package/pyproject.toml +1 -1
- package/src/cli.py +1 -1
- package/src/cli_args.py +12 -2
- package/src/commands/launch.py +4 -4
- package/src/commands/runs.py +208 -21
- package/src/commands/status.py +48 -7
- package/src/interactive_usage.py +17 -6
- package/src/provider_background.py +8 -1
- package/src/provider_runtime.py +3 -1
- package/src/run_command.py +15 -2
- package/src/run_failover.py +32 -2
- package/src/run_registry.py +24 -2
- package/src/run_usage.py +89 -24
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
<br clear="left"/>
|
|
6
6
|
|
|
7
|
-
[](LICENSE) ](LICENSE)  
|
|
8
8
|
|
|
9
9
|
**The right AI coding account, when you need it.** CDX Manager keeps your Codex and Claude accounts in separate profiles, shows which ones have quota, and helps you pick the next usable session from your terminal.
|
|
10
10
|
|
|
@@ -42,6 +42,31 @@ cdx work
|
|
|
42
42
|
|
|
43
43
|
CDX checks authentication before interactive launches. Handoff keeps the source transcript in place and asks the receiving agent to verify the conversation and workspace before acting. No account switch or prompt submission happens just because you run `cdx next`.
|
|
44
44
|
|
|
45
|
+
## Cache efficiency and fix rounds
|
|
46
|
+
|
|
47
|
+
`cdx history --json` records uncached input, cache reads, cache writes, output tokens, and `usage.cache_hit_ratio` beside the existing token totals. The ratio is cache reads divided by all input tokens, excluding output. Missing provider splits stay `null`, and text views show `cache n/d` instead of claiming a zero hit rate.
|
|
48
|
+
|
|
49
|
+
`cdx stats --json` adds `cache_usage` sums and an input-weighted `cache_hit_ratio` to each session, project (`--by project`), model (`--by model`), and total. `cache_usage` preserves unknown sums as `null`; existing numeric aggregate fields keep their previous behavior. Ratios include only runs with measured input and cache reads. Coverage is explicit in `measured_runs` and `measured_input_tokens`. `run_types.cold` and `run_types.continued` expose counts, sums, and ratios for comparison. Text views show values such as `cache 72 %` next to tokens.
|
|
50
|
+
|
|
51
|
+
Reuse a completed run's provider conversation for another fix round:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
cdx run work --cwd /path/to/repo --prompt "Implement the change" --reasoning-effort high --json
|
|
55
|
+
cdx run --continue-run RUN_ID --cwd /path/to/repo --prompt "Fix the remaining test failure" --json
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
`--continue-run` resumes the exact Claude session or Codex thread and pins the previous run's recorded model and effort, even if the profile settings changed. The profile is inferred from the parent; an explicit session or provider must match. An explicit model or effort must also match. Runs and history record `parent_run_id` and `conversation_id`. Detached continuations use the cdx child supervisor with the same pins. Codex continuation usage is measured between exact transcript snapshots before and after the run, since exec resume can report conversation totals. If either boundary is unavailable, per-run usage stays unknown with `usage_attribution: "continuation_usage_unavailable"` in history instead of counting earlier turns again.
|
|
59
|
+
|
|
60
|
+
Conservative assumption: a continuation requires a finished Claude or Codex run, a locally available provider transcript, and recorded model and effort settings. Missing runs, profiles, expired sessions, and unavailable settings produce a clear error; the caller can retry without `--continue-run` for a cold run. `--failover` and `--isolate-workspace` cannot be combined with continuation. Capacity recovery and provider model fallback are disabled for continuations so they cannot silently switch model or account. Provider cache retention remains provider-controlled, so resuming does not guarantee a cache hit.
|
|
61
|
+
|
|
62
|
+
## Codex model capacity recovery
|
|
63
|
+
|
|
64
|
+
`cdx run` (including `--detach`) automatically recovers from Codex's "Selected model is at capacity" failure. It retries the same prompt, profile, and model after 1 and 2 seconds, then tries the profile's `fallback_model` list in configured order, removing duplicates. Configure alternatives with `cdx set work --fallback-model MODEL_A,MODEL_B`.
|
|
65
|
+
|
|
66
|
+
After exhausting those models, CDX selects another ready Codex profile using the normal ranking, including profile priority. Disabled, logged-out, `never`, and `ask-first` profiles are excluded from automatic selection. To choose an `ask-first` profile explicitly, name it in a new command (`cdx run NAME ...`). Each successor uses `--model` if supplied, otherwise its own configured/default model, followed by its own fallback list. Each model gets at most three attempts; at most four profile switches are allowed. Settings are not changed. Each attempt retains the command's timeout; the backoff adds at most three seconds per model.
|
|
67
|
+
|
|
68
|
+
Recovery does not require `--failover`, which still controls account quota exhaustion separately. Other provider failures and timeouts do not trigger capacity recovery. Attempts restart the prompt in the same workspace; files from earlier attempts remain there. Each retry, model fallback, profile fallback, and exhausted budget is logged to stderr and persisted in `recovery_events` in the run registry and final JSON (`cdx run-status` / `cdx run-report`). Events include archived attempt output paths. Recovery keeps one run ID and reports the final effective model. If no eligible alternative remains or the profile switch budget is reached, the run fails with `capacity_recovery_exhausted`.
|
|
69
|
+
|
|
45
70
|
## Documentation
|
|
46
71
|
|
|
47
72
|
- [Installation and first steps](docs/getting-started.md) — prerequisites, npm/pipx/uv, Windows, configuration.
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.24.
|
|
1
|
+
0.24.9
|
|
@@ -9,6 +9,13 @@ This patch fixes command execution in isolated Codex workspace runs. (#65)
|
|
|
9
9
|
- Drop Codex's nested sandbox when `--isolate-workspace` is enabled, avoiding the user namespace mapping failure that prevented commands from running. The outer workspace sandbox remains the isolation boundary. (#65)
|
|
10
10
|
- Remove Codex's sandbox mode and network overrides inside the isolated workspace and pass `--dangerously-bypass-approvals-and-sandbox`; the outer sandbox controls network access and keeps review runs read-only through its workspace mount. (#65)
|
|
11
11
|
|
|
12
|
+
## Codex capacity recovery
|
|
13
|
+
|
|
14
|
+
- Retry headless Codex model capacity failures after 1 and 2 seconds before trying configured fallback models, then ready Codex profiles in the existing priority-aware order. This also applies to detached runs and does not require `--failover`.
|
|
15
|
+
- Exclude disabled, logged-out, `never`, and `ask-first` profiles from automatic fallback. Bound recovery to three attempts per model and four profile switches, with a distinct `capacity_recovery_exhausted` outcome.
|
|
16
|
+
- Log each recovery action to stderr and structured run data, preserve failed attempt output, and report the effective model without changing profile settings.
|
|
17
|
+
- Cover capacity detection, retry and profile budgets, fallback order, selection policies, and backoff cancellation with tests.
|
|
18
|
+
|
|
12
19
|
## Maintenance
|
|
13
20
|
|
|
14
21
|
- Record tray companion checksums for v0.24.6. (`87aba5d2cffdfb1a96e386abcdabe54df9ee4808`)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# CDX Manager 0.24.8
|
|
2
|
+
|
|
3
|
+
Release date: 2026-10-30
|
|
4
|
+
|
|
5
|
+
This patch improves recovery from Codex model capacity failures. (#67)
|
|
6
|
+
|
|
7
|
+
## Codex capacity recovery
|
|
8
|
+
|
|
9
|
+
- Retry headless Codex capacity failures after 1 and 2 seconds before trying configured fallback models, then ready Codex profiles in priority-aware order. Recovery also applies to detached runs and does not require `--failover`. (#67)
|
|
10
|
+
- Exclude disabled, logged-out, `never`, and `ask-first` profiles from automatic fallback. Limit recovery to three attempts per model and four profile switches, reporting `capacity_recovery_exhausted` when no eligible alternative remains or the budget is exhausted. (#67)
|
|
11
|
+
- Log recovery actions to stderr and structured run data, preserve failed attempt output, and report the effective model without changing profile settings. (#67)
|
|
12
|
+
|
|
13
|
+
## Token efficiency
|
|
14
|
+
|
|
15
|
+
- Record per-run cache hit ratios beside the existing cache read, cache write, uncached input, output, and total token fields. Preserve missing provider splits as `null` in headless, interactive, and background usage readers.
|
|
16
|
+
- Add nullable `cache_usage` sums, input-weighted ratios, measurement coverage, and cold versus continued comparisons to stats by session, project, and model. Display `cache 72 %` or `cache n/d` beside tokens without changing existing JSON fields.
|
|
17
|
+
- Add `cdx run --continue-run RUN_ID` for native Claude and Codex conversation resume with pinned model and reasoning effort, including detached runs. Persist parent links and exact conversation identities. Refuse missing, mismatched, expired, or unpinnable parents; prevent model/account fallback during a continuation.
|
|
18
|
+
- Measure Codex continuation usage from exact transcript boundaries so cumulative conversation totals are not billed again. Parse cache write counts when Codex reports them.
|
|
19
|
+
- Add provider parsing, JSON compatibility, aggregation, continuation validation, settings pinning, refusal, and parent-link regression tests.
|
|
20
|
+
|
|
21
|
+
## Maintenance
|
|
22
|
+
|
|
23
|
+
- Record tray companion checksums for v0.24.7. (`16938c0d22de4589f5b4757fd7ff55e848127e7d`)
|
|
24
|
+
- Record release archive checksums for v0.24.7. (`a169c3eee41fcbc97477ca4d74bfc8f77c1330d5`)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# CDX Manager 0.24.9
|
|
2
|
+
|
|
3
|
+
Release date: 2026-10-30
|
|
4
|
+
|
|
5
|
+
This patch tracks cache efficiency and resumes runs with pinned settings. (#69)
|
|
6
|
+
|
|
7
|
+
## Cache efficiency and run continuation
|
|
8
|
+
|
|
9
|
+
- Record per-run cache hit ratios alongside cache read, cache write, uncached input, output, and total token counts. Preserve unknown provider splits as `null`. (#69)
|
|
10
|
+
- Add nullable `cache_usage` summaries, input-weighted cache hit ratios, measurement coverage, and cold versus continued run comparisons to stats by session, project, and model. Show cache efficiency beside token counts in history and stats. (#69)
|
|
11
|
+
- Add `cdx run --continue-run RUN_ID` to resume the exact Claude or Codex conversation from a finished run with its recorded profile, model, and reasoning effort, including detached runs. Preserve parent run links and provider conversation identities. (#69)
|
|
12
|
+
- Refuse unavailable parents, missing transcripts, mismatched profiles, and incompatible settings. Keep continuation settings pinned by disabling automatic capacity recovery and model fallback, and rejecting `--failover` and `--isolate-workspace`. (#69)
|
|
13
|
+
- Attribute Codex continuation usage to exact transcript boundaries so earlier turns are not counted again. Leave per-run usage unknown when those boundaries are unavailable, and parse cache write counts when reported. (#69)
|
|
14
|
+
|
|
15
|
+
## Maintenance
|
|
16
|
+
|
|
17
|
+
- Record tray companion checksums for v0.24.8. (`2f1bb93db481ff6f06d8c61435a228ae9de9c4be`)
|
|
18
|
+
- Record release archive checksums for v0.24.8. (`7ff1b1cc0b11016adc5c1a30135f1553af3a53d7`)
|
|
@@ -650,6 +650,28 @@
|
|
|
650
650
|
"x86_64-pc-windows-msvc": "0d125d8e0f7d9880a2ed9e0a794964f3d69ef3353b90a1d594b17f9392a0a0af",
|
|
651
651
|
"x86_64-unknown-linux-musl": "d6c369ace10a6d373366cd12e4e6cd7f2fd278fbce2fd9a13c5bf51047847441"
|
|
652
652
|
}
|
|
653
|
+
},
|
|
654
|
+
"v0.24.7": {
|
|
655
|
+
"github_tarball_sha256": "170df61319347dc133442c6750c31812a55a3e8a002fae60bd4822771839750f",
|
|
656
|
+
"github_zip_sha256": "fa3eda26dbfec1af36e25f72a0fcf01a18fa064dc442ffc39b64c7bb2ab7e1ae",
|
|
657
|
+
"tray_assets": {
|
|
658
|
+
"aarch64-apple-darwin": "f775ae9e140f1147368c4658a27e6f0751585a5b001b633fcfccfe252b85721e",
|
|
659
|
+
"aarch64-unknown-linux-musl": "528d61bb9dc5c395f74aad98d35f8cebea958ba2561fd15302846eb8bc036343",
|
|
660
|
+
"x86_64-apple-darwin": "e85cd5d2cb2f5dd1a2dd89ff9b532432cffd86175e709d147ff4595551d4ff50",
|
|
661
|
+
"x86_64-pc-windows-msvc": "41df35daa664802b87c052d6a9f634b240eb4e4a915868f1dd629b6734eab76a",
|
|
662
|
+
"x86_64-unknown-linux-musl": "2492e137e5c883fa16f502843a867e0325744dfc66d7d38be2c00eb362425af6"
|
|
663
|
+
}
|
|
664
|
+
},
|
|
665
|
+
"v0.24.8": {
|
|
666
|
+
"github_tarball_sha256": "4e34a7c7411cca9bfe568b07dc997c0d992d6c97806dbf091558cf2a826d6c1c",
|
|
667
|
+
"github_zip_sha256": "ec3f52aba6d645e1ab8990d763b4b761703e1e455f8bf40b58d6a47a01374d66",
|
|
668
|
+
"tray_assets": {
|
|
669
|
+
"aarch64-apple-darwin": "87a3abf4bf9f024ed1dfad74e6b2fe0734b9ae5811e4f6d93da7bdcab02fad66",
|
|
670
|
+
"aarch64-unknown-linux-musl": "32e7481d86be156e6c5e94d25473ff595e2596686c81ebdeff4cb719b993c7d2",
|
|
671
|
+
"x86_64-apple-darwin": "644a0a60b7d740c0853e426f69021cdc323b01438e0bcdf5f2792e8b9e3005c3",
|
|
672
|
+
"x86_64-pc-windows-msvc": "6df3f25ab6a9aa02a45aa6f90f95c3484553b248175394af9ecfd12668479281",
|
|
673
|
+
"x86_64-unknown-linux-musl": "ea867d352a18db59e882d6abbdbafa61b54fbec7fafa66746852696cf18cd6c5"
|
|
674
|
+
}
|
|
653
675
|
}
|
|
654
676
|
}
|
|
655
677
|
}
|
package/docs/cli.md
CHANGED
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
| `cdx agents [--max-age-hours N] [--json]` | Each session's last known agent state (working, waiting, done, failed, limit, ended), waiting first; records older than N hours (default 24) are dropped. See [Agent state](sessions-and-notifications.md#agent-state) |
|
|
57
57
|
| `cdx next [--json] [--refresh]` | Select the best next assistant using the same priority logic as `cdx status` |
|
|
58
58
|
| `cdx select --provider PROVIDER [--min-reasoning-effort minimal\|low\|medium\|high\|xhigh] [--min-power minimal\|low\|medium\|high\|xhigh] [--require-ready] [--refresh] --json` | Select a suitable session for headless automation |
|
|
59
|
-
| `cdx run [session] --cwd PATH (--prompt-file PATH\|--prompt TEXT\|--prompt-file -) [--provider PROVIDER] [--model MODEL] [--kind assistant\|code-review\|retro] [--reasoning-effort minimal\|low\|medium\|high\|xhigh] [--power minimal\|low\|medium\|high\|xhigh] [--permission MODE] [--timeout-seconds N] [--label TEXT] [--max-parallel N] [--detach] [--failover] [--refresh] --json` | Run one headless task and return a stable JSON result; `--detach` returns the `run_id` at launch without waiting, `--failover` continues the task on the next account when this one hits its rate limit (with `--detach` too: the detached cdx child applies it and the run's `occupancies` record each move), `--prompt-file -` reads the prompt from stdin, `--label` names the run in `cdx runs`, `--max-parallel N` (default `CDX_MAX_RUNS`; unset, invalid, 0 or negative means no limit) refuses to start with `too_many_runs` when N runs are already running, `--kind` (default `assistant`) labels the run record and `code-review` adds a review report to its final payload |
|
|
59
|
+
| `cdx run [session] --cwd PATH (--prompt-file PATH\|--prompt TEXT\|--prompt-file -) [--provider PROVIDER] [--model MODEL] [--kind assistant\|code-review\|retro] [--reasoning-effort minimal\|low\|medium\|high\|xhigh] [--power minimal\|low\|medium\|high\|xhigh] [--permission MODE] [--timeout-seconds N] [--label TEXT] [--max-parallel N] [--continue-run RUN_ID] [--detach] [--failover] [--refresh] --json` | Run one headless task and return a stable JSON result; `--detach` returns the `run_id` at launch without waiting, `--failover` continues the task on the next account when this one hits its rate limit (with `--detach` too: the detached cdx child applies it and the run's `occupancies` record each move), `--prompt-file -` reads the prompt from stdin, `--label` names the run in `cdx runs`, `--max-parallel N` (default `CDX_MAX_RUNS`; unset, invalid, 0 or negative means no limit) refuses to start with `too_many_runs` when N runs are already running, `--kind` (default `assistant`) labels the run record and `code-review` adds a review report to its final payload |
|
|
60
60
|
| `cdx run-report <run_id> --json` | Full report, transcript metadata, and final payload for a run; `final_message` is the run's last assistant message, read from Claude's `result` envelope or Codex's last `agent_message` (null when neither exists) |
|
|
61
61
|
| `cdx run-status <run_id> --json` | Status of one run by id |
|
|
62
62
|
| `cdx run-tail <run_id> [--lines N] --json` | Last lines of a run's own output, while it is still running or after it finished |
|
|
@@ -241,6 +241,10 @@ The result includes `launcher: "cdx"`, `run_id`, selected `session`, `provider`,
|
|
|
241
241
|
|
|
242
242
|
Known headless and completed interactive token usage is persisted in launch history and can be aggregated later. Interactive records are best-effort local data: Codex reads its latest cumulative rollout snapshot, Claude reads its assistant usage records, and Ollama — which writes no transcript of its own — is launched with `--verbose` so its per-response token counts land in the terminal capture cdx already takes. Antigravity reports no usage: its history is schema-less binary protobuf and its logs carry no usage line, so those sessions show no tokens by nature rather than by omission.
|
|
243
243
|
|
|
244
|
+
`--continue-run RUN_ID` resumes the exact provider conversation from a finished Claude or Codex run, inferring its profile and pinning its recorded model and effort. Existing targets and settings may be supplied only if they match. The parent transcript must still exist. `parent_run_id` links the new run to its parent in run results, the registry, and history; `conversation_id` identifies the provider conversation. Detached continuations preserve these settings through the cdx supervisor. Codex continuation usage is measured between exact transcript snapshots before and after the run, since exec resume can report conversation totals. If either boundary is unavailable, per-run usage stays unknown with `usage_attribution: "continuation_usage_unavailable"` in history instead of counting earlier turns again. Continuation does not use automatic capacity recovery or model fallback, and cannot be combined with `--failover` or `--isolate-workspace`.
|
|
245
|
+
|
|
246
|
+
Continuation errors are `continue_run_not_found` (unknown parent), `continue_run_mismatch` (another or missing profile/provider), `continue_run_unavailable` (unfinished or unsupported run, expired transcript, or unavailable settings), and `continue_run_settings_mismatch` (changed model/effort or incompatible flags). Callers may start a normal run after a refusal by omitting `--continue-run`.
|
|
247
|
+
|
|
244
248
|
Every usage record, whichever path produced it, uses one set of definitions:
|
|
245
249
|
|
|
246
250
|
| Field | Meaning |
|
|
@@ -251,11 +255,14 @@ Every usage record, whichever path produced it, uses one set of definitions:
|
|
|
251
255
|
| `cache_read_tokens` | Tokens served from it. Kept apart from cache creation because the two cost roughly 1.25x and 0.1x of uncached input, a difference no summed figure can recover. |
|
|
252
256
|
| `cached_input_tokens` | `cache_creation_tokens + cache_read_tokens`, derived. The single CACHE column in `cdx stats` shows this. |
|
|
253
257
|
| `output_tokens` | Generated tokens. |
|
|
258
|
+
| `cache_hit_ratio` | Cache reads divided by uncached input plus cache writes plus cache reads, excluding output. A fraction from 0 to 1; `null` without a reported read split or with zero input. When Codex omits writes, its reported total input is uncached input plus reads. |
|
|
254
259
|
| `reasoning_tokens` | Reasoning the provider counts separately. Codex reports one; Claude does not, because it bills thinking as output — those tokens are already inside `output_tokens`, so an empty REASON column for Claude is correct rather than missing. |
|
|
255
260
|
| `total_tokens` | `input + cache_creation + cache_read + output`. Cache is typically the bulk of real consumption, so a total that left it out would not be slightly low — it would be a different quantity. |
|
|
256
261
|
|
|
257
262
|
Cached input is counted once: it is excluded from `input_tokens` and reported in the cache fields, never in both. `null` means the provider did not report the figure, which is not the same as zero.
|
|
258
263
|
|
|
264
|
+
History and stats text show `cache 72 %` beside tokens, or `cache n/d` for unknown splits. Stats JSON adds `cache_usage` with nullable sums for `input_tokens`, `cache_creation_tokens`, `cache_read_tokens`, and `output_tokens`. Existing numeric aggregate fields are unchanged. `cache_hit_ratio` is computed from summed reads and input across measured runs, never by averaging percentages. `measured_runs`, `measured_input_tokens`, and `measured_cache_read_tokens` describe ratio coverage, excluding missing splits and zero-input runs. Each session, project, model, and total includes `run_types.cold` and `run_types.continued`, each with `runs` and the same cache summary fields. A missing `parent_run_id` counts as cold for historical compatibility.
|
|
265
|
+
|
|
259
266
|
`cdx stats` also shows a **`COST~`** column and ranks sessions by it. It weights each token class by what it costs relative to one uncached input token — cache read at the recorded model's ratio (0.1x by default), cache write 1.25x (2x for one-hour writes), and output at the recorded model's output/input ratio — and reports the result in uncached-input-equivalent tokens. These are ratios rather than prices. It is **not** a currency amount, and it is not comparable across providers whose own prices differ. Writes reported as one-hour are weighted 2x; a record without that split keeps the five-minute 1.25x rate.
|
|
260
267
|
|
|
261
268
|
Ranking on the raw total would put a session that mostly replayed a cache above one that spent far more on generation, because cache reads are typically the overwhelming majority of tokens consumed while costing a fiftieth of an output token.
|
package/package.json
CHANGED
package/pyproject.toml
CHANGED
package/src/cli.py
CHANGED
|
@@ -245,7 +245,7 @@ def _print_help(use_color=False):
|
|
|
245
245
|
f" {_style('cdx reset <name> [--yes] [--json]', '36', use_color)}",
|
|
246
246
|
f" {_style('cdx auth refresh <name|all> [--json]', '36', use_color)}",
|
|
247
247
|
f" {_style('cdx select --provider PROVIDER [--min-reasoning-effort minimal|low|medium|high|xhigh] [--min-power minimal|low|medium|high|xhigh] [--require-ready] [--refresh] --json', '36', use_color)}",
|
|
248
|
-
f" {_style('cdx run [session] --cwd PATH (--prompt-file PATH|--prompt TEXT|--prompt-file -) [--provider PROVIDER] [--model MODEL] [--kind assistant|code-review|retro] [--reasoning-effort minimal|low|medium|high|xhigh] [--power minimal|low|medium|high|xhigh] [--permission review|default|auto|full|workspace-write|read-only|danger-full-access] [--timeout-seconds N] [--label TEXT] [--max-parallel N] [--detach] [--failover] [--refresh] --json', '36', use_color)}",
|
|
248
|
+
f" {_style('cdx run [session] --cwd PATH (--prompt-file PATH|--prompt TEXT|--prompt-file -) [--provider PROVIDER] [--model MODEL] [--kind assistant|code-review|retro] [--reasoning-effort minimal|low|medium|high|xhigh] [--power minimal|low|medium|high|xhigh] [--permission review|default|auto|full|workspace-write|read-only|danger-full-access] [--timeout-seconds N] [--label TEXT] [--max-parallel N] [--continue-run RUN_ID] [--detach] [--failover] [--refresh] --json', '36', use_color)}",
|
|
249
249
|
f" {_style('cdx runs [--limit N] [--since 7d|today|DATE] [--running] --json', '36', use_color)}",
|
|
250
250
|
f" {_style('cdx run-status <run_id> --json', '36', use_color)}",
|
|
251
251
|
f" {_style('cdx run-report <run_id> --json', '36', use_color)}",
|
package/src/cli_args.py
CHANGED
|
@@ -47,7 +47,7 @@ CAN_RESUME_USAGE = "Usage: cdx can-resume <name> [--conversation <id>] [--json]"
|
|
|
47
47
|
SESSIONS_USAGE = "Usage: cdx sessions [--all] --json"
|
|
48
48
|
SELECT_USAGE = "Usage: cdx select --provider PROVIDER [--min-reasoning-effort minimal|low|medium|high|xhigh] [--min-power minimal|low|medium|high|xhigh] [--require-ready] [--refresh] --json"
|
|
49
49
|
NEXT_USAGE = "Usage: cdx next [--json] [--refresh]"
|
|
50
|
-
RUN_USAGE = "Usage: cdx run [session] (--cwd|--dir) PATH (--prompt-file PATH|--prompt TEXT|--prompt-file -) [--provider PROVIDER] [--model MODEL] [--kind assistant|code-review|retro] [--reasoning-effort minimal|low|medium|high|xhigh] [--power minimal|low|medium|high|xhigh] [--permission review|default|auto|full|workspace-write|read-only|danger-full-access] [--network-access] [--isolate-workspace] [--timeout-seconds N] [--label TEXT] [--max-parallel N] [--detach] [--failover] [--refresh] --json"
|
|
50
|
+
RUN_USAGE = "Usage: cdx run [session] (--cwd|--dir) PATH (--prompt-file PATH|--prompt TEXT|--prompt-file -) [--provider PROVIDER] [--model MODEL] [--kind assistant|code-review|retro] [--reasoning-effort minimal|low|medium|high|xhigh] [--power minimal|low|medium|high|xhigh] [--permission review|default|auto|full|workspace-write|read-only|danger-full-access] [--network-access] [--isolate-workspace] [--timeout-seconds N] [--label TEXT] [--max-parallel N] [--continue-run RUN_ID] [--detach] [--failover] [--refresh] --json"
|
|
51
51
|
RUN_JSON_REQUIRED = "cdx run: --json is required."
|
|
52
52
|
RUN_TARGET_REQUIRED = "cdx run: specify a session name or --provider PROVIDER."
|
|
53
53
|
RUN_SESSION_PROVIDER_CONFLICT = "cdx run: cannot specify both a session name and --provider."
|
|
@@ -543,6 +543,11 @@ def cdx_schema():
|
|
|
543
543
|
"too_many_runs",
|
|
544
544
|
"failover_exhausted",
|
|
545
545
|
"failover_limit_reached",
|
|
546
|
+
"capacity_recovery_exhausted",
|
|
547
|
+
"continue_run_not_found",
|
|
548
|
+
"continue_run_mismatch",
|
|
549
|
+
"continue_run_unavailable",
|
|
550
|
+
"continue_run_settings_mismatch",
|
|
546
551
|
"invalid_request",
|
|
547
552
|
"cdx_error",
|
|
548
553
|
],
|
|
@@ -660,6 +665,7 @@ def _parse_run_args(args):
|
|
|
660
665
|
"--prompt": {"key": "prompt", "type": "str", "default": None},
|
|
661
666
|
"--provider": {"key": "provider", "type": "str", "default": None, "transform": _parse_run_provider},
|
|
662
667
|
"--model": {"key": "model", "type": "str", "default": None},
|
|
668
|
+
"--continue-run": {"key": "continue_run", "type": "str", "default": None},
|
|
663
669
|
"--kind": {"key": "kind", "type": "str", "default": "assistant"},
|
|
664
670
|
"--reasoning-effort": {"key": "reasoning_effort", "type": "str", "default": None},
|
|
665
671
|
"--power": {"key": "power", "type": "str", "default": None},
|
|
@@ -683,7 +689,7 @@ def _parse_run_args(args):
|
|
|
683
689
|
code=ARG_CODE_MUTUALLY_EXCLUSIVE,
|
|
684
690
|
arguments=["session", "--provider"],
|
|
685
691
|
)
|
|
686
|
-
if not name and not parsed["provider"]:
|
|
692
|
+
if not name and not parsed["provider"] and not parsed["continue_run"]:
|
|
687
693
|
raise CdxArgumentError(RUN_TARGET_REQUIRED, code=ARG_CODE_MISSING, arguments=["session", "--provider"])
|
|
688
694
|
if not parsed["cwd"]:
|
|
689
695
|
raise CdxArgumentError(RUN_CWD_REQUIRED, code=ARG_CODE_MISSING, arguments=["--cwd"])
|
|
@@ -707,6 +713,9 @@ def _parse_run_args(args):
|
|
|
707
713
|
arguments=["--kind"],
|
|
708
714
|
allowed=RUN_KIND_VALUES,
|
|
709
715
|
)
|
|
716
|
+
if parsed["continue_run"] is not None and not parsed["continue_run"].strip():
|
|
717
|
+
raise CdxArgumentError("cdx run: --continue-run requires a nonempty run id.",
|
|
718
|
+
code=ARG_CODE_INVALID_VALUE, arguments=["--continue-run"])
|
|
710
719
|
effort = _parse_run_effort(parsed["reasoning_effort"], parsed["power"])
|
|
711
720
|
return {
|
|
712
721
|
"name": name,
|
|
@@ -714,6 +723,7 @@ def _parse_run_args(args):
|
|
|
714
723
|
"cwd": parsed["cwd"],
|
|
715
724
|
"prompt_file": parsed["prompt_file"],
|
|
716
725
|
"prompt": parsed["prompt"],
|
|
726
|
+
"continue_run": parsed["continue_run"],
|
|
717
727
|
"kind": parsed["kind"],
|
|
718
728
|
"model": parsed["model"],
|
|
719
729
|
"permission": parsed["permission"],
|
package/src/commands/launch.py
CHANGED
|
@@ -34,7 +34,7 @@ from ..provider_runtime import (
|
|
|
34
34
|
with_requested_conversation,
|
|
35
35
|
)
|
|
36
36
|
from ..run_command import PROMPT_STDIN, read_run_prompt
|
|
37
|
-
from ..run_usage import estimate_cost
|
|
37
|
+
from ..run_usage import estimate_cost, format_cache_ratio
|
|
38
38
|
|
|
39
39
|
LAUNCH_USAGE = "Usage: cdx <name> [--dir PATH] [--prompt TEXT|--prompt-file PATH|--task TEXT [--end-state TEXT]] [--resume] [--on-busy fail|ask] [--json]"
|
|
40
40
|
|
|
@@ -425,9 +425,9 @@ def _goodbye_line(session, run_info, use_color):
|
|
|
425
425
|
if cost is not None:
|
|
426
426
|
parts.append(_format_usd(cost))
|
|
427
427
|
elif isinstance(usage, dict):
|
|
428
|
-
total_tokens =
|
|
428
|
+
total_tokens = usage.get("total_tokens")
|
|
429
429
|
if total_tokens:
|
|
430
|
-
parts.append(f"{_format_token_count(total_tokens)} tokens")
|
|
430
|
+
parts.append(f"{_format_token_count(total_tokens)} tokens {format_cache_ratio(usage.get('cache_hit_ratio'))}")
|
|
431
431
|
return _dim(" · ".join(parts), use_color)
|
|
432
432
|
|
|
433
433
|
|
|
@@ -482,7 +482,7 @@ def _attach_interactive_usage(session, run_info, history=None, baseline=None, un
|
|
|
482
482
|
else:
|
|
483
483
|
previous = _previous_cumulative(history, provider_transcript)
|
|
484
484
|
if previous is not None:
|
|
485
|
-
delta = usage_delta(cumulative, previous)
|
|
485
|
+
delta = usage_delta(cumulative, previous, provider=session.get("provider"))
|
|
486
486
|
if delta is not None:
|
|
487
487
|
run_info["usage"] = delta
|
|
488
488
|
# A None delta means the transcript shrank, rotated, or was replaced.
|