@prohost/cli 0.4.1 → 0.4.2
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/CHANGELOG.md +43 -0
- package/README.md +36 -0
- package/dist/agent/codex.d.ts +105 -13
- package/dist/agent/codex.js +139 -19
- package/dist/agent/run.js +15 -2
- package/dist/version.d.ts +2 -2
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,49 @@ Versions follow [semver](https://semver.org/). Publishing is automated: merging
|
|
|
4
4
|
a version bump to `main` triggers `.github/workflows/npm-publish-cli.yml`, which
|
|
5
5
|
builds via `prepack`, runs the suite, publishes, and tags `cli-v<version>`.
|
|
6
6
|
|
|
7
|
+
## 0.4.2
|
|
8
|
+
|
|
9
|
+
Isolated Codex runs no longer receive the operator's **apps (connectors)**.
|
|
10
|
+
|
|
11
|
+
- **`codex_apps` tools are kept out of every run.** A Codex "app" is a set of
|
|
12
|
+
MCP tools served under the name `codex_apps`, and it appears in **no**
|
|
13
|
+
`codex mcp list --json` output at any setting: apps are account-level, arrive
|
|
14
|
+
with the ChatGPT login, and are cached under `$CODEX_HOME/cache/codex_apps_tools`
|
|
15
|
+
rather than declared in `mcp_servers`. The isolation contract is that a run
|
|
16
|
+
gets the ProhostAI server and the operator's explicitly-allowed extras and
|
|
17
|
+
nothing else, and this broke it silently — the enumeration the guarantee is
|
|
18
|
+
built on cannot see these tools at all. Every isolated run now carries
|
|
19
|
+
`-c features.apps=false`.
|
|
20
|
+
- **It was not hypothetical, and not limited to plugin installs.** Measured
|
|
21
|
+
against codex-cli 0.146.0: a `CODEX_HOME` whose config declares no plugins
|
|
22
|
+
and one ordinary MCP server — where 0.4.1 disables that server cleanly, finds
|
|
23
|
+
nothing that resists, and therefore applies no whole-config override at all —
|
|
24
|
+
still handed the run 28 `mcp__codex_apps__*` tools. They are not read-only:
|
|
25
|
+
`sites_create_site`, `sites_deploy_site_version`, `sites_add_custom_domain`,
|
|
26
|
+
`sites_update_environment_variables`, `sites_generate_siwc_bypass_token`,
|
|
27
|
+
`plugin_management_update_app_permissions` and
|
|
28
|
+
`plugin_management_uninstall_app` publish sites and rewrite app permissions on
|
|
29
|
+
the operator's own account.
|
|
30
|
+
- **A dedicated `CODEX_HOME` was never a fix for this one.** A directory holding
|
|
31
|
+
only `auth.json` — 0.4.1's own suggested remedy — fetches the account's apps
|
|
32
|
+
on its first run, writes them to its own cache, and serves the full set from
|
|
33
|
+
the second run onwards. The login carries them, so a fresh directory delays
|
|
34
|
+
the exposure by exactly one run. Hence unconditional rather than opt-in.
|
|
35
|
+
- **`features.plugins=false` was the wrong lever, and only ever worked by
|
|
36
|
+
accident.** It closed this on plugin-bearing machines because apps happened to
|
|
37
|
+
arrive through that pipeline there, but it leaves the apps instructions in the
|
|
38
|
+
prompt, costs the operator their plugin skills and hooks, and is never applied
|
|
39
|
+
at all on a classic-only install. `features.apps=false` is the narrow switch:
|
|
40
|
+
it leaves `plugins` on, so skills and hooks survive.
|
|
41
|
+
- **Proven, not assumed.** There is no listing to verify against, so the switch
|
|
42
|
+
is read back out of `codex features list` — the `apps` row must actually read
|
|
43
|
+
`false` under the exact overrides the run will carry. A renamed feature, an
|
|
44
|
+
older Codex with no `features` subcommand, or an override that loads and
|
|
45
|
+
changes nothing all read as *unknown*, and a run that cannot prove the
|
|
46
|
+
boundary fails before Codex starts with a one-line remedy. 0.4.1's plugin
|
|
47
|
+
handling, three-tier probe path and classic `mcp_servers` disabling are
|
|
48
|
+
unchanged and regression-tested.
|
|
49
|
+
|
|
7
50
|
## 0.4.1
|
|
8
51
|
|
|
9
52
|
Codex runs work again on machines with a Codex **plugin** installed.
|
package/README.md
CHANGED
|
@@ -329,6 +329,35 @@ used: `plugins."github@openai-curated".enabled=false` and every variant of it
|
|
|
329
329
|
load without error and disable nothing at all, which is precisely the kind of
|
|
330
330
|
override the verification step exists to catch.
|
|
331
331
|
|
|
332
|
+
**Your apps (connectors) are switched off for every run, unconditionally.**
|
|
333
|
+
Codex "apps" are the third way tools reach a run, and the only one with no
|
|
334
|
+
inventory to read: an app *is* a set of MCP tools, served under the name
|
|
335
|
+
`codex_apps`, and it appears in **no** `codex mcp list --json` output at any
|
|
336
|
+
setting. Apps are account-level — they come with your ChatGPT login and are
|
|
337
|
+
cached under `$CODEX_HOME/cache/codex_apps_tools`, not declared in
|
|
338
|
+
`mcp_servers`. On the install this was measured against they were 28 tools, and
|
|
339
|
+
they are not read-only: `sites_create_site`, `sites_deploy_site_version`,
|
|
340
|
+
`sites_add_custom_domain`, `sites_update_environment_variables`,
|
|
341
|
+
`sites_generate_siwc_bypass_token`, `plugin_management_update_app_permissions`
|
|
342
|
+
and `plugin_management_uninstall_app` publish sites and rewrite app permissions
|
|
343
|
+
on your account.
|
|
344
|
+
|
|
345
|
+
So this one is not applied on evidence, the way the plugins switch is — there is
|
|
346
|
+
no listing to take evidence from. Every isolated run carries
|
|
347
|
+
`-c features.apps=false`, and the CLI reads the result back out of
|
|
348
|
+
`codex features list` to confirm the `apps` row really flipped. If it cannot
|
|
349
|
+
confirm that, the run fails before Codex starts, for the same reason a server
|
|
350
|
+
that will not disable fails it: an override that loads happily and changes
|
|
351
|
+
nothing is the failure mode this whole path exists to catch.
|
|
352
|
+
|
|
353
|
+
`features.plugins=false` is **not** a substitute. It costs you your plugin
|
|
354
|
+
skills and hooks, it leaves the apps instructions in the prompt, and on an
|
|
355
|
+
install with no plugin-backed server it is never applied at all — which is
|
|
356
|
+
exactly the shape that was quietly receiving these tools before 0.4.2. Turning
|
|
357
|
+
apps off leaves `plugins` on, so plugin skills and hooks survive; what a run
|
|
358
|
+
loses is your connectors, which is the intent. The run executes on behalf of
|
|
359
|
+
whoever mentioned the agent, and your connectors are yours.
|
|
360
|
+
|
|
332
361
|
**If a server still cannot be disabled**, the run fails before Codex starts and
|
|
333
362
|
names it. Two ways out: remove that server or plugin from `~/.codex/config.toml`,
|
|
334
363
|
or give the daemon a `CODEX_HOME` of its own that holds only `auth.json` —
|
|
@@ -343,6 +372,13 @@ A dedicated `CODEX_HOME` is the cleanest answer in general: the agent inherits
|
|
|
343
372
|
your login and nothing else, your own Codex setup is untouched, and no future
|
|
344
373
|
plugin or server you install can change what a paired run can reach.
|
|
345
374
|
|
|
375
|
+
It is not, however, an answer to apps. A `CODEX_HOME` holding only `auth.json`
|
|
376
|
+
fetches your account's apps on its first run, writes them to its own cache, and
|
|
377
|
+
serves the full set from the second run onwards — the login is what carries
|
|
378
|
+
them, so a fresh directory only delays it by one run. That is why the apps
|
|
379
|
+
switch is unconditional rather than something an operator can opt out of by
|
|
380
|
+
tidying their config.
|
|
381
|
+
|
|
346
382
|
If the enumeration fails outright — an older Codex without `mcp list --json`,
|
|
347
383
|
or output the CLI doesn't recognise — the run fails before Codex starts. A
|
|
348
384
|
paired run never proceeds under `--yolo` when its MCP boundary cannot be proven.
|
package/dist/agent/codex.d.ts
CHANGED
|
@@ -191,6 +191,43 @@ export type CommandRunner = (command: string, cwd?: string) => {
|
|
|
191
191
|
* enumerate must say so rather than claim an isolation it did not apply.
|
|
192
192
|
*/
|
|
193
193
|
export declare function listMcpServers(binary: string, runner: CommandRunner, overrides?: string | string[], cwd?: string): CodexMcpServer[] | null;
|
|
194
|
+
/**
|
|
195
|
+
* The Codex feature that supplies the `codex_apps` MCP.
|
|
196
|
+
*
|
|
197
|
+
* Its own prompt text is the definition, and it is worth quoting because
|
|
198
|
+
* nothing else in the CLI says it: *"An app is equivalent to a set of MCP tools
|
|
199
|
+
* within the `codex_apps` MCP."* Apps are the operator's **connectors** —
|
|
200
|
+
* account-level, not config-level.
|
|
201
|
+
*/
|
|
202
|
+
export declare const APPS_FEATURE = "apps";
|
|
203
|
+
/**
|
|
204
|
+
* Read one feature's *effective* state, under the overrides the run will carry.
|
|
205
|
+
*
|
|
206
|
+
* This is {@link listMcpServers}'s counterpart for the thing that listing cannot
|
|
207
|
+
* see, and it exists because `codex_apps` appears in **no** MCP inventory:
|
|
208
|
+
* `codex mcp list --json` reports the operator's servers and says nothing about
|
|
209
|
+
* apps, so the entire 0.4.1 verification path is blind to 28 tools the run
|
|
210
|
+
* actually gets.
|
|
211
|
+
*
|
|
212
|
+
* `codex features list` answers it — it prints `<name> <stage> <state>` per
|
|
213
|
+
* feature and honours `-c`, so asking it under the run's own overrides turns
|
|
214
|
+
* "did the switch take" into a measurement rather than an assumption. Measured
|
|
215
|
+
* at ~0.14s with no network, so it is cheap enough to run every time.
|
|
216
|
+
*
|
|
217
|
+
* Only the one requested row is read, deliberately unlike `listMcpServers`,
|
|
218
|
+
* which fails the whole answer on a single malformed entry. There the *set* is
|
|
219
|
+
* the boundary, so an unparsed member is a hole; here the question is about one
|
|
220
|
+
* named key, and refusing to answer because some unrelated future row gained a
|
|
221
|
+
* column would break every run to protect nothing. The last whitespace-separated
|
|
222
|
+
* token is the state — the stage column is sometimes two words (`under
|
|
223
|
+
* development`), so the row is read from both ends rather than by field index.
|
|
224
|
+
*
|
|
225
|
+
* Returns `null` when the answer is unknown: the command failed (a malformed
|
|
226
|
+
* override makes `features list` exit 1 and print nothing), the feature has no
|
|
227
|
+
* row, or its state is not a boolean. A renamed or retired feature therefore
|
|
228
|
+
* reads as unknown rather than as "off", and the caller fails the run closed.
|
|
229
|
+
*/
|
|
230
|
+
export declare function featureState(binary: string, runner: CommandRunner, feature: string, overrides?: string | string[], cwd?: string): boolean | null;
|
|
194
231
|
/** Disable entries proven to work, and the servers that could not be disabled. */
|
|
195
232
|
export interface VerifiedDisable {
|
|
196
233
|
entries: string[];
|
|
@@ -217,11 +254,12 @@ export interface VerifiedDisable {
|
|
|
217
254
|
* reachable from the run, and the caller has to say so out loud rather than
|
|
218
255
|
* report an isolation it only partly achieved.
|
|
219
256
|
*
|
|
220
|
-
* `baseOverrides` are config overrides the run will also carry —
|
|
221
|
-
* {@link
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
* config the
|
|
257
|
+
* `baseOverrides` are config overrides the run will also carry —
|
|
258
|
+
* {@link APPS_DISABLED_OVERRIDE} always, and {@link PLUGINS_DISABLED_OVERRIDE}
|
|
259
|
+
* when a plugin supplies a server. They have to be present on every probe here,
|
|
260
|
+
* because "does this entry disable this server" has a different answer under a
|
|
261
|
+
* different config, and the answer that matters is the one for the config the
|
|
262
|
+
* run actually gets.
|
|
225
263
|
*/
|
|
226
264
|
export declare function disableEntriesThatLoad(binary: string, runner: CommandRunner, targets: string[], cwd?: string, baseOverrides?: string[]): VerifiedDisable;
|
|
227
265
|
/**
|
|
@@ -260,14 +298,58 @@ export declare function disableEntriesThatLoad(binary: string, runner: CommandRu
|
|
|
260
298
|
* an install whose plugins contribute no MCP servers keeps all of that.
|
|
261
299
|
*/
|
|
262
300
|
export declare const PLUGINS_DISABLED_OVERRIDE = "features.plugins=false";
|
|
301
|
+
/**
|
|
302
|
+
* The one override that keeps the operator's **apps (connectors)** out of a run.
|
|
303
|
+
*
|
|
304
|
+
* Applied to every isolated run, unconditionally, which is the whole point of
|
|
305
|
+
* it. Measured against `codex-cli 0.146.0`:
|
|
306
|
+
*
|
|
307
|
+
* - `codex_apps` is the {@link APPS_FEATURE} surface, and `apps` is a *stable*
|
|
308
|
+
* Codex feature that is **on by default**. Turning it off removes the
|
|
309
|
+
* `<apps_instructions>` block from the prompt and all 28 `mcp__codex_apps__*`
|
|
310
|
+
* tools from the run, while leaving `plugins` — and so the operator's plugin
|
|
311
|
+
* skills and hooks — switched on.
|
|
312
|
+
* - Those tools are not read-only. They include `sites_create_site`,
|
|
313
|
+
* `sites_deploy_site_version`, `sites_add_custom_domain`,
|
|
314
|
+
* `sites_update_environment_variables`, `sites_generate_siwc_bypass_token`,
|
|
315
|
+
* `plugin_management_update_app_permissions` and
|
|
316
|
+
* `plugin_management_uninstall_app`: publishing sites and rewriting app
|
|
317
|
+
* permissions on the operator's own ChatGPT account.
|
|
318
|
+
* - **Nothing in `codex mcp list --json` mentions any of it.** Apps are
|
|
319
|
+
* account-level and cached under `$CODEX_HOME/cache/codex_apps_tools`, not
|
|
320
|
+
* declared in `mcp_servers`, so the entire server-enumeration path this module
|
|
321
|
+
* is built on cannot see them. That is why this is unconditional rather than
|
|
322
|
+
* applied on evidence, as {@link PLUGINS_DISABLED_OVERRIDE} is: there is no
|
|
323
|
+
* listing to take evidence from.
|
|
324
|
+
* - It is not enough to have no plugins and no configured servers. A
|
|
325
|
+
* `CODEX_HOME` holding **only `auth.json`** — 0.4.1's own suggested remedy —
|
|
326
|
+
* fetches the account's apps on its first run, writes them to that cache, and
|
|
327
|
+
* serves all 28 tools from the second run onwards. Measured, not reasoned.
|
|
328
|
+
*
|
|
329
|
+
* `features.plugins=false` also happens to remove the tools on installs where
|
|
330
|
+
* apps arrive through the plugin pipeline, which is why 0.4.1 closed this by
|
|
331
|
+
* accident on plugin-bearing machines. It is the wrong lever regardless: it
|
|
332
|
+
* leaves `<apps_instructions>` in the prompt, it costs the operator their plugin
|
|
333
|
+
* skills and hooks, and it does nothing at all on a classic-only install —
|
|
334
|
+
* exactly the shape where 0.4.1 applies no override.
|
|
335
|
+
*/
|
|
336
|
+
export declare const APPS_DISABLED_OVERRIDE = "features.apps=false";
|
|
263
337
|
/** A verified isolation: what to pass Codex, and what could not be shut off. */
|
|
264
338
|
export interface VerifiedIsolation {
|
|
265
339
|
/** `mcp_servers` fragments, for the single {@link mcpServersOverride}. */
|
|
266
340
|
entries: string[];
|
|
267
|
-
/** Whole-config `-c` overrides the run needs on top.
|
|
341
|
+
/** Whole-config `-c` overrides the run needs on top. Never empty. */
|
|
268
342
|
configOverrides: string[];
|
|
269
343
|
/** Servers still reachable from the run. Empty is the outcome we want. */
|
|
270
344
|
failed: string[];
|
|
345
|
+
/**
|
|
346
|
+
* Why a whole-config switch could not be *proven* to have taken effect.
|
|
347
|
+
*
|
|
348
|
+
* Separate from {@link failed}, which names MCP servers and earns a remedy
|
|
349
|
+
* about `mcp_servers`. This one is not a server and has no such remedy, so it
|
|
350
|
+
* carries its own sentence. Set means the run must not start.
|
|
351
|
+
*/
|
|
352
|
+
unproven?: string;
|
|
271
353
|
}
|
|
272
354
|
/**
|
|
273
355
|
* Shut off every server the operator's install has, whatever supplies it.
|
|
@@ -281,14 +363,23 @@ export interface VerifiedIsolation {
|
|
|
281
363
|
* *measured* rather than read: list again with plugins off, and the names that
|
|
282
364
|
* vanished were the plugin's.
|
|
283
365
|
*
|
|
284
|
-
*
|
|
285
|
-
*
|
|
286
|
-
*
|
|
287
|
-
*
|
|
366
|
+
* A **third** mechanism sits underneath both and is not a server at all: the
|
|
367
|
+
* operator's apps (connectors), which reach the run as the `codex_apps` MCP and
|
|
368
|
+
* appear in no listing this module can read. {@link APPS_DISABLED_OVERRIDE} is
|
|
369
|
+
* therefore applied to every run unconditionally — there is no inventory to
|
|
370
|
+
* decide from — and every probe below carries it, so each disable is proven
|
|
371
|
+
* against the config the run is actually handed.
|
|
372
|
+
*
|
|
373
|
+
* The classic path is still tried first and, when it succeeds, returned with no
|
|
374
|
+
* *plugins* override, so an install with no plugin-backed servers keeps its
|
|
375
|
+
* plugin skills and hooks and pays the same one probe it did before.
|
|
288
376
|
*
|
|
289
377
|
* Failing to shut a server off is reported, never worked around. A plugin
|
|
290
378
|
* server that survives even `features.plugins=false` is a mechanism we do not
|
|
291
|
-
* understand yet, and a run that cannot prove the boundary must not start.
|
|
379
|
+
* understand yet, and a run that cannot prove the boundary must not start. The
|
|
380
|
+
* apps switch is held to the same standard: it is *measured* off through
|
|
381
|
+
* {@link featureState} under the final override set, because an override that
|
|
382
|
+
* silently does nothing is the failure mode this whole module exists to catch.
|
|
292
383
|
*/
|
|
293
384
|
export declare function isolateConfiguredServers(binary: string, runner: CommandRunner, targets: string[], cwd?: string): VerifiedIsolation;
|
|
294
385
|
/**
|
|
@@ -341,8 +432,9 @@ export interface CodexFlags {
|
|
|
341
432
|
*/
|
|
342
433
|
mcpEntries?: string[];
|
|
343
434
|
/**
|
|
344
|
-
* Whole-config `-c` overrides that are not `mcp_servers
|
|
345
|
-
* {@link
|
|
435
|
+
* Whole-config `-c` overrides that are not `mcp_servers`:
|
|
436
|
+
* {@link APPS_DISABLED_OVERRIDE} on every isolated run, plus
|
|
437
|
+
* {@link PLUGINS_DISABLED_OVERRIDE} when the operator has a plugin that
|
|
346
438
|
* contributes MCP servers. They precede the `mcp_servers` override for the
|
|
347
439
|
* same reason they do in the verifier: the run has to be handed the same
|
|
348
440
|
* overrides in the same order the probe certified.
|
package/dist/agent/codex.js
CHANGED
|
@@ -524,6 +524,67 @@ export function listMcpServers(binary, runner, overrides, cwd) {
|
|
|
524
524
|
return null;
|
|
525
525
|
}
|
|
526
526
|
}
|
|
527
|
+
/**
|
|
528
|
+
* The Codex feature that supplies the `codex_apps` MCP.
|
|
529
|
+
*
|
|
530
|
+
* Its own prompt text is the definition, and it is worth quoting because
|
|
531
|
+
* nothing else in the CLI says it: *"An app is equivalent to a set of MCP tools
|
|
532
|
+
* within the `codex_apps` MCP."* Apps are the operator's **connectors** —
|
|
533
|
+
* account-level, not config-level.
|
|
534
|
+
*/
|
|
535
|
+
export const APPS_FEATURE = 'apps';
|
|
536
|
+
/**
|
|
537
|
+
* Read one feature's *effective* state, under the overrides the run will carry.
|
|
538
|
+
*
|
|
539
|
+
* This is {@link listMcpServers}'s counterpart for the thing that listing cannot
|
|
540
|
+
* see, and it exists because `codex_apps` appears in **no** MCP inventory:
|
|
541
|
+
* `codex mcp list --json` reports the operator's servers and says nothing about
|
|
542
|
+
* apps, so the entire 0.4.1 verification path is blind to 28 tools the run
|
|
543
|
+
* actually gets.
|
|
544
|
+
*
|
|
545
|
+
* `codex features list` answers it — it prints `<name> <stage> <state>` per
|
|
546
|
+
* feature and honours `-c`, so asking it under the run's own overrides turns
|
|
547
|
+
* "did the switch take" into a measurement rather than an assumption. Measured
|
|
548
|
+
* at ~0.14s with no network, so it is cheap enough to run every time.
|
|
549
|
+
*
|
|
550
|
+
* Only the one requested row is read, deliberately unlike `listMcpServers`,
|
|
551
|
+
* which fails the whole answer on a single malformed entry. There the *set* is
|
|
552
|
+
* the boundary, so an unparsed member is a hole; here the question is about one
|
|
553
|
+
* named key, and refusing to answer because some unrelated future row gained a
|
|
554
|
+
* column would break every run to protect nothing. The last whitespace-separated
|
|
555
|
+
* token is the state — the stage column is sometimes two words (`under
|
|
556
|
+
* development`), so the row is read from both ends rather than by field index.
|
|
557
|
+
*
|
|
558
|
+
* Returns `null` when the answer is unknown: the command failed (a malformed
|
|
559
|
+
* override makes `features list` exit 1 and print nothing), the feature has no
|
|
560
|
+
* row, or its state is not a boolean. A renamed or retired feature therefore
|
|
561
|
+
* reads as unknown rather than as "off", and the caller fails the run closed.
|
|
562
|
+
*/
|
|
563
|
+
export function featureState(binary, runner, feature, overrides, cwd) {
|
|
564
|
+
const list = overrides === undefined ? [] : typeof overrides === 'string' ? [overrides] : overrides;
|
|
565
|
+
const flags = list.map((value) => ` -c ${shellQuote(value, process.platform)}`).join('');
|
|
566
|
+
let result;
|
|
567
|
+
try {
|
|
568
|
+
result = runner(`${binary} features list${flags}`, cwd);
|
|
569
|
+
}
|
|
570
|
+
catch {
|
|
571
|
+
return null;
|
|
572
|
+
}
|
|
573
|
+
if (result.status !== 0)
|
|
574
|
+
return null;
|
|
575
|
+
for (const line of result.stdout.split('\n')) {
|
|
576
|
+
const words = line.trim().split(/\s+/);
|
|
577
|
+
if (words.length < 2 || words[0] !== feature)
|
|
578
|
+
continue;
|
|
579
|
+
const state = words[words.length - 1];
|
|
580
|
+
if (state === 'true')
|
|
581
|
+
return true;
|
|
582
|
+
if (state === 'false')
|
|
583
|
+
return false;
|
|
584
|
+
return null;
|
|
585
|
+
}
|
|
586
|
+
return null;
|
|
587
|
+
}
|
|
527
588
|
/**
|
|
528
589
|
* Disable entries, checked against the binary before they are used.
|
|
529
590
|
*
|
|
@@ -544,11 +605,12 @@ export function listMcpServers(binary, runner, overrides, cwd) {
|
|
|
544
605
|
* reachable from the run, and the caller has to say so out loud rather than
|
|
545
606
|
* report an isolation it only partly achieved.
|
|
546
607
|
*
|
|
547
|
-
* `baseOverrides` are config overrides the run will also carry —
|
|
548
|
-
* {@link
|
|
549
|
-
*
|
|
550
|
-
*
|
|
551
|
-
* config the
|
|
608
|
+
* `baseOverrides` are config overrides the run will also carry —
|
|
609
|
+
* {@link APPS_DISABLED_OVERRIDE} always, and {@link PLUGINS_DISABLED_OVERRIDE}
|
|
610
|
+
* when a plugin supplies a server. They have to be present on every probe here,
|
|
611
|
+
* because "does this entry disable this server" has a different answer under a
|
|
612
|
+
* different config, and the answer that matters is the one for the config the
|
|
613
|
+
* run actually gets.
|
|
552
614
|
*/
|
|
553
615
|
export function disableEntriesThatLoad(binary, runner, targets, cwd, baseOverrides = []) {
|
|
554
616
|
if (targets.length === 0)
|
|
@@ -618,6 +680,42 @@ export function disableEntriesThatLoad(binary, runner, targets, cwd, baseOverrid
|
|
|
618
680
|
* an install whose plugins contribute no MCP servers keeps all of that.
|
|
619
681
|
*/
|
|
620
682
|
export const PLUGINS_DISABLED_OVERRIDE = 'features.plugins=false';
|
|
683
|
+
/**
|
|
684
|
+
* The one override that keeps the operator's **apps (connectors)** out of a run.
|
|
685
|
+
*
|
|
686
|
+
* Applied to every isolated run, unconditionally, which is the whole point of
|
|
687
|
+
* it. Measured against `codex-cli 0.146.0`:
|
|
688
|
+
*
|
|
689
|
+
* - `codex_apps` is the {@link APPS_FEATURE} surface, and `apps` is a *stable*
|
|
690
|
+
* Codex feature that is **on by default**. Turning it off removes the
|
|
691
|
+
* `<apps_instructions>` block from the prompt and all 28 `mcp__codex_apps__*`
|
|
692
|
+
* tools from the run, while leaving `plugins` — and so the operator's plugin
|
|
693
|
+
* skills and hooks — switched on.
|
|
694
|
+
* - Those tools are not read-only. They include `sites_create_site`,
|
|
695
|
+
* `sites_deploy_site_version`, `sites_add_custom_domain`,
|
|
696
|
+
* `sites_update_environment_variables`, `sites_generate_siwc_bypass_token`,
|
|
697
|
+
* `plugin_management_update_app_permissions` and
|
|
698
|
+
* `plugin_management_uninstall_app`: publishing sites and rewriting app
|
|
699
|
+
* permissions on the operator's own ChatGPT account.
|
|
700
|
+
* - **Nothing in `codex mcp list --json` mentions any of it.** Apps are
|
|
701
|
+
* account-level and cached under `$CODEX_HOME/cache/codex_apps_tools`, not
|
|
702
|
+
* declared in `mcp_servers`, so the entire server-enumeration path this module
|
|
703
|
+
* is built on cannot see them. That is why this is unconditional rather than
|
|
704
|
+
* applied on evidence, as {@link PLUGINS_DISABLED_OVERRIDE} is: there is no
|
|
705
|
+
* listing to take evidence from.
|
|
706
|
+
* - It is not enough to have no plugins and no configured servers. A
|
|
707
|
+
* `CODEX_HOME` holding **only `auth.json`** — 0.4.1's own suggested remedy —
|
|
708
|
+
* fetches the account's apps on its first run, writes them to that cache, and
|
|
709
|
+
* serves all 28 tools from the second run onwards. Measured, not reasoned.
|
|
710
|
+
*
|
|
711
|
+
* `features.plugins=false` also happens to remove the tools on installs where
|
|
712
|
+
* apps arrive through the plugin pipeline, which is why 0.4.1 closed this by
|
|
713
|
+
* accident on plugin-bearing machines. It is the wrong lever regardless: it
|
|
714
|
+
* leaves `<apps_instructions>` in the prompt, it costs the operator their plugin
|
|
715
|
+
* skills and hooks, and it does nothing at all on a classic-only install —
|
|
716
|
+
* exactly the shape where 0.4.1 applies no override.
|
|
717
|
+
*/
|
|
718
|
+
export const APPS_DISABLED_OVERRIDE = `features.${APPS_FEATURE}=false`;
|
|
621
719
|
/**
|
|
622
720
|
* Shut off every server the operator's install has, whatever supplies it.
|
|
623
721
|
*
|
|
@@ -630,42 +728,64 @@ export const PLUGINS_DISABLED_OVERRIDE = 'features.plugins=false';
|
|
|
630
728
|
* *measured* rather than read: list again with plugins off, and the names that
|
|
631
729
|
* vanished were the plugin's.
|
|
632
730
|
*
|
|
633
|
-
*
|
|
634
|
-
*
|
|
635
|
-
*
|
|
636
|
-
*
|
|
731
|
+
* A **third** mechanism sits underneath both and is not a server at all: the
|
|
732
|
+
* operator's apps (connectors), which reach the run as the `codex_apps` MCP and
|
|
733
|
+
* appear in no listing this module can read. {@link APPS_DISABLED_OVERRIDE} is
|
|
734
|
+
* therefore applied to every run unconditionally — there is no inventory to
|
|
735
|
+
* decide from — and every probe below carries it, so each disable is proven
|
|
736
|
+
* against the config the run is actually handed.
|
|
737
|
+
*
|
|
738
|
+
* The classic path is still tried first and, when it succeeds, returned with no
|
|
739
|
+
* *plugins* override, so an install with no plugin-backed servers keeps its
|
|
740
|
+
* plugin skills and hooks and pays the same one probe it did before.
|
|
637
741
|
*
|
|
638
742
|
* Failing to shut a server off is reported, never worked around. A plugin
|
|
639
743
|
* server that survives even `features.plugins=false` is a mechanism we do not
|
|
640
|
-
* understand yet, and a run that cannot prove the boundary must not start.
|
|
744
|
+
* understand yet, and a run that cannot prove the boundary must not start. The
|
|
745
|
+
* apps switch is held to the same standard: it is *measured* off through
|
|
746
|
+
* {@link featureState} under the final override set, because an override that
|
|
747
|
+
* silently does nothing is the failure mode this whole module exists to catch.
|
|
641
748
|
*/
|
|
642
749
|
export function isolateConfiguredServers(binary, runner, targets, cwd) {
|
|
643
|
-
|
|
750
|
+
// Present on every probe from here down, and on the run itself.
|
|
751
|
+
const base = [APPS_DISABLED_OVERRIDE];
|
|
752
|
+
const prove = (isolation) => {
|
|
753
|
+
if (featureState(binary, runner, APPS_FEATURE, isolation.configOverrides, cwd) === false) {
|
|
754
|
+
return isolation;
|
|
755
|
+
}
|
|
756
|
+
return {
|
|
757
|
+
...isolation,
|
|
758
|
+
unproven: `Codex would not confirm its "${APPS_FEATURE}" feature is off, so the operator's apps ` +
|
|
759
|
+
'(connectors) and their tools cannot be kept out of this run',
|
|
760
|
+
};
|
|
761
|
+
};
|
|
762
|
+
const direct = disableEntriesThatLoad(binary, runner, targets, cwd, base);
|
|
644
763
|
if (direct.failed.length === 0)
|
|
645
|
-
return { ...direct, configOverrides:
|
|
764
|
+
return prove({ ...direct, configOverrides: base });
|
|
646
765
|
// Something resisted. Ask whether turning the plugin system off accounts for
|
|
647
766
|
// it, rather than assuming the survivors are plugin-backed because they look
|
|
648
767
|
// like it.
|
|
649
|
-
const withPluginsOff = listMcpServers(binary, runner, PLUGINS_DISABLED_OVERRIDE, cwd);
|
|
768
|
+
const withPluginsOff = listMcpServers(binary, runner, [...base, PLUGINS_DISABLED_OVERRIDE], cwd);
|
|
650
769
|
// The override does not load, so it disables nothing and we know nothing.
|
|
651
770
|
if (withPluginsOff === null)
|
|
652
|
-
return { ...direct, configOverrides:
|
|
771
|
+
return prove({ ...direct, configOverrides: base });
|
|
653
772
|
const remaining = new Set(withPluginsOff.map((server) => server.name));
|
|
654
773
|
const removedByPluginsOff = direct.failed.filter((name) => !remaining.has(name));
|
|
655
774
|
// Plugins were not the problem. Report what the classic path found, so the
|
|
656
775
|
// operator is told about the real survivor instead of a plugin red herring.
|
|
657
776
|
if (removedByPluginsOff.length === 0)
|
|
658
|
-
return { ...direct, configOverrides:
|
|
777
|
+
return prove({ ...direct, configOverrides: base });
|
|
659
778
|
// Re-verify the classic disables *under* the plugins-off override. They were
|
|
660
779
|
// proven against a different config, and a proof about a config the run does
|
|
661
780
|
// not get is not a proof.
|
|
662
781
|
const classic = targets.filter((name) => remaining.has(name));
|
|
663
|
-
const
|
|
664
|
-
|
|
782
|
+
const configOverrides = [...base, PLUGINS_DISABLED_OVERRIDE];
|
|
783
|
+
const verified = disableEntriesThatLoad(binary, runner, classic, cwd, configOverrides);
|
|
784
|
+
return prove({
|
|
665
785
|
entries: verified.entries,
|
|
666
|
-
configOverrides
|
|
786
|
+
configOverrides,
|
|
667
787
|
failed: verified.failed,
|
|
668
|
-
};
|
|
788
|
+
});
|
|
669
789
|
}
|
|
670
790
|
/**
|
|
671
791
|
* The `codex` binary out of the host's `--exec` command.
|
package/dist/agent/run.js
CHANGED
|
@@ -27,7 +27,7 @@ import { spawnSync } from 'node:child_process';
|
|
|
27
27
|
import WebSocket from 'ws';
|
|
28
28
|
import { completeRun, postReply } from './api.js';
|
|
29
29
|
import { MAX_SALVAGE_CHARS, claudeCommand, isClaudeExec, looksLikeResumeFailure, readClaudeStream, writeMcpConfig, } from './claude.js';
|
|
30
|
-
import { MCP_API_KEY_ENV_VAR, PLUGINS_DISABLED_OVERRIDE, codexBinary, codexCommand, codexMcpInventoryFlag, codexProfileName, codexShellSyntax, extraMcpEntries, isCodexExec, isolateConfiguredServers, listMcpServers, mcpServersOverride, prohostMcpEntry, looksLikeCodexResumeFailure, parseCodexOutput, } from './codex.js';
|
|
30
|
+
import { APPS_FEATURE, MCP_API_KEY_ENV_VAR, PLUGINS_DISABLED_OVERRIDE, codexBinary, codexCommand, codexMcpInventoryFlag, codexProfileName, codexShellSyntax, extraMcpEntries, isCodexExec, isolateConfiguredServers, listMcpServers, mcpServersOverride, prohostMcpEntry, looksLikeCodexResumeFailure, parseCodexOutput, } from './codex.js';
|
|
31
31
|
import { EXTRA_MCP_FILENAME, loadExtraMcpServers } from './extras.js';
|
|
32
32
|
import { MCP_SERVER_NAME, MCP_TOOL_PATTERN } from './mcp.js';
|
|
33
33
|
import { EVENT_AGENT_RUN_REQUESTED, EVENT_MENTION_CREATED, EVENT_MESSAGE_TEAM_CHAT, RUN_ERROR_CANCELLED_BY_USER, eventData, heartbeatPathFor, parseRunRequest, } from './contract.js';
|
|
@@ -329,7 +329,15 @@ function codexMcpEntries(options, extraServers, log, workdir) {
|
|
|
329
329
|
if (acceptedExtraEntries.length === 0)
|
|
330
330
|
acceptedExtraNames.clear();
|
|
331
331
|
const targets = [...configuredNames].filter((name) => !acceptedExtraNames.has(name));
|
|
332
|
-
const { entries: disabled, configOverrides, failed } = isolateConfiguredServers(binary, probe, targets, workdir);
|
|
332
|
+
const { entries: disabled, configOverrides, failed, unproven } = isolateConfiguredServers(binary, probe, targets, workdir);
|
|
333
|
+
if (unproven) {
|
|
334
|
+
// Not an `mcp_servers` problem, so it does not get the `mcp_servers`
|
|
335
|
+
// remedy. Upgrading Codex is the honest advice: the switch is read back
|
|
336
|
+
// from `codex features list`, so this fires when that command, the feature,
|
|
337
|
+
// or its name is not what this harness was measured against.
|
|
338
|
+
return fail(`${unproven} — upgrade Codex, or run the daemon with a Codex build that reports ` +
|
|
339
|
+
`"${APPS_FEATURE}" in \`codex features list\``);
|
|
340
|
+
}
|
|
333
341
|
if (failed.length > 0) {
|
|
334
342
|
// The remedy belongs in the message. This string is echoed into the thread
|
|
335
343
|
// the teammate is waiting in, and "could not be disabled" on its own leaves
|
|
@@ -341,6 +349,11 @@ function codexMcpEntries(options, extraServers, log, workdir) {
|
|
|
341
349
|
if (targets.length > 0) {
|
|
342
350
|
log(`${timestamp()} ⚙ your own Codex MCP servers are disabled for agent runs: ${targets.join(', ')}`);
|
|
343
351
|
}
|
|
352
|
+
// Unconditional, so it is stated every run rather than only when something
|
|
353
|
+
// was found: the operator's connectors are account-level and invisible to
|
|
354
|
+
// `codex mcp list`, and "nothing was listed" is exactly the wrong thing for
|
|
355
|
+
// them to conclude from silence here.
|
|
356
|
+
log(`${timestamp()} ⚙ Codex apps (connectors) are switched off for agent runs`);
|
|
344
357
|
if (configOverrides.includes(PLUGINS_DISABLED_OVERRIDE)) {
|
|
345
358
|
log(`${timestamp()} ⚙ Codex plugins are switched off for agent runs — a plugin supplies an MCP ` +
|
|
346
359
|
'server that cannot be disabled on its own');
|
package/dist/version.d.ts
CHANGED
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
* `package.json`, so a release bump that forgets this file fails the suite
|
|
8
8
|
* instead of shipping a `User-Agent` that lies about which build is calling.
|
|
9
9
|
*/
|
|
10
|
-
export declare const CLI_VERSION = "0.4.
|
|
10
|
+
export declare const CLI_VERSION = "0.4.2";
|
|
11
11
|
/** Sent on every HTTP request the CLI makes back into ProhostAI. */
|
|
12
|
-
export declare const USER_AGENT = "prohost-cli/0.4.
|
|
12
|
+
export declare const USER_AGENT = "prohost-cli/0.4.2";
|
package/dist/version.js
CHANGED
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
* `package.json`, so a release bump that forgets this file fails the suite
|
|
8
8
|
* instead of shipping a `User-Agent` that lies about which build is calling.
|
|
9
9
|
*/
|
|
10
|
-
export const CLI_VERSION = '0.4.
|
|
10
|
+
export const CLI_VERSION = '0.4.2';
|
|
11
11
|
/** Sent on every HTTP request the CLI makes back into ProhostAI. */
|
|
12
12
|
export const USER_AGENT = `prohost-cli/${CLI_VERSION}`;
|