Skip to content

Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.

coach: apply the privilege gate on every path that starts a provider runtime (GHSA-w724-p4hx-jfv9)

Boris 'B' Kurktchievc39789a392a0
diff --git a/api/coach/adapters/spawn.js b/api/coach/adapters/spawn.js
index 1284ae92a..1f2104515 100644
--- a/api/coach/adapters/spawn.js
+++ b/api/coach/adapters/spawn.js
@@ -62,6 +62,18 @@ export function canDropPrivileges() {
return { ok: false, dropped: false, why: 'no `coach` user exists in this image' };
}
+/**
+ * The gate every path that may start a provider runtime goes through — a job, the admin's test
+ * run, and the admin card's version check — so the three cannot drift apart. Returns the
+ * refusal, worded the same everywhere, or null when the adapter may run. A provider that spawns
+ * nothing has no process to drop and is never refused for lacking the drop.
+ */
+export function privilegeRefusal(adapter) {
+ if (adapter?.spawns === false) return null;
+ const priv = canDropPrivileges();
+ return priv.ok ? null : `Coach jobs are disabled: ${priv.why}`;
+}
+
/**
* Run `cmd argv`, feed `stdin`, resolve { code, stdout, stderr, timedOut }.
* Never rejects on a non-zero exit: the caller classifies failures, and a CLI that prints a
diff --git a/api/coach/jobs.js b/api/coach/jobs.js
index 512bec66d..ba5d0af77 100644
--- a/api/coach/jobs.js
+++ b/api/coach/jobs.js
@@ -25,7 +25,7 @@ import { hashPlan } from './core/plan-hash.js';
import { buildPrompt } from './core/prompt.js';
import { handleFor } from './handle.js';
import { fetchFor } from './node-fetch.js';
-import { canDropPrivileges, unprivilegedIds } from './adapters/spawn.js';
+import { privilegeRefusal, unprivilegedIds } from './adapters/spawn.js';
import { cohortForPayload, invalidate as invalidateCohort } from './cohort.js';
// The prompt assembly, the plan fingerprint and the invoke→parse→validate→repair loop all
@@ -212,23 +212,23 @@ export function enqueue(uid, opts) {
if (cred.reason === 'shared-account') throw new CoachError('shared', cred.message);
throw new CoachError('off', 'this profile has no provider account connected');
}
- // Spending is what binds: a personal credential (setup token, OAuth) belongs to the first
- // profile that runs a job on it from here on; an API key binds to nobody and is shared.
- cfgStore.bindInstanceCredential(uid);
-
// The privilege drop is what keeps a provider runtime out of ./data. If it cannot be
// performed, there is no job — see canDropPrivileges for why this is not a warning either.
// A provider that spawns nothing has no process to drop, and is not refused for it.
- if (adapterFor(cfgStore.load().provider)?.spawns !== false) {
- const priv = canDropPrivileges();
- if (!priv.ok) throw new CoachError('unprivileged', `Coach jobs are disabled: ${priv.why}`);
- }
+ // Asked before the bind below: a job refused here spends nothing, so it must not bind.
+ const refusal = privilegeRefusal(adapterFor(cfgStore.load().provider));
+ if (refusal) throw new CoachError('unprivileged', refusal);
+ // The caps, before the bind for the same reason: a job refused for the day spends nothing.
const caps = cfgStore.load().caps || {};
const { used, limit } = capState(uid);
if (limit > 0 && used >= limit) throw new CoachError('cap', 'daily limit reached');
if (caps.instanceDaily > 0 && instanceUsedToday() >= caps.instanceDaily) throw new CoachError('cap', 'this instance has reached its daily limit');
+ // Spending is what binds: a personal credential (setup token, OAuth) belongs to the first
+ // profile that runs a job on it from here on; an API key binds to nobody and is shared.
+ cfgStore.bindInstanceCredential(uid);
+
// Counted at enqueue, not at completion: the cap exists to bound what one profile can spend
// of the owner's provider account, and queueing twenty jobs spends it whether or not the
// twentieth ever finishes.
@@ -325,6 +325,11 @@ async function execute(job) {
const cfg = cfgStore.load();
const adapter = adapterFor(cfg.provider);
if (!adapter) return finish(job, { outcome: 'failed', errorClass: 'off' });
+ // The gate again, for the provider this job actually runs on: enqueue asked about the one
+ // configured then, and a job that waited behind two others would otherwise spawn without the
+ // drop if the admin had switched from an HTTPS provider to a runtime-backed one meanwhile.
+ const refusal = privilegeRefusal(adapter);
+ if (refusal) return finish(job, { outcome: 'failed', errorClass: 'unprivileged', detail: refusal });
if (job.kind === 'debrief' && !payloadLib.findWorkout(S, job.workoutId)) {
return finish(job, { outcome: 'failed', errorClass: 'noworkout' });
@@ -459,6 +464,10 @@ export async function testRun() {
const cfg = cfgStore.load();
const adapter = adapterFor(cfg.provider);
if (!adapter) return { ok: false, error: 'no provider configured' };
+ // The same gate as enqueue: this spawns the runtime a job would, and without the drop the
+ // child runs as this process and can read ./data.
+ const refusal = privilegeRefusal(adapter);
+ if (refusal) return { ok: false, error: refusal };
const jobDir = adapter.spawns === false ? null : fs.mkdtempSync(path.join(os.tmpdir(), 'coach-test-'));
try {
// No user asked for this, so there is no profile whose account is being spent. In instance
diff --git a/api/coach/routes.js b/api/coach/routes.js
index 85c0c7eb1..6b6fdafa5 100644
--- a/api/coach/routes.js
+++ b/api/coach/routes.js
@@ -8,7 +8,7 @@ import * as cfgStore from './config.js';
import * as jobs from './jobs.js';
import { computeCohort } from './cohort.js';
import { adapterFor } from './adapters/index.js';
-import { canDropPrivileges } from './adapters/spawn.js';
+import { canDropPrivileges, privilegeRefusal } from './adapters/spawn.js';
import { DATA_CATEGORIES } from './core/payload.js';
import { validateBaseUrl, validateHeaders, baseUrlFor } from './core/providers.js';
@@ -146,8 +146,14 @@ export function coachRoutes({ json, readBody, readSession, requireAdmin }) {
const adapter = adapterFor(cfg.provider);
// For the runtime-backed providers this asks "is the runtime there"; for an HTTPS one it
// lists the models with the stored key, which is the round trip the card wants anyway.
+ // Asking a runtime whether it is there means running it (`codex --version`), so the check
+ // answers to the same privilege gate as a job and the test run: without the drop it is not
+ // run, and the card reports the runtime unavailable with the reason.
const cred = adapter?.spawns === false ? cfgStore.credentialFor(cfgStore.boundUidFor(cfg)) : undefined;
- const check = adapter ? await adapter.check(cfg, cfgStore.jobEnv(process.env.TMPDIR || '/tmp', cred?.ok ? cred : undefined)) : { ok: false, error: 'unknown provider' };
+ const refusal = privilegeRefusal(adapter);
+ const check = !adapter ? { ok: false, error: 'unknown provider' }
+ : refusal ? { ok: false, error: refusal }
+ : await adapter.check(cfg, cfgStore.jobEnv(process.env.TMPDIR || '/tmp', cred?.ok ? cred : undefined));
const log = cfg.log || [];
const today = new Date().toISOString().slice(0, 10);
json(res, 200, {
diff --git a/api/openapi.yaml b/api/openapi.yaml
index c4d0e695e..939800046 100644
--- a/api/openapi.yaml
+++ b/api/openapi.yaml
@@ -2771,6 +2771,9 @@ paths:
Everything the admin screen renders in one round trip, including a live check of
the configured provider: for a runtime provider "is the runtime there", for an
HTTPS one the model list its stored key can see.
+ A runtime-backed provider is not run when the privilege drop cannot be
+ performed, exactly as a job would not be: `runtime` then reads unavailable, with
+ the same reason a job is refused with.
Counts and outcomes only: no intake answers, no payloads, no proposals, and never
a credential, only whether one is filed and what it is labelled.
@@ -2848,6 +2851,8 @@ paths:
description: |
Checks the runtime, then asks the model for one fixed JSON object and validates
the shape that comes back. That is the whole path a job takes, on nobody's profile.
+ A runtime-backed provider is refused, without spawning anything, when the
+ privilege drop cannot be performed, exactly as a job would be.
Always 200: the outcome is in the body, because "the provider refused" is an
answer to the question the button asks, not a failure of the request. An HTTPS
diff --git a/api/test/coach-limits.test.js b/api/test/coach-limits.test.js
index 660eac6f5..dab991da3 100644
--- a/api/test/coach-limits.test.js
+++ b/api/test/coach-limits.test.js
@@ -103,6 +103,46 @@ test('the instance count is not bounded by the length of the job log', () => {
return settle(uid);
});
+test('a job the daily caps refuse does not bind the instance credential', () => {
+ // A personal credential belongs to the first profile that spends it. A job refused for the
+ // day spends nothing, but the bind used to come before the caps, so a profile that asked on a
+ // day the caps were already reached took the owner's account with it, and from then on every
+ // other profile was refused as sharing it.
+ const prev = cfg.load();
+ cfg.save({
+ provider: 'claude', authMode: 'instance', boundUid: {},
+ auth: { claude: { type: 'cli-token', account: '[email protected]', data: cfg.encrypt({ token: 'tok-instance' }) } }
+ });
+ try {
+ const own = 'u-cap-bind-own';
+ writeState(DIR, own, sampleState());
+ fs.mkdirSync(`${DIR}/coach`, { recursive: true });
+ fs.writeFileSync(userFile(own), JSON.stringify({ daily: { date: today, count: 1 }, history: [] }));
+ cfg.save({ caps: { perProfileDaily: 1, instanceDaily: 0 } });
+ assert.throws(() => jobs.enqueue(own, { kind: 'review' }), e => e.code === 'cap' && e.message === 'daily limit reached');
+ assert.equal(cfg.boundUidFor(), null, 'a profile over its own cap did not take the credential');
+
+ const inst = 'u-cap-bind-inst';
+ writeState(DIR, inst, sampleState());
+ cfg.save({ caps: { perProfileDaily: 10, instanceDaily: 1 }, daily: { date: today, count: 1 } });
+ assert.throws(() => jobs.enqueue(inst, { kind: 'review' }), e => e.code === 'cap' && /instance/.test(e.message));
+ assert.equal(cfg.boundUidFor(), null, 'nor did one the instance cap refused');
+
+ // Not vacuous: this is a credential that binds on spend.
+ cfg.bindInstanceCredential(own);
+ assert.equal(cfg.boundUidFor(), own);
+
+ // The refusals ahead of the caps still come first, caps reached or not: a profile the
+ // credential is bound away from hears that it is someone else's account, and a profile with
+ // no account of its own hears that, rather than "try again tomorrow".
+ assert.throws(() => jobs.enqueue(inst, { kind: 'review' }), e => e.code === 'shared');
+ cfg.save({ authMode: 'profile' });
+ assert.throws(() => jobs.enqueue(inst, { kind: 'review' }), e => e.code === 'off' && e.message === 'this profile has no provider account connected');
+ } finally {
+ cfg.save({ provider: prev.provider, authMode: prev.authMode, boundUid: prev.boundUid, auth: prev.auth, daily: prev.daily, caps: { perProfileDaily: 10, instanceDaily: 0 } });
+ }
+});
+
/* ---------- scheduled reviews ---------- */
/** startCadence arms a setInterval; take the callback so the tests can tick it by hand. */
diff --git a/api/test/jobs.test.js b/api/test/jobs.test.js
index 9eae8fc6b..af2bd4b7c 100644
--- a/api/test/jobs.test.js
+++ b/api/test/jobs.test.js
@@ -456,6 +456,42 @@ test('a job is refused outright when the privilege drop cannot be performed', ()
}
});
+test('the admin test-run answers to the same privilege gate, and spawns nothing without it', async () => {
+ // "Test the Coach" runs the provider runtime a job would, so without the drop the child would
+ // run as this process and see ./data. It used to skip the gate the job path performs.
+ const { adapterFor } = await import('../coach/adapters/index.js');
+ const adapter = adapterFor('fixture');
+ const real = { check: adapter.check, invoke: adapter.invoke };
+ let calls = 0;
+ adapter.check = async (...a) => { calls++; return real.check(...a); };
+ adapter.invoke = async (...a) => { calls++; return real.invoke(...a); };
+ forcePrivilegeVerdict({ ok: false, dropped: false, why: 'no `coach` user exists in this image' });
+ try {
+ const r = await jobs.testRun();
+ assert.equal(r.ok, false);
+ assert.equal(r.error, 'Coach jobs are disabled: no `coach` user exists in this image');
+ assert.equal(calls, 0, 'neither the version check nor the round trip ran');
+
+ // An HTTPS provider spawns nothing, so the same host still tests it end to end.
+ const https = adapterFor('compatible');
+ const realHttps = { check: https.check, invoke: https.invoke };
+ https.check = async () => ({ ok: true, version: 'stubbed' });
+ https.invoke = async () => ({ code: 0, text: '{"coach_contract":1,"ok":true}', stderr: '' });
+ cfg.save({ provider: 'compatible', providerOptions: { compatible: { baseUrl: 'http://swap.test:9292' } }, models: { compatible: 'local-model' } });
+ try {
+ assert.deepEqual(await jobs.testRun(), { ok: true, version: 'stubbed' });
+ } finally {
+ Object.assign(https, realHttps);
+ cfg.save({ provider: 'fixture' });
+ }
+ } finally {
+ forcePrivilegeVerdict({ ok: true, dropped: false, why: 'pinned by the test suite' });
+ Object.assign(adapter, real);
+ }
+ // and with the drop available it is the same round trip as before
+ assert.equal((await jobs.testRun()).ok, true);
+});
+
test('an HTTPS provider is not refused for lacking a privilege drop, and runs end to end through the queue', async () => {
// A local server speaking OpenAI's Chat Completions shape, answering a valid "no change"
// review. This is the whole reason the HTTP adapters exist: no runtime, no child process,
@@ -575,3 +611,67 @@ test('a job sends the admin\'s configured output cap, so a reasoning model is no
server.close();
}
});
+
+test('a job that waited in the queue answers to the gate for the provider it actually runs on', async () => {
+ // enqueue asks about the provider configured at the time. Two jobs run at once, so a third
+ // waits, and it runs against whatever is configured when its turn comes: switched from an
+ // HTTPS provider to a runtime-backed one meanwhile, it used to spawn without the drop.
+ const { adapterFor } = await import('../coach/adapters/index.js');
+ const https = adapterFor('compatible');
+ const fixture = adapterFor('fixture');
+ const real = { https: https.invoke, fixture: fixture.invoke };
+ let release;
+ const held = new Promise(r => { release = r; });
+ https.invoke = async () => { await held; return { code: 0, text: '{"coach_contract":1,"nochange":true,"reading":"held"}', stderr: '' }; };
+ let spawned = 0;
+ fixture.invoke = async () => { spawned++; return { code: 1, text: '', stderr: 'the fixture stub ran' }; };
+ const uids = ['u-late-1', 'u-late-2', 'u-late-3'];
+ for (const uid of uids) writeState(DIR, uid, sampleState());
+ cfg.save({ enabled: true, provider: 'compatible', providerOptions: { compatible: { baseUrl: 'http://swap.test:9292' } }, models: { compatible: 'local-model' } });
+ forcePrivilegeVerdict({ ok: false, dropped: false, why: 'no `coach` user exists in this image' });
+ try {
+ for (const uid of uids) jobs.enqueue(uid, { kind: 'review' });
+ assert.equal(jobs.status('u-late-3').job.state, 'queued', 'the third waits behind the two running');
+ cfg.save({ provider: 'fixture' });
+ release();
+ await Promise.all(uids.map(u => settle(u)));
+
+ assert.equal(lastOutcome('u-late-1').outcome, 'nochange', 'the jobs already running on the HTTPS provider finish');
+ assert.equal(lastOutcome('u-late-3').outcome, 'failed');
+ assert.equal(lastOutcome('u-late-3').errorClass, 'unprivileged');
+ assert.equal(spawned, 0, 'the runtime was never started');
+ const logged = cfg.load().log.find(e => e.uid === 'u-late-3');
+ assert.equal(logged.outcome, 'failed');
+ assert.equal(logged.detail, 'Coach jobs are disabled: no `coach` user exists in this image');
+ } finally {
+ release();
+ forcePrivilegeVerdict({ ok: true, dropped: false, why: 'pinned by the test suite' });
+ https.invoke = real.https;
+ fixture.invoke = real.fixture;
+ cfg.save({ provider: 'fixture' });
+ }
+});
+
+test('a job refused by the privilege gate does not bind the instance credential', () => {
+ // A personal credential belongs to the first profile that spends it. A refused job spends
+ // nothing, but the bind used to happen before the gate, so the refusal still handed the
+ // owner's account to whichever profile happened to ask first.
+ const uid = 'u-priv-bind';
+ writeState(DIR, uid, sampleState());
+ const prev = cfg.load();
+ cfg.save({
+ provider: 'claude', authMode: 'instance', boundUid: {},
+ auth: { claude: { type: 'cli-token', account: '[email protected]', data: cfg.encrypt({ token: 'tok-instance' }) } }
+ });
+ forcePrivilegeVerdict({ ok: false, dropped: false, why: 'no `coach` user exists in this image' });
+ try {
+ assert.throws(() => jobs.enqueue(uid, { kind: 'review' }), e => e.code === 'unprivileged');
+ assert.equal(cfg.boundUidFor(), null, 'the refused profile did not take the credential');
+ // Not vacuous: this is a credential that binds on spend.
+ cfg.bindInstanceCredential(uid);
+ assert.equal(cfg.boundUidFor(), uid);
+ } finally {
+ forcePrivilegeVerdict({ ok: true, dropped: false, why: 'pinned by the test suite' });
+ cfg.save({ provider: prev.provider, authMode: prev.authMode, boundUid: prev.boundUid, auth: prev.auth });
+ }
+});
diff --git a/api/test/routes.test.js b/api/test/routes.test.js
index 6070b19f0..73ccb7b94 100644
--- a/api/test/routes.test.js
+++ b/api/test/routes.test.js
@@ -151,6 +151,39 @@ test('the compatible endpoint: base URL is validated, a keyless endpoint counts
} finally { mock.close(); }
});
+test('the card does not run a runtime to ask its version when the privilege drop cannot be performed', async () => {
+ // `codex --version` is a child process like a job's, and without the drop it would run as this
+ // process and see ./data. The job path and the test run refused it; the card's check did not.
+ const { forcePrivilegeVerdict } = await import('../coach/adapters/spawn.js');
+ const { adapterFor } = await import('../coach/adapters/index.js');
+ const ids = ['codex', 'claude', 'fixture'];
+ const real = Object.fromEntries(ids.map(id => [id, adapterFor(id).check]));
+ let calls = 0;
+ for (const id of ids) adapterFor(id).check = async () => { calls++; return { ok: true, version: 'stubbed' }; };
+ forcePrivilegeVerdict({ ok: false, dropped: false, why: 'no `coach` user exists in this image' });
+ try {
+ const { call } = harness();
+ for (const provider of ids) {
+ fresh({ provider });
+ const r = await call('GET /api/admin/coach');
+ assert.equal(r.status, 200);
+ assert.deepEqual(r.body.runtime, { ok: false, version: null, error: 'Coach jobs are disabled: no `coach` user exists in this image', needsKey: false }, provider);
+ assert.equal(r.body.unprivileged.ok, false);
+ }
+ assert.equal(calls, 0, 'no runtime check was entered, so nothing was spawned');
+
+ // With the drop available the same card asks the runtime, as before.
+ forcePrivilegeVerdict({ ok: true, dropped: false, why: 'pinned by the test suite' });
+ fresh({ provider: 'codex' });
+ const r = await call('GET /api/admin/coach');
+ assert.deepEqual(r.body.runtime, { ok: true, version: 'stubbed', error: null, needsKey: false });
+ assert.equal(calls, 1);
+ } finally {
+ forcePrivilegeVerdict(null);
+ for (const id of ids) adapterFor(id).check = real[id];
+ }
+});
+
test('the disclosure names the provider and the same five categories the payload builds from', async () => {
fresh({ provider: 'gemini' });
const { call } = harness();
diff --git a/frontend/src/lib/coach-api.joberror.test.js b/frontend/src/lib/coach-api.joberror.test.js
new file mode 100644
index 000000000..6c440dd5a
--- /dev/null
+++ b/frontend/src/lib/coach-api.joberror.test.js
@@ -0,0 +1,44 @@
+/* jobErrorText is what a lifter reads when a Coach job fails. A queued job the server refuses
+ * when it comes to start it — the process cannot drop privileges — ends with errorClass
+ * 'unprivileged'. JOB_ERRORS had no line for that class, so it fell back on the internal line
+ * ("Something went wrong on the server."), which says nothing, while the same refusal at enqueue
+ * already answers with words the operator can act on (api/coach/routes.js USER_ERROR). This pins
+ * the line, and that it reads the same as the enqueue refusal.
+ *
+ * coach-api.js pulls the store and the demo/local modules in; they are stubbed so importing it
+ * needs no running app. jobErrorText on the server path (not a phone with its own key) is all
+ * this file exercises.
+ */
+import { readFileSync } from 'node:fs'
+import { beforeEach, describe, expect, it, vi } from 'vitest'
+
+const mocks = vi.hoisted(() => ({ MOBILE: false, coachLocal: null, toast: vi.fn() }))
+vi.mock('./demo.js', () => ({ DEMO: false, DEMO_SEEDED: 'gym_demo_seeded_v1', REPO: '' }))
+vi.mock('./mobile.js', () => ({ get MOBILE() { return mocks.MOBILE } }))
+vi.mock('./api.js', () => ({ api: vi.fn() }))
+vi.mock('./coach-demo.js', () => ({}))
+vi.mock('./coach-local.js', () => ({ setNotifier: vi.fn() }))
+vi.mock('../store/useStore.js', () => ({ useStore: { getState: () => ({ S: { unit: 'kg' }, coachLocal: mocks.coachLocal }) } }))
+vi.mock('../store/useUI.js', () => ({ useUI: { getState: () => ({ toast: mocks.toast }) } }))
+
+const { jobErrorText, JOB_ERRORS } = await import('./coach-api.js')
+
+beforeEach(() => { mocks.MOBILE = false; mocks.coachLocal = null })
+
+describe('jobErrorText for a job refused at start for safety', () => {
+ it('reads as the refusal at enqueue does, not as internal', () => {
+ expect(JOB_ERRORS.unprivileged).toBeTruthy()
+ expect(jobErrorText('unprivileged')).toBe(JOB_ERRORS.unprivileged)
+ expect(jobErrorText('unprivileged')).not.toBe(JOB_ERRORS.internal)
+ // The provider detail a real failure would carry is kept off the lifter's screen on the
+ // server path, the same as every other class.
+ expect(jobErrorText('unprivileged', 'COACH_UID is not set')).toBe(JOB_ERRORS.unprivileged)
+ })
+
+ it('says it in the same words the enqueue refusal answers with (api/coach/routes.js)', () => {
+ const routes = readFileSync(new URL('../../../api/coach/routes.js', import.meta.url), 'utf8')
+ const atEnqueue = routes.match(/^\s*unprivileged: '([^']+)'/m)?.[1]
+ expect(atEnqueue).toBeTruthy()
+ expect(JOB_ERRORS.unprivileged.toLowerCase()).toBe(atEnqueue.toLowerCase() + '.')
+ })
+})
diff --git a/website/api.html b/website/api.html
index 7867f4449..b8349e78a 100644
--- a/website/api.html
+++ b/website/api.html
@@ -2887,7 +2887,7 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon
<span class="ep-sum">The Coach card</span>
</summary>
<div class="ep-body">
-<p>Everything the admin screen renders in one round trip, including a live check of the configured provider: for a runtime provider &quot;is the runtime there&quot;, for an HTTPS one the model list its stored key can see.</p>
+<p>Everything the admin screen renders in one round trip, including a live check of the configured provider: for a runtime provider &quot;is the runtime there&quot;, for an HTTPS one the model list its stored key can see. A runtime-backed provider is not run when the privilege drop cannot be performed, exactly as a job would not be: <code>runtime</code> then reads unavailable, with the same reason a job is refused with.</p>
<p>Counts and outcomes only: no intake answers, no payloads, no proposals, and never a credential, only whether one is filed and what it is labelled.</p>
<p class="ep-auth"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4" y="11" width="16" height="10" rx="2.5"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg><span>Admin only: a signed-in session whose user is an admin (<code>ADMIN_UIDS</code> or <code>admin:true</code>), as the session cookie or a Bearer token.</span></p>
@@ -3007,7 +3007,7 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon
<span class="ep-sum">Run one round trip against the provider</span>
</summary>
<div class="ep-body">
-<p>Checks the runtime, then asks the model for one fixed JSON object and validates the shape that comes back. That is the whole path a job takes, on nobody's profile.</p>
+<p>Checks the runtime, then asks the model for one fixed JSON object and validates the shape that comes back. That is the whole path a job takes, on nobody's profile. A runtime-backed provider is refused, without spawning anything, when the privilege drop cannot be performed, exactly as a job would be.</p>
<p>Always 200: the outcome is in the body, because &quot;the provider refused&quot; is an answer to the question the button asks, not a failure of the request. An HTTPS provider gets the same retries as a job: a 429, 500, 502, 503, 504 or 529 is tried twice more, after pauses of 2 and 5 seconds, and only then reported. A runtime provider is asked once.</p>
<p class="ep-auth"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4" y="11" width="16" height="10" rx="2.5"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg><span>Admin only: a signed-in session whose user is an admin (<code>ADMIN_UIDS</code> or <code>admin:true</code>), as the session cookie or a Bearer token.</span></p>