Skip to content

feat(sbx): sbx up configures IBM Bob, and pull --apply refuses .bob/ - #657

Merged
pdettori merged 3 commits into
mainfrom
fix/pull-refuse-bob
Oct 28, 2026
Merged

pdettori merged 3 commits into
mainfrom
fix/pull-refuse-bob

Conversation

@mrsabath

Copy link
Copy Markdown
Member

Summary

Adds IBM Bob (Bob-Shell) as a third agent mocactl sbx up configures, and closes the pull --apply hole its config directory left open. Two commits, separable.

Bob turned out to be the easy case, not another Codex. Measured against bob 0.0.32 before writing anything:

Bob Codex (#639, for contrast)
Project-scoped MCP config Yes — bob mcp add defaults to -s project, writing .bob/settings.json No, ~/.codex/config.toml only
Shape {"mcpServers":{"sandbox":{"command","args"}}} — .mcp.json's TOML
Preserves unrelated keys on merge Yes (an unrelated security block survived) n/a
Steering file AGENTS.md, which up already writes AGENTS.md, already written
Tool denial No provable mechanism shell_tool yes, unified_exec no

So Bob belongs in agent-config.ts beside the other two rather than in a launcher: up merges mcpServers.sandbox into .bob/settings.json with the existing JSON machinery. No launcher, no TOML parser, no new dependency.

3f9bc8b — pull --apply refuses .bob/ (prerequisite)

The same hole as .codex/ in #592. .bob/settings.json declares MCP servers with an arbitrary command and args that Bob launches on the laptop, and it was not refused:

false  .bob/settings.json      <- applied
true   .codex/config.toml
true   .pi/extensions/x.ts

One AGENT_DIRS entry. Tests cover the path, the folded .BOB/ and fullwidth .BOB/ variants, and the negatives. Note .bobrules is a real Bob file but a prompt file — text, not an executable — so it stays allowed like AGENTS.md, with a test pinning that.

Stands on its own merits whether or not up ever writes Bob's config, so it can be split out if you prefer.

ba3efbd — up configures Bob

Mirrors the .mcp.json path exactly, so the module's invariants (merge-never-overwrite, read-everything-before-writing, record-exactly-what-was-added) come for free: BOB_SETTINGS / BOB_SERVER / isBobServer, a needObjects + predicate conflict check, setKey when absent, the doc in the writes loop, JSON_FILES + DIRS, the strict set in takeBackAgentConfig (Bob reads plain JSON, not JSONC), and a checkAgentConfig line. up's closing line now names Bob.

The nested-directory bookkeeping is generalised from the single .claude block to a loop over both nested files, so rm removes a .bob/ that up created.

Two things worth review attention

No deny list, deliberately. Bob has no equivalent of Claude Code's permissions.deny. --allowed-tools waives the confirmation prompt rather than removing a tool (allowedTools.includes(toolName) in the binary). excludedTools does appear in the binary, but I could not prove it is read from settings, and Bob accepts unknown settings keys silently — so writing it would be configuration that looks applied and is not, which is exactly #577's failure mode. The docs and SBX0 §6.3 therefore say plainly that Bob's local tools are restricted, not denied, point at Bob's own approval mode, and call out --yolo as the thing not to combine with a sandbox you care about. If someone can confirm excludedTools upstream, that becomes a follow-up worth taking — it would give Bob real parity with Claude Code.

The manifest record becomes forward-only. A .sbx/agent-config.json naming .bob/settings.json fails manifestProblem's allow-list check in an older mocactl, which then refuses to run up (agent-config.ts:951) and keeps the record on rm. Flagging rather than working around it: the cortex field set the precedent, and SBX0 is preview with an internal cohort. Relaxing manifestProblem to ignore unknown files would be a broader change affecting all agents, and is out of scope here.

Verification

Unit: 1604 passed, 4 skipped (6 new Bob cases), tsc --noEmit clean, prettier clean, check-links 212 files / 0 broken. Removing the setKey fails 24 tests; removing the AGENT_DIRS entry fails the refusal test.

The integration point, checked against the real CLI rather than only in tests — the actual writeAgentConfig wrote the file, then real Bob read it back:

$ cat .bob/settings.json          # written by the code in this PR
{"mcpServers":{"sandbox":{"command":"mocactl","args":["sbx","mcp"]}}}

$ bob mcp list                    # bob 0.0.32 reading it
Configured MCP servers:
✗ sandbox: mocactl sbx mcp (stdio) - Disconnected

Bob found and parsed the entry; Disconnected is expected in that environment because mocactl was not on its PATH.

Not verified: a live end-to-end run — up into a real sandbox, then bob fixing the demo's failing test and pull --apply bringing it back. The environment I developed in has bob but no mocactl on PATH and no sandbox credentials. Worth one real pass before merge, especially since Bob's containment is weaker than Claude Code's, so "does it actually route through the sandbox" is the question that matters most.

Checklist

  • Commits are signed off (git commit -s).
  • make lint — not run; pre-commit is unavailable in my environment. Package tests, tsc and prettier pass; CI's lint job is the backstop.
  • Docs: an IBM Bob subsection in docs/sbx/user-guide.md §3, the .bob/settings.json row in §4's table, .bob/ in the pull --apply paragraph, a troubleshooting entry, and SBX0 §6.3 + §10.3.
  • Docs: make check-links passes.
  • No new spec or ADR needed.

Same hole as .codex/ in #592, for the next agent. `.bob/settings.json` is IBM
Bob's project-scoped configuration and declares MCP servers with an arbitrary
`command` and `args` that Bob launches on the laptop, so it belongs in
AGENT_DIRS and did not:

    false  .bob/settings.json      <- applied
    true   .codex/config.toml
    true   .pi/extensions/x.ts

Verified against `bob` 0.0.32: `bob mcp add` defaults to `-s project` and writes
`.bob/settings.json` with a `mcpServers` map shaped like `.mcp.json`'s.

One AGENT_DIRS entry, matching at any depth and under the existing case and
Unicode folding like the others. Tests cover `.bob/settings.json`, the folded
`.BOB/` and fullwidth `.BOB/` variants, and the negatives: `.bobrules` (a real
Bob file, but a prompt file — text, not an executable, so allowed like AGENTS.md)
and `docs/bob/x.md`. The refusal test fails without the entry.

Also names `.bob/` in the two places that enumerate the list for readers, and
re-wraps the user-guide paragraph the longer list left with a 13-column orphan.

This holds whether or not `sbx up` ever writes Bob's configuration.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Mariusz Sabath <[email protected]>
Bob is the easy case, not another Codex. Verified against `bob` 0.0.32:
`bob mcp add` defaults to `-s project` and writes `.bob/settings.json` in the
repository, with a `mcpServers` map shaped like `.mcp.json`'s; it preserves
unrelated keys on merge; and it reads `AGENTS.md`, which `up` already writes. So
`up` merges into it like the other two — no launcher, no TOML, no new dependency.

- `BOB_SETTINGS` / `BOB_SERVER` / `isBobServer`, mirroring the `.mcp.json` path:
  a `needObjects` + predicate conflict check, `setKey` when absent, the doc in
  the writes loop, and the nested-directory bookkeeping (generalised from the
  single `.claude` block to both nested files, so `rm` removes a `.bob/` it made).
- `JSON_FILES` and `DIRS` gain the file and its directory. Without both, the
  record `up` writes is rejected as malformed by the next run.
- `takeBackAgentConfig`'s `strict` set gains it: Bob reads plain JSON, not JSONC.
- `checkAgentConfig` reports a missing server. No local-tools line, because there
  is nothing to check — see below.
- `up`'s closing line now names Bob.

**No deny list, deliberately.** Bob has no equivalent of Claude Code's
`permissions.deny`: `--allowed-tools` waives the confirmation prompt rather than
removing a tool, and while `excludedTools` appears in the binary I could not prove
it is read from settings — Bob accepts unknown keys silently, so writing it would
be configuration that looks applied and is not (#577's failure mode). The docs and
SBX0 §6.3 therefore say plainly that Bob's local tools are restricted, not denied,
and point at its own approval mode; `--yolo` is called out as the thing not to
combine with a sandbox you care about.

**The record is forward-only.** A manifest naming `.bob/settings.json` fails
`manifestProblem`'s allow-list check in an older mocactl, which then refuses to
run `up` and keeps the record on `rm`. Accepted at preview stage; the `cortex`
field set the precedent.

Tests: the server merged into an empty repository; a developer's own servers and
`security` block preserved, and only our entry taken back; `.bob/` created and
removed; `doctor`'s line before and after `up`; and two conflict cases (a foreign
server under our name, a non-object `mcpServers`). Dropping the `setKey` fails 24.

1604 tests pass, tsc and prettier clean.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Mariusz Sabath <[email protected]>
@mrsabath
mrsabath requested a review from pdettori as a code owner October 28, 2026 19:41
@pdettori pdettori added the ready-for-ai-review Request automated AI code review from clawgenti label Oct 28, 2026

@ingpaolodettori-dev ingpaolodettori-dev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

This adds .bob/ to pull --apply's refused AGENT_DIRS, which closes the same laptop-side MCP-command hole #592 closed for .codex/. It also has sbx up merge mcpServers.sandbox into .bob/settings.json through the existing merge/record/take-back machinery. The change follows the .mcp.json path one-for-one, and the tests cover merge-preserve, rm of a created .bob/, conflicts, doctor, and the folded/fullwidth refusal variants, with .bobrules as a negative. No blocking issues. The inline items are user-facing text that still says "Claude Code and OpenCode" now that doctor and up also cover Bob.

Author: mrsabath (MEMBER — maintainer)
Areas reviewed: TypeScript (mocactl sbx), tests, Docs
Agent/IDE config (.claude/.vscode): none
Commits: 2 commits, all signed-off: yes
CI status: passing

Notes:

  • Agreed that the forward-only manifest is acceptable for the SBX0 preview. It could get one line in the release notes.
  • Repos set up with an older mocactl get a red doctor line for Bob until they re-run up. Doctor's fix text already covers that.
  • +1 to one live up → bob → pull --apply pass before merge, as the PR body suggests.

Comment thread docs/sbx/user-guide.md
[IBM Bob](#ibm-bob) above.
- **Codex edits files on your laptop instead of in the sandbox**: check you started it with
`mocactl sbx codex` (or the `-c mcp_servers.sandbox=…` line), and that `/mcp` in the TUI lists
the `sandbox` tools. Note `mocactl sbx doctor`'s `agent config` check covers Claude Code and

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: This is now wrong, because checkAgentConfig checks .bob/settings.json too (agent-config.ts:1406). Maybe: "covers Claude Code, OpenCode and IBM Bob (for Bob, only that the server is there)".

}
// Bob only: it has no deny list to check, so there is no local-tools line for it.
if (!isBobServer(at(bob, ['mcpServers', SERVER]))) {
problems.push(`IBM Bob: ${BOB_SETTINGS} has no ${SERVER} MCP server (mocactl sbx mcp)`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: When this check passes, doctor's success line (doctor.ts:243-246) still reads "Claude Code and OpenCode use the sandbox MCP server, with every local tool denied …", and user-guide.md:559 shows that output. Now that Bob is part of this check, name Bob there and say its local tools are not denied. Otherwise a green doctor suggests more containment for Bob than exists, which is the misreading the rest of this PR's docs work to prevent.

@@ -1174,7 +1207,7 @@ export function takeBackAgentConfig(root: string): TakeBack {
// A record names a file after following links (target()), so a linked opencode.json is recorded
// as its target's path. Only Claude Code's two files are strict JSON: decide by resolving them.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: "Only Claude Code's two files are strict JSON" is stale now that BOB_SETTINGS is in the loop below.

if (cortex) c.io.err(CORTEX_NOTE);
if (changed.length) {
c.io.err(`configured Claude Code and OpenCode: ${changed.join(', ')}`);
c.io.err(`configured Claude Code, OpenCode and IBM Bob: ${changed.join(', ')}`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: mocactl sbx up help (cli.ts:74-77) and the agent-config.ts:32 module header still say "Claude Code and OpenCode", and the help's file list omits .bob/settings.json. Worth updating them in the same PR.

Review of #657, and a real gap: the PR said `.bobrules` "stays allowed like
AGENTS.md", but `AGENTS.md` is allowed *with a warning* and `.bobrules` was
allowed silently. PROMPT_FILES held only claude.md, agents.md and
agents.override.md, so a pulled patch could rewrite Bob's steering file and
nothing said so — the same channel the AGENTS.override.md entry closed for Codex
(#592: "silently replaces the instructions an agent session reads").

Implementation now matches the stated intent rather than the other way round:
`.bobrules` joins PROMPT_FILES. It is still applied, not refused — it is text,
not an executable — but never silently.

`sbx up` does not write `.bobrules`, so it holds no sbx block and `outsideBlock`
returns the whole file: any change to it is all change, and is warned about
whole. The test fails without the entry (`expected '' to match /\.bobrules/`).

Both places that describe the warning now name it, and read as "a steering file"
rather than listing Claude Code's two and Codex's one.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Mariusz Sabath <[email protected]>
@mrsabath

Copy link
Copy Markdown
Member Author

Fixed in f505832. You are right, and the diagnosis is exactly right: the implementation contradicted the stated intent, so I changed the implementation rather than the claim.

PROMPT_FILES held claude.md, agents.md and agents.override.md. .bobrules was in neither set, so a pulled patch rewriting Bob's steering file was applied with no warning at all — the same channel the AGENTS.override.md entry closed for Codex. Calling it "allowed like AGENTS.md" was wrong twice over: AGENTS.md is allowed with a warning, and I had checked that .bobrules was not refused without checking that it was not warned about either.

.bobrules now joins PROMPT_FILES. Still applied, not refused — it is text, not an executable, so the prompt-file reasoning holds — but never silently. The test fails without the entry:

× warns for a .bobrules the patch creates: Bob reads it as steering (#657 review)
  AssertionError: expected '' to match /\.bobrules/

The empty string is the point: there was no warning to match.

One detail worth noting, since it differs from the other three: sbx up does not write .bobrules, so it holds no sbx block. outsideBlock returns the whole text when there are no markers, so any change to it counts as change outside the block and is warned about whole — which is the behaviour you want for a file we never author.

Both places that describe the warning now name it, and read as "a steering file — CLAUDE.md, AGENTS.md, AGENTS.override.md or .bobrules" rather than enumerating two agents' files and leaving the third implicit.

Verification: the suites this PR touches are green — sbx-push, sbx-agent-config, sbx-up, sbx-doctor: 332 passed. tsc --noEmit clean, prettier clean, check-links 212 files / 0 broken.

One honest note on my local full-suite run: two React/ink overlay tests (overlay-credentials, overlay-misc) fail intermittently in my environment under parallel load and pass in isolation (21/21), with or without this branch's changes. They are unrelated to push.ts and CI has been green on them throughout, so I am treating them as a local flake rather than something this PR caused — flagging it rather than quietly ignoring it.

Thanks also for saying plainly which claims you could not verify yourself. Bob's behaviour here rests on my 0.0.32 measurements, and the one that matters most for this PR — that the real Bob reads what writeAgentConfig writes — is in the body with its output. The end-to-end run against a live sandbox is still outstanding, and remains the thing I would want done before merge, since Bob's local tools are not denied and so "does it actually route through the sandbox" is an empirical question rather than a configured guarantee.

@pdettori
pdettori merged commit f4f66f9 into main Oct 28, 2026
16 checks passed
@pdettori
pdettori deleted the fix/pull-refuse-bob branch October 28, 2026 20:38
pdettori pushed a commit to pdettori/moca that referenced this pull request Oct 29, 2026
Follow-up to rossoctl#657's review: four places still read "Claude Code and OpenCode"
after doctor and `up` grew Bob. Separate PR because rossoctl#657 merged before these were
addressed.

The one that mattered most is doctor's success line (`doctor.ts:243-246`). It
claimed "every local tool denied" for a check that now includes Bob, whose local
tools cannot be denied — so a green doctor implied more containment for Bob than
exists, the exact misreading the rest of rossoctl#657's docs were written to prevent. It
now names Bob and states the exception, in both the normal and Cortex wordings.

Also:

- `sbx up --help`: names Bob, lists `.bob/settings.json` among the merged files,
  and says Bob's local tools cannot be denied.
- `agent-config.ts`'s module header: the same, so the file's opening claim matches
  what it writes.
- The stale "Only Claude Code's two files are strict JSON" comment in
  `takeBackAgentConfig`, now that `BOB_SETTINGS` is in that loop: it reads "Only
  OpenCode's is JSONC; the rest are strict JSON", which stays true as agents are
  added.
- The user guide: the `agent config` row in doctor's table, its sample output, and
  the Codex troubleshooting note that said the check "covers Claude Code and
  OpenCode only" — it covers Bob too, for the server's presence.

The doctor test that pinned the old wording as one contiguous phrase now asserts
its two halves plus the Bob exception, so it checks the meaning rather than the
sentence.

Suites touched: 196 passed (doctor, cli, agent-config); tsc and prettier clean;
check-links 212 files, 0 broken.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Mariusz Sabath <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-ai-review Request automated AI code review from clawgenti

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants