Skip to content

Commit 40181af

Browse files
committed
feat: add models status auth probes
1 parent 2f1b9ef commit 40181af

17 files changed

Lines changed: 752 additions & 104 deletions

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Docs: https://docs.clawd.bot
66

77
### Changes
88
- CLI: restart the gateway by default after `clawdbot update`; add `--no-restart` to skip it.
9+
- CLI: add live auth probes to `clawdbot models status` for per-profile verification.
910
- Markdown: add per-channel table conversion (bullets for Signal/WhatsApp, code blocks elsewhere). (#1495) Thanks @odysseus0.
1011

1112
### Fixes

‎docs/cli/index.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,8 +700,15 @@ Options:
700700
- `--json`
701701
- `--plain`
702702
- `--check` (exit 1=expired/missing, 2=expiring)
703+
- `--probe` (live probe of configured auth profiles)
704+
- `--probe-provider <name>`
705+
- `--probe-profile <id>` (repeat or comma-separated)
706+
- `--probe-timeout <ms>`
707+
- `--probe-concurrency <n>`
708+
- `--probe-max-tokens <n>`
703709

704710
Always includes the auth overview and OAuth expiry status for profiles in the auth store.
711+
`--probe` runs live requests (may consume tokens and trigger rate limits).
705712

706713
### `models set <model>`
707714
Set `agents.defaults.model.primary`.

‎docs/cli/models.md‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,26 @@ clawdbot models scan
2525
`clawdbot models status` shows the resolved default/fallbacks plus an auth overview.
2626
When provider usage snapshots are available, the OAuth/token status section includes
2727
provider usage headers.
28+
Add `--probe` to run live auth probes against each configured provider profile.
29+
Probes are real requests (may consume tokens and trigger rate limits).
2830

2931
Notes:
3032
- `models set <model-or-alias>` accepts `provider/model` or an alias.
3133
- Model refs are parsed by splitting on the **first** `/`. If the model ID includes `/` (OpenRouter-style), include the provider prefix (example: `openrouter/moonshotai/kimi-k2`).
3234
- If you omit the provider, Clawdbot treats the input as an alias or a model for the **default provider** (only works when there is no `/` in the model ID).
3335

36+
### `models status`
37+
Options:
38+
- `--json`
39+
- `--plain`
40+
- `--check` (exit 1=expired/missing, 2=expiring)
41+
- `--probe` (live probe of configured auth profiles)
42+
- `--probe-provider <name>` (probe one provider)
43+
- `--probe-profile <id>` (repeat or comma-separated profile ids)
44+
- `--probe-timeout <ms>`
45+
- `--probe-concurrency <n>`
46+
- `--probe-max-tokens <n>`
47+
3448
## Aliases + fallbacks
3549

3650
```bash

‎src/cli/models-cli.ts‎

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,36 @@ export function registerModelsCli(program: Command) {
7171
"Exit non-zero if auth is expiring/expired (1=expired/missing, 2=expiring)",
7272
false,
7373
)
74+
.option("--probe", "Probe configured provider auth (live)", false)
75+
.option("--probe-provider <name>", "Only probe a single provider")
76+
.option(
77+
"--probe-profile <id>",
78+
"Only probe specific auth profile ids (repeat or comma-separated)",
79+
(value, previous) => {
80+
const next = Array.isArray(previous) ? previous : previous ? [previous] : [];
81+
next.push(value);
82+
return next;
83+
},
84+
)
85+
.option("--probe-timeout <ms>", "Per-probe timeout in ms")
86+
.option("--probe-concurrency <n>", "Concurrent probes")
87+
.option("--probe-max-tokens <n>", "Probe max tokens (best-effort)")
7488
.action(async (opts) => {
7589
await runModelsCommand(async () => {
76-
await modelsStatusCommand(opts, defaultRuntime);
90+
await modelsStatusCommand(
91+
{
92+
json: Boolean(opts.json),
93+
plain: Boolean(opts.plain),
94+
check: Boolean(opts.check),
95+
probe: Boolean(opts.probe),
96+
probeProvider: opts.probeProvider as string | undefined,
97+
probeProfile: opts.probeProfile as string | string[] | undefined,
98+
probeTimeout: opts.probeTimeout as string | undefined,
99+
probeConcurrency: opts.probeConcurrency as string | undefined,
100+
probeMaxTokens: opts.probeMaxTokens as string | undefined,
101+
},
102+
defaultRuntime,
103+
);
77104
});
78105
});
79106

‎src/commands/models.list.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const discoverModels = vi.fn();
1717

1818
vi.mock("../config/config.js", () => ({
1919
CONFIG_PATH_CLAWDBOT: "/tmp/clawdbot.json",
20+
STATE_DIR_CLAWDBOT: "/tmp/clawdbot-state",
2021
loadConfig,
2122
}));
2223

0 commit comments

Comments
 (0)