@ours.network/fleet 1.2.0-nightly.43 → 1.2.0-nightly.45

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/dist/ops.js CHANGED
@@ -5,6 +5,7 @@ import { agentDir, watchdogsRoot } from './paths.js';
5
5
  import { findRole } from './config.js';
6
6
  import { getAdapter } from './harness/registry.js';
7
7
  import { generateBriefing } from './briefing.js';
8
+ import { managedCliBriefing } from './managed-cli.js';
8
9
  import { resetRestartLedger } from './runner.js';
9
10
  import { archiveTempState, stopTempSupervisor, tempSupervisorLiveness, } from './temp-lifecycle.js';
10
11
  import { realExec } from './exec.js';
@@ -28,7 +29,7 @@ export function applyRole(role, opts = {}) {
28
29
  // brought up from so the supervised process can reload the SAME file instead of
29
30
  // silently falling back to the default ~/fleet.yaml. Temp roles snapshot their
30
31
  // whole resolved role into role.yaml instead and don't need this.
31
- if (!opts.temp)
32
+ if (!opts.temp || opts.configPath)
32
33
  writeFileSync(join(dir, '.config-path'), (opts.configPath ?? '') + '\n');
33
34
  writeFileSync(join(dir, '.identity'), role.identity + '\n');
34
35
  if (role.cwd)
@@ -43,6 +44,7 @@ export function applyRole(role, opts = {}) {
43
44
  routinesPath: join(dir, 'ROUTINES.md'), briefingBody,
44
45
  identityGuarantee: opts.identityGuarantee,
45
46
  temporaryIdentity: opts.temp === true,
47
+ managedCli: managedCliBriefing(role, opts.configPath, opts.temp === true),
46
48
  }));
47
49
  if (opts.fresh)
48
50
  for (const f of ['.booted', '.session-id', '.exit-status'])
@@ -103,6 +103,7 @@ export function resolvedRolePlan(role, manifestDir = dirname(role.sourceFile)) {
103
103
  isolation: role.isolation ?? null,
104
104
  worklog: role.worklog ?? null,
105
105
  authProxy: role.auth_proxy ?? null,
106
+ managedCli: role.managed_cli ?? [],
106
107
  oversee: role.oversee ?? [],
107
108
  harnessOptions: redactSensitive(role.harness_options ?? null),
108
109
  env: {
package/dist/runner.js CHANGED
@@ -2,6 +2,7 @@ import { createLayoutControl } from './rooms-tasks/layout-control.js';
2
2
  import { TemporaryChatIdle } from './temp-idle.js';
3
3
  import { prepareManagedAgent, releaseManagedAgent } from './agent-ours/service.js';
4
4
  import { prepareManagedHarness } from './agent-ours/harness.js';
5
+ import { prepareManagedCliLaunch } from './managed-cli.js';
5
6
  import { existsSync, readFileSync, writeFileSync, rmSync, mkdirSync, realpathSync } from 'node:fs';
6
7
  import { join } from 'node:path';
7
8
  import { fileURLToPath } from 'node:url';
@@ -522,7 +523,14 @@ export async function runOnce(name, opts = {}, partialDeps = {}) {
522
523
  writeFileSync(bootedFile, `${new Date(deps.now()).toISOString()} ${mode}\n`);
523
524
  const runCwd = role.cwd && existsSync(role.cwd) ? role.cwd : dir;
524
525
  role = { ...role, monitor: { ...role.monitor, mode: 'fleet' } };
525
- const prep = await adapter.prepareSession(role, { stateDir: dir, runCwd });
526
+ // Native policy for Fleet commands run from the harness command sandbox. This
527
+ // is the same step for configured, spawned and task-room agents alike.
528
+ const prep = prepareManagedCliLaunch(role, {
529
+ // A temporary agent has no config path threaded through its detached
530
+ // supervisor; spawn records the one it was created from beside its snapshot.
531
+ stateDir: dir, runCwd, configPath: configPath ?? resolveConfigPath(dir), temp,
532
+ prep: await adapter.prepareSession(role, { stateDir: dir, runCwd }), log: deps.log,
533
+ });
526
534
  const sessionBackend = role.session ?? 'acp';
527
535
  const sessionLabel = sessionBackend === 'acp' ? 'ACP' : 'Codex app-server';
528
536
  let launch = adapter.agentSession.prepareLaunch(role, prep);
@@ -567,7 +567,13 @@ export async function controlRequest(stateDir, request, timeoutMs = 120_000) {
567
567
  socket.once('error', error => {
568
568
  clearTimeout(timer);
569
569
  const code = error.code;
570
- reject(new SessionControlError(code === 'ENOENT' || code === 'ECONNREFUSED' ? 'control-unavailable' : 'backend', `role control socket: ${error.message}`));
570
+ const permissionHint = code === 'EPERM' || code === 'EACCES'
571
+ ? `; the operating system denied access before '${request.command}' reached the supervisor. `
572
+ + 'Check socket permissions and the command execution sandbox. '
573
+ + 'An existing socket does not prove this process can connect; do not bypass Fleet audit. '
574
+ + 'For managed workspace sessions, see docs/validation/managed-cli-permissions.md.'
575
+ : '';
576
+ reject(new SessionControlError(code === 'ENOENT' || code === 'ECONNREFUSED' ? 'control-unavailable' : 'backend', `role control socket: ${error.message}${permissionHint}`));
571
577
  });
572
578
  socket.on('data', chunk => {
573
579
  buffer += chunk;
package/dist/spawn.js CHANGED
@@ -358,7 +358,7 @@ async function spawnTempInner(o, preparedRole, binPath, launch, tx, onStage) {
358
358
  if (role.roomMemberStartup)
359
359
  role.roomMemberStartup = { ...role.roomMemberStartup, invite: '' };
360
360
  onStage?.('writing_role');
361
- const dir = applyRole(role, { temp: true, identityGuarantee: 'unverified' });
361
+ const dir = applyRole(role, { temp: true, identityGuarantee: 'unverified', configPath: o.configPath });
362
362
  const provenance = buildProvenance({
363
363
  role: o.name, lifetime: 'temporary', fleetVersion: VERSION,
364
364
  settings: provenanceSettings(o, cfg.defaults, preparedRole.temporaryLoops),
@@ -0,0 +1,416 @@
1
+ # Managed Fleet CLI from Codex and Claude Code workspace sandboxes
2
+
3
+ > **Use the generated setup.** Since `managed-cli.setup-v1`, Fleet prepares the
4
+ > native policy for the packaged task workflow itself. The hand-written rules
5
+ > further down remain as background and for operations outside that workflow
6
+ > (for example `room delete`).
7
+
8
+ ## Fleet-generated setup (issue #233)
9
+
10
+ Declare the workflow on the Agent, or let Fleet add the one key for you:
11
+
12
+ ```sh
13
+ ours-fleet managed-cli setup --enable FleetCoordinator # adds managed_cli: [task-workflow]
14
+ ours-fleet managed-cli setup # generate / reconcile, starts nothing
15
+ ours-fleet managed-cli status # compare only, exit 1 when not current
16
+ ```
17
+
18
+ The declaration is explicit configuration. It is never inferred from a role or
19
+ display name, and `--enable` changes no permission. The same preparation runs at
20
+ every agent start (`up`, `restart`, `spawn`, task-room agents), so newly created
21
+ agents need no separate step. `ours-install` runs `managed-cli setup` from the
22
+ exact Fleet it installed after `init` and on update.
23
+
24
+ An agent invokes a prepared command through the pinned entry form printed in its
25
+ briefing:
26
+
27
+ ```sh
28
+ /abs/node /abs/fleet/dist/cli.js --managed-configuration /abs/fleet.yaml task create --title "..." --backlog --no-room
29
+ ```
30
+
31
+ ### What is prepared
32
+
33
+ | Prepared (runs outside the command sandbox) | Not prepared (stays sandboxed) |
34
+ | --- | --- |
35
+ | `task create`, `task start`, `task finish`, `task block`, `task unblock`, `task review`, `task list`, `task show` | `task cancel`, `task delete` |
36
+ | `room show`, `room members` | `room create`, `room delete`, `room close` |
37
+ | `template list`, `template show`, `template validate`, `config`, `docs` | `spawn`, `ours tools`, `ours call`, `status`, `peek`, `send` |
38
+ | `--help`, `task --help`, `room --help`, `template --help` | service administration, identity and contact commands, oversight |
39
+
40
+ `task start` and `task finish` provision and retire rooms and agents. That is
41
+ real authority, and it is disclosed by `setup`, `status` and the installer.
42
+
43
+ ### Actual invocation boundary
44
+
45
+ - The native rule fixes four things: the Node executable, this Fleet CLI, the
46
+ pinned configuration and the command words. It is an argv **prefix** and admits
47
+ every trailing option and argument. It is not argument validation, target
48
+ authorization or per-agent isolation.
49
+ - A later `-c`/`--configuration` naming another file is refused by the Fleet CLI
50
+ after the process has already started outside the sandbox and been audited.
51
+ That is Fleet runtime validation, not a native policy denial.
52
+ - The pinned form requires a managed session. Outside one, where no supervisor
53
+ would audit it, the CLI refuses it. Commands outside the inventory are refused
54
+ by the CLI even if a hand-written rule would admit them.
55
+ - The supervisor audit, CLI validation, confirmations, SDK credential checks and
56
+ any outer container or host sandbox are unchanged. There is no blanket
57
+ Node/Bash/Fleet grant, no sandbox is disabled, and no new transport exists.
58
+ - Compound (`&&`, `;`), piped, redirected, `$(...)`, backslash-escaped and
59
+ `VAR=value`-prefixed command lines do not match and stay sandboxed.
60
+
61
+ ### Quoting, measured natively
62
+
63
+ Measured with real Codex 0.160.0 and Claude Code 2.1.289 on Linux:
64
+
65
+ | Spelling | Codex | Claude |
66
+ | --- | --- | --- |
67
+ | Single-quoted CLI / configuration path or option value containing spaces | matches | matches |
68
+ | Double-quoted later token | matches | does not match |
69
+ | Quoted **executable** token | never matches | never matches |
70
+ | Unquoted symlinked executable | matches | matches |
71
+
72
+ Fleet therefore spells a CLI or configuration path containing spaces in single
73
+ quotes (Codex >= 0.160.0 required; older or unreadable versions are reported as
74
+ unsupported for such paths), and requires the Node executable at a path needing
75
+ no quoting. A path containing anything but letters, digits, spaces and
76
+ `_@%+=:,./-` (so no quotes, backslashes, `*` or other pattern characters, which
77
+ Claude's entries would not treat literally), or one that is or resolves
78
+ inside the agent's workspace, is reported as unsupported rather than widened.
79
+
80
+ ### What is written, and ownership
81
+
82
+ - **Codex**: `<workspace>/.codex/rules/ours-fleet-<id>.rules`, one file per Fleet
83
+ configuration, carrying a Fleet marker header. It applies to every trusted
84
+ Codex session in that workspace, not to one identity, and Codex must already
85
+ trust the workspace: Fleet reports missing trust and never changes it. A file
86
+ shared by several agents is held in `~/.ours-fleet/managed-cli/registry.json`
87
+ and removed only when its last holder is gone. Files without the Fleet marker,
88
+ including a hand-written `ours-fleet.rules`, are never modified; one occupying
89
+ the generated name is reported as a conflict.
90
+ - **Claude**: `permissions.allow` and `sandbox.excludedCommands` entries in the
91
+ agent's own Fleet settings overlay, delivered to the bundled ACP adapter. The
92
+ operator's Claude settings are not modified. Fleet never sets
93
+ `sandbox.enabled`; if no readable settings file enables the OS sandbox, or a
94
+ `deny` rule would override the entries, `status` and `doctor` say so.
95
+ - Setup is idempotent. Changed Node/CLI/configuration paths rewrite the Fleet
96
+ entries; entries for agents or configurations that no longer exist are removed
97
+ and listed.
98
+
99
+ ### Diagnostics
100
+
101
+ `ours-fleet doctor` and `managed-cli status` report three separate facts:
102
+
103
+ | Row | Source | Meaning |
104
+ | --- | --- | --- |
105
+ | setup | generated files compared with this installation | static configuration only |
106
+ | session | the role's launch record | whether the last start loaded the current policy, or a restart is required |
107
+ | observed | the supervisor audit ledger | which pinned forms actually completed since that start |
108
+
109
+ A prepared setup is not evidence of supervisor access. An observed `--help`
110
+ proves only its own audited path; lifecycle forms that were never observed are
111
+ listed as such. `task create --help` is reported as `task create --help`, a help
112
+ call, not as `task create`. Rows from before the current launch are reported as
113
+ historical. The ledger stores the pinned configuration as a fingerprint, never
114
+ as its path; a row pinned to another configuration, or to none that can be told,
115
+ is counted separately and is not evidence for this policy. Rows whose content
116
+ was erased with their task or room keep what they prove.
117
+
118
+ A launch also gives up what the role held before: opting out, losing support or
119
+ moving to another workspace or configuration removes that role's Codex rules at
120
+ the next start, without touching a file another agent still holds.
121
+
122
+ ### Unsupported combinations
123
+
124
+ Reported, with the reason, and left exactly as sandboxed as before: Windows and
125
+ other platforms; Hermes and other harnesses; custom ACP or app-server session
126
+ commands; roles declaring `isolation:`; unspellable paths; a Node path needing
127
+ quotes; Codex older than 0.160.0 with quoted paths; and any pinned file the
128
+ agent could replace — inside its workspace or a `harness_options.add_dirs`
129
+ directory, lexically or through a symlink. Codex roles with
130
+ `harness_options.config` or `harness_options.profile` are unsupported too:
131
+ those change the native sandbox (for example extra writable roots) in ways Fleet
132
+ does not inspect. Native user settings Fleet cannot read are outside this check.
133
+
134
+ ### Qualification
135
+
136
+ `test/managed-cli-workflow.integration.mjs` runs real Codex / Claude Code through
137
+ Fleet's own adapters and launch preparation against a real supervisor control
138
+ server and audit ledger. A scripted local provider only requests commands; no
139
+ external model, account, production identity or room is used.
140
+
141
+ ```sh
142
+ FLEET_TEST_HARNESS=codex FLEET_CODEX_BIN=/absolute/codex FLEET_TEST_SESSION=codex-app-server \
143
+ FLEET_TEST_TMP_PREFIX=/absolute/private-test-parent/fleet-mc- \
144
+ node test/managed-cli-workflow.integration.mjs
145
+ ```
146
+
147
+ Use `FLEET_TEST_SESSION=acp` for bundled Codex ACP, and
148
+ `FLEET_TEST_HARNESS=claude FLEET_CLAUDE_BIN=/absolute/claude` for bundled Claude
149
+ ACP. `FLEET_TEST_QUOTED=1` installs the CLI and configuration under paths
150
+ containing spaces. `FLEET_TEST_CLAUDE_SANDBOX=0` checks the diagnostics when the
151
+ operator has not enabled Claude's sandbox. `FLEET_TEST_NESTED_SANDBOX=1` is for
152
+ unprivileged containers only. `FLEET_TEST_EVIDENCE=/file.json` records every
153
+ command, exit code and output.
154
+
155
+ Each run checks: unpinned `--help` denied at the socket; an unrelated write
156
+ outside the workspace still denied by the OS; pinned help; `task create` with
157
+ quoted variable options, `task list|show|block|unblock`, template and plan
158
+ inspection completing with audit rows; `task review|start|finish` and
159
+ `room show|members` reaching the supervisor and Fleet validation (their
160
+ successful run is the lifecycle fixture below); `template show|validate` and
161
+ `docs`; a late
162
+ `--configuration` refused by Fleet; unprepared commands, a missing or different
163
+ pin, preload injection, chaining and redirection staying sandboxed; and `status`
164
+ listing exactly the forms the audit ledger observed.
165
+
166
+ `test/managed-cli-lifecycle.integration.mjs` is the full stack: the real role
167
+ runner (`ours-fleet _run`) launches the Coordinator, with a real local ours
168
+ daemon and Cowork service (`FLEET_COWORK_CLI=/abs/cowork/dist/cli.js`). From
169
+ inside the command sandbox the Coordinator's session creates a task, starts it —
170
+ a Cowork room is provisioned and a room member agent is really spawned through
171
+ the supervisor — runs `task show`, `room show`, `room members`, `task block`,
172
+ `task unblock`, `task review` and `task finish`, which retires the member and
173
+ the room. Every command is typed in the pinned form and must have a successful
174
+ audit row; the task must end `done`. `FLEET_TEST_HARNESS=claude` puts the
175
+ Coordinator on bundled Claude ACP with its OS sandbox enabled (the member stays
176
+ on Codex). Only the model provider is scripted; the daemon runs without a broker.
177
+
178
+ Two outcomes of that run are Fleet's existing lifecycle behaviour, not policy,
179
+ and are recorded rather than hidden: the first `task start` can answer
180
+ "readiness is unknown" while the member's session is still starting, and the
181
+ first `task finish` can report that the member's live state disappeared while it
182
+ is still stopping. In both cases the task is already durably in the right state
183
+ and re-running the same command, as its message says, succeeds.
184
+
185
+ Linux x86_64 host (kernel 7.0, Node 22.23.1, Codex 0.160.0, Claude Code 2.1.289):
186
+
187
+ | Harness / session | Plain paths | Paths with spaces |
188
+ | --- | --- | --- |
189
+ | Codex native app-server | PASS | PASS |
190
+ | Bundled Codex ACP | PASS | PASS |
191
+ | Bundled Claude ACP, OS sandbox enabled | PASS | PASS |
192
+ | Bundled Claude ACP, OS sandbox not enabled (diagnostic) | PASS | not run |
193
+
194
+ | Full-stack lifecycle (real runner, room, spawned member) | Result |
195
+ | --- | --- |
196
+ | Codex native app-server Coordinator, Codex native member | PASS |
197
+ | Bundled Codex ACP Coordinator, Codex ACP member | PASS |
198
+ | Bundled Claude ACP Coordinator (OS sandbox enabled), Codex native member | PASS |
199
+
200
+ Across repeated runs the re-runs described above occurred zero or one time per
201
+ command; each run prints how many. The spawned member's Agent Template declares
202
+ `managed_cli` itself, and the run asserts what that member's own launch
203
+ prepared: a Codex native member gets its own record, rules in its own workspace
204
+ and a temporary holder; a Codex ACP member with `approval: allow` has no command
205
+ sandbox, so its launch records `not-required` and generates nothing. After
206
+ `task finish` the run asserts that the member's live state, Fleet's room record
207
+ and the Cowork room are gone, and that the member's rules were removed.
208
+
209
+ Not qualified, and not claimed:
210
+
211
+ - **macOS.** The generated setup has not been run there. `managed-cli status`
212
+ discloses this on macOS. The mechanisms are the ones the hand-written policy
213
+ below used on macOS, but that is not a run of this matrix.
214
+ - **Service-managed supervisors and a real model.** The lifecycle run starts
215
+ the runner directly (`OURS_FLEET_SUPERVISOR=none`), not through systemd or
216
+ launchd, uses a scripted provider, attaches no owner to the room and has no
217
+ broker. The spawned member only starts and stops; it does no work.
218
+ - Paths with spaces in the full-stack lifecycle run (covered by the matrix
219
+ above), Claude standalone, Hermes, Windows and isolated roles.
220
+
221
+ A managed Fleet CLI invocation sends `fleet_audit_begin` to the supervisor's Unix
222
+ socket before parsing commands, including `--help`. A socket that exists and is
223
+ owned by the current user can still return `connect EPERM` from a restricted
224
+ command sandbox. This is not evidence that the supervisor is down or Fleet needs
225
+ reinstallation. Check filesystem permissions too: `EACCES`/`EPERM` alone does not
226
+ identify which policy denied access.
227
+
228
+ ## Background: hand-written native execution rules
229
+
230
+ Keep the role's `approval: auto`, `filesystem: workspace`, and `unattended: deny`.
231
+ For an operator authorized to manage rooms, explicitly approve the necessary CLI
232
+ operations using Codex's standard execution rules. A matching operation executes
233
+ outside Codex's command sandbox, retaining the normal CLI, supervisor audit,
234
+ configuration, credentials, and confirmation checks. Other shell commands remain
235
+ sandboxed. This does not override an outer container or host sandbox.
236
+
237
+ In the **trusted workspace** create `.codex/rules/ours-fleet.rules`, substituting
238
+ absolute paths to the installed Node binary, installed Fleet CLI, and approved
239
+ configuration. Example for an operator allowed to delete rooms in this Fleet:
240
+
241
+ ```python
242
+ prefix_rule(
243
+ pattern=["/opt/node/bin/node", "/opt/fleet/dist/cli.js", "room", "delete",
244
+ "--configuration", "/srv/fleet/fleet.yaml", "--json", "--"],
245
+ decision="allow",
246
+ )
247
+ ```
248
+
249
+ Invoke exactly that prefix, followed by the room ID and the confirmation ID:
250
+
251
+ ```sh
252
+ /opt/node/bin/node /opt/fleet/dist/cli.js room delete --configuration /srv/fleet/fleet.yaml --json -- ROOM_ID ROOM_ID
253
+ ```
254
+
255
+ To authorize only one room, append both concrete IDs to the rule's pattern.
256
+ The `--` terminator prevents trailing arguments from changing the fixed options.
257
+ Do not approve the entire Node executable or the entire Fleet CLI. Do not add
258
+ `spawn`, `ours call`, arbitrary scripts, or configuration overrides to this rule.
259
+ A separate fixed `[NODE, CLI, "--help"]` rule can authorize managed help.
260
+
261
+ Restart the Codex session after changing rules. Native Fleet and bundled Codex ACP
262
+ use the same workspace rules. Codex must trust that workspace; configure trust
263
+ through the normal operator workflow rather than enabling it from an agent tool.
264
+ No runtime services or installed packages need restarting for this policy change.
265
+
266
+ ## Boundaries
267
+
268
+ - A rule grants the named operation real authority. The repeated room ID is CLI
269
+ confirmation, not a substitute for user authorization.
270
+ - Rules apply to trusted Codex sessions in this workspace, not exclusively to one
271
+ Fleet identity. They depend on the launcher's inherited environment. Keep the
272
+ executable, CLI installation, credentials, and configuration outside the
273
+ agent-writable workspace. Do not treat this as an identity isolation feature.
274
+ - User/organization denied-read rules or an outer sandbox may forbid execution
275
+ outside the command sandbox. These restrictions take precedence; do not remove
276
+ them implicitly to make Fleet work.
277
+ - On tested Codex 0.159.0, quoting the executable/script tokens prevented the rule
278
+ from granting execution outside the sandbox. For hand-written rules use the
279
+ canonical simple-token invocation above. The generated setup qualifies quoted
280
+ script and argument paths on Codex 0.160.0; see "Quoting, measured natively".
281
+ - Merely enabling network inside the Linux command sandbox was insufficient:
282
+ its user namespace maps ancestor directory owners to UID 65534, which the SDK's
283
+ strict credential ancestry checks reject. Approved CLI execution avoids that
284
+ namespace; SDK security checks remain unchanged.
285
+
286
+ ## Reproduction and regression checks
287
+
288
+ The [issue author’s validation matrix](https://github.com/adapt-toolkit/ours-fleet/issues/231)
289
+ used Codex 0.159.0 on macOS/Linux, native and ACP. Those results are not new runs
290
+ on every revision of this fixture. Build Fleet and supply the complete installed
291
+ Codex distribution (including its adjacent helper binaries) and a built Cowork CLI.
292
+ Run from the Fleet repo:
293
+
294
+ ```sh
295
+ FLEET_CODEX_BIN=/absolute/codex \
296
+ FLEET_COWORK_CLI=/absolute/cowork/dist/cli.js \
297
+ FLEET_TEST_SESSION=codex-app-server \
298
+ FLEET_TEST_TMP_PREFIX=/absolute/private-test-parent/fleet-ipc- \
299
+ node test/fleet-cli-permissions.integration.mjs
300
+ ```
301
+
302
+ Repeat with `FLEET_TEST_SESSION=acp`. The test parent must be writable, outside
303
+ `/tmp` and outside the tested workspace: ACP may allow `/tmp` independently.
304
+ Omit `FLEET_TEST_SESSION` to test standalone `codex exec`.
305
+
306
+ The local scripted Responses provider supplies only command requests. Real Codex,
307
+ Fleet adapters, CLI, control socket, audit store, daemon, and Cowork perform the
308
+ operations. No external model or production identities/rooms are used. Child processes are stopped and temporary state is removed afterward. To retain
309
+ fixture evidence, set `FLEET_TEST_KEEP_ARTIFACTS=1`. The fixture allowlists its
310
+ launcher environment and uses a disposable HOME; no provider keys, preloads, or
311
+ user configuration are inherited.
312
+
313
+ Checks: baseline network-denied `--help`; permitted help; wrong confirmation
314
+ leaves the room intact; correct confirmation deletes the actual empty test room
315
+ from Fleet and Cowork; caller audit remains present; unrelated outside-workspace
316
+ write, `NODE_OPTIONS` injection, and a different configuration remain denied.
317
+ The fixture uses `OURS_FLEET_SUPERVISOR=none`: launchctl/systemd workers and deletion
318
+ of a live room containing agents are outside this test's coverage.
319
+
320
+ Reference: [Codex execution rules](https://learn.chatgpt.com/docs/agent-configuration/rules).
321
+
322
+ ## Claude Code: the same CLI path, different permission settings
323
+
324
+ The issue author verified Claude Code 2.1.284 on macOS and Linux, both standalone and through
325
+ Fleet's bundled Claude ACP adapter (0.63.0). Fleet `approval: auto` maps to
326
+ `acceptEdits`, which is not blanket permission for Bash. Fleet's `filesystem:
327
+ workspace` also does not by itself enable Claude's OS sandbox. Explicitly enable
328
+ it and configure both the execution exclusion and the command permission:
329
+
330
+ ```json
331
+ {
332
+ "sandbox": {
333
+ "enabled": true,
334
+ "failIfUnavailable": true,
335
+ "allowUnsandboxedCommands": false,
336
+ "excludedCommands": [
337
+ "/opt/node/bin/node /opt/fleet/dist/cli.js room delete --configuration /srv/fleet/fleet.yaml --json -- *"
338
+ ]
339
+ },
340
+ "permissions": {
341
+ "allow": [
342
+ "Bash(/opt/node/bin/node /opt/fleet/dist/cli.js room delete --configuration /srv/fleet/fleet.yaml --json -- *)"
343
+ ]
344
+ }
345
+ }
346
+ ```
347
+
348
+ Use operator-controlled Claude settings. The fixture uses an isolated settings
349
+ file delivered with `--settings` (standalone) or Fleet's supported settings overlay
350
+ metadata (bundled ACP). It does not modify the user's settings. As with the Codex
351
+ rule, append exact room IDs instead of `*` to restrict this to one room.
352
+
353
+ `excludedCommands` controls placement outside the command sandbox;
354
+ `permissions.allow` authorizes the action. Neither should be replaced with global
355
+ `bypassPermissions`, blanket `Bash(*)`, or an exception for all Node programs.
356
+ An external sandbox or managed policy can still override this configuration.
357
+
358
+ Linux inside an unprivileged Docker container additionally needed
359
+ `sandbox.enableWeakerNestedSandbox: true`: otherwise bubblewrap failed to mount
360
+ `/proc` before any CLI command ran. This documented setting bind-mounts the
361
+ container's existing `/proc`, weakening that part of the nested isolation. It is
362
+ specific to the nested test environment, not an unconditional Linux requirement.
363
+ The tests still prove Unix-socket denial and filesystem write denial. The outer
364
+ Docker seccomp profile was unconfined to support nesting, as in the Codex tests.
365
+
366
+ Run the same integration scenario with:
367
+
368
+ ```sh
369
+ FLEET_CLAUDE_BIN=/absolute/claude \
370
+ FLEET_COWORK_CLI=/absolute/cowork/dist/cli.js \
371
+ FLEET_TEST_TMP_PREFIX=/absolute/private-test-parent/fleet-claude- \
372
+ FLEET_TEST_SESSION=claude-acp \
373
+ node test/fleet-cli-permissions.integration.mjs
374
+ ```
375
+
376
+ Omit `FLEET_TEST_SESSION` for standalone Claude. In the nested Linux fixture add
377
+ `FLEET_TEST_NESTED_SANDBOX=1` explicitly. A scripted local Anthropic Messages/SSE
378
+ provider requests the real Bash call and captures the actual tool result. The
379
+ negative baseline grants Bash permission without an exclusion and verifies that
380
+ the supervisor socket is still blocked. The write probe is separately authorized
381
+ inside the sandbox; it must execute and report an OS denial, not merely fail an
382
+ approval prompt. No real model/account credentials are used.
383
+
384
+ All other limits above apply: empty room, isolated audit/control server,
385
+ `supervisor=none` workers, and adapter coverage rather than full production runner.
386
+
387
+ Reference: [Claude sandbox exclusions and permissions](https://code.claude.com/docs/en/sandboxing#run-commands-outside-the-sandbox-with-excludedcommands).
388
+
389
+
390
+ ## Port validation for issue #231
391
+
392
+ The separate upstream port was rerun on Linux amd64 in a disposable Node 22.23.1
393
+ container with Codex 0.160.0 and Claude Code 2.1.289:
394
+
395
+ | Harness execution | Result |
396
+ | --- | --- |
397
+ | Codex native app-server | PASS |
398
+ | Bundled Codex ACP | PASS |
399
+ | Claude standalone | PASS |
400
+ | Bundled Claude ACP | PASS |
401
+
402
+ Each complete run checks actual socket denial, permitted help, wrong-confirmation
403
+ refusal, deletion of its own empty Fleet/Cowork room, preserved caller audit, and
404
+ OS denial of an unrelated write, preload injection, and alternate configuration.
405
+ The scripted providers and all state are local; external network access is disabled.
406
+ For these nested tests only, the outer Docker seccomp and AppArmor profiles were
407
+ unconfined and Claude used `enableWeakerNestedSandbox: true`. No host policies or
408
+ production services were changed. The inner command sandbox remains enforced by
409
+ the negative checks. These are container results, not a qualification of normal
410
+ host settings. Initial missing-helper and outer-policy failures were retained
411
+ alongside the passing runs; they are not counted as passing tests.
412
+
413
+ The port also passed 88 diagnostic/conversation/audit unit checks, a build, and an
414
+ npm package dry-run check for this document. The diagnostic preserves the prior
415
+ error kinds and audited CLI failure before parsing. This does not claim a fresh
416
+ macOS run, full production runner coverage, or live-agent room deletion.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ours.network/fleet",
3
- "version": "1.2.0-nightly.43",
3
+ "version": "1.2.0-nightly.45",
4
4
  "description": "Harness-agnostic fleet of persistent, identity-bound AI agents. Declarative fleet.yaml, managed native/ACP sessions, supervision, and ours.network messaging.",
5
5
  "type": "module",
6
6
  "license": "FSL-1.1-Apache-2.0",
@@ -20,6 +20,7 @@
20
20
  "README.md",
21
21
  "docs/task-workspaces.md",
22
22
  "docs/room-layouts.md",
23
+ "docs/validation/managed-cli-permissions.md",
23
24
  "LICENSE"
24
25
  ],
25
26
  "engines": {