Repository navigation
fix(mocactl): write both of IBM Bob's MCP config filenames - #677
Conversation
`sbx up` wrote only `.bob/settings.json`, which Bob 2.0.9 ignores: it reads `.bob/mcp.json`, the file `bob mcp add` writes at its default `workspace` scope. So `up` reported "configured ... IBM Bob" and `doctor` reported `ok - agent config` while `bob mcp list` said "No MCP servers configured", and Bob ran with no sandbox tools at all. Which filename a given Bob reads cannot be determined from here -- `up` runs before Bob is necessarily on `PATH`, and parsing `bob --version` would make agent config depend on the agent -- so write both. Each is a two-key file naming the same server, and `doctor` now passes when either one carries it: the file that matters is whichever the installed Bob reads, and a developer who ran `bob mcp add` by hand has only that one. Also documents what testing against Bob 2.0.9 turned up, none of which the guide described: - prompts go via `-p` or `run`; a bare `bob "..."` fails - credentials come from `BOB_API_KEY`; there is no `--auth-method` - `bob mcp add` needs `--` before stdio arguments - `bob run` refuses an untrusted folder - `bob mcp list` reports configured state, not a live connection; `/mcp` inside `bob chat` is what confirms the server started - Bob prefers its own local tools unless the prompt names the sandbox's, so a prompt that does not name them runs on the laptop with the sandbox connected and healthy. "Do not use any local tool" is ignored. `up` cannot deny Bob's tools, so this is the mitigation there is. - the templates carry only the Pi toolchain, so a build or test run needs a language the template has And gitignores the per-developer agent wiring `up` writes. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Mariusz Sabath <[email protected]>
Walking the guide through verbatim found its step 4 misleading in three ways,
all of them things a first-time reader hits:
- it used `bob run`, which is headless. Bob answered the example task by
explaining that the package was already documented and offering to proceed
anyway -- a question with nobody there to answer it, so nothing was written.
- the example ("add a doc comment to each exported function") can legitimately
produce no change. `pull` then says `nothing to pull`, which reads as a
broken round trip on a first run when it is the correct result.
- it named the `edit` tool for a task that creates a file. Bob used `write`
instead and said why: `edit` only changes a file that already exists.
Step 4 is now `bob chat` with a task whose result is checkable -- a file that
was not there before -- and the tool list is spelled out so a reader can name
the right one, since naming the tool is the whole mitigation here.
Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Mariusz Sabath <[email protected]>
ingpaolodettori-dev
left a comment
There was a problem hiding this comment.
Writing both .bob/settings.json and .bob/mcp.json is threaded consistently through every place the old single file went: conflict detection, the in-memory merge, the write loop, directory creation for sbx rm, the manifest's strict-JSON set, and doctor, which accepts either file. The new test covers both files being written and each one alone satisfying doctor, and the push-count and CFG expectations are updated to match. CI is green on 13638ee.
Two suggestions inline: anchor the new .gitignore entries to the repo root, and confirm that a hand-run bob mcp add produces an entry isBobServer accepts, because otherwise the newly checked file turns that path into a ConfigConflict.
One item outside the diff: docs/specs/2026-10-15-sbx0-internal-sandbox-service-design.md:516 still says Bob uses .bob/settings.json ("its project scope, which bob mcp add writes by default"). After this PR that is stale. Worth a one-line update so the spec and the guide agree.
| # sandbox, is re-merged by the next `up`, and differs per working tree (each gets its own | ||
| # sandbox). .claude/settings.json and CLAUDE.md are tracked and stay so -- `up` merges into | ||
| # them inside a marked block. | ||
| .bob/ |
There was a problem hiding this comment.
suggestion: These patterns have no slash, so they match at any depth. AGENTS.md, .mcp.json, opencode.json, .bob/ and .sbx/ would also silently ignore a future packages/<pkg>/AGENTS.md, or a test fixture under any subdirectory, and git add would then need -f with no visible reason. up only writes these at the repository root, so anchor them: /.bob/, /.mcp.json, /opencode.json, /opencode.jsonc, /AGENTS.md, /.sbx/.
A related point: the guide (user-guide.md:411) says .sbx/ "is listed in .git/info/exclude, never in your .gitignore". That sentence is about what up writes, so this isn't wrong, but a reader of this repo will see .sbx/ in its .gitignore. A word in the comment above ("this repo also ignores them for every clone") would head off that question.
|
|
||
| needObjects(bobMcp, ['mcpServers']); | ||
| const bobMcpHave = at(bobMcp.data, ['mcpServers', SERVER]); | ||
| if (bobMcpHave !== undefined && !isBobServer(bobMcpHave)) { |
There was a problem hiding this comment.
suggestion: This conflict check is new for .bob/mcp.json, and .bob/mcp.json is the file a developer gets from bob mcp add (which the guide now recommends as the manual fallback). isBobServer accepts only command/args/type/env. If Bob 2.0.9's bob mcp add sandbox -- mocactl sbx mcp writes any other key (for example a disabled, timeout, trust or alwaysAllow field, as some MCP clients do), then the next up in that repo stops with ConfigConflict: .bob/mcp.json mcpServers.sandbox is there and names another server. Before this PR, that same repo got through up fine. The end-to-end test in the description covers only the case where up creates the file. Could you check what bob mcp add actually writes and, if it adds keys, either allow them in isBobServer or add a test with a hand-added entry?
… update the spec Addresses the review on #677. - Anchor the new .gitignore patterns to the repository root (`/.bob/` and so on). Unanchored they matched at any depth, so a future packages/<pkg>/AGENTS.md or a fixture in any subdirectory would have been ignored silently, needing `git add -f` for no visible reason. `up` only writes these at the root. The comment now also says this repo ignores them for every clone, which the guide's "`.sbx/` is listed in .git/info/exclude, never in your .gitignore" would otherwise seem to contradict. - Pin the shape of a hand-added Bob entry. Checking .bob/mcp.json is new, and it is the file `bob mcp add` writes -- the manual fallback the guide recommends -- so a repository configured that way must still get through `up` rather than stop with a ConfigConflict. Verified against Bob 2.0.9 in a fresh repository: it writes exactly `command` and `args`, with none of the `disabled`/`timeout`/`trust`/`alwaysAllow` fields `isBobServer` would reject, so no change to `isBobServer` is needed. The new test pins that, so a Bob that starts adding keys fails in CI rather than in a developer's repository. - Update docs/specs/2026-10-15-sbx0-internal-sandbox-service-design.md, which still described Bob as `.bob/settings.json` only. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Mariusz Sabath <[email protected]>
|
Test report and two remaining items — verified against head Verified:
Missing items:
Assisted-By: Claude Code |
… up's agent config `sbx push` has no rule of its own for the agent configuration `sbx up` writes (.mcp.json, .claude/settings.json, opencode.json, .bob/, CLAUDE.md, AGENTS.md): each is pushed exactly when git would list it (tracked, or untracked and not ignored), and only .sbx/ is always left out. #677 changed what this repository pushes as a side effect of its .gitignore lines; this records the behavior as a decision (#683's option A) instead of changing it. - ADR-0049 (Proposed): the question, options A/B/C, the decision and why (no in-sandbox reader; the deny rules and Cortex mode act on the laptop; the developer's ignore rules say what stays local; pull never writes these files back), and the accepted costs. - planPush's doc comment points at the ADR, as the place a skip or re-include rule would be added. - Two tests in sbx-up.test.ts pin it: a repository that ignores none of the files pushes all seven on the next push and never .sbx/; one with this repository's ignore lines pushes only .claude/settings.json and CLAUDE.md, and a force-added AGENTS.md once it is tracked. - The stale "pushed 14 files" comment now says why 14 holds in the fixture; the user guide says it in section 4 and in the section 7 note on ignored files. Closes #683 Assisted-By: Claude Code Signed-off-by: Rong Chang <[email protected]>
Fixes #676 (issue 2), and documents issues 1, 3 and 4 from that report.
The bug
sbx upwrote Bob's MCP server entry to.bob/settings.json. Bob 2.0.9 reads.bob/mcp.json—the file
bob mcp addwrites at its defaultworkspacescope — and ignoressettings.jsonentirely. The result was a silent no-op that looked like success:
The file's contents were correct. Only the name was wrong, so nothing on the
mocactlside couldtell.
doctorcould not catch it either: it verifies the server is present in the file it expectsto have written, not that the client reads that file.
Bob then ran with no sandbox tools — which, since
upcannot deny Bob's local tools, meant it ranon the laptop.
The fix
Write both filenames. Which one a given Bob reads depends on its version, and this cannot be
determined at
uptime:upruns before Bob is necessarily installed, and shelling out tobob --versionwould make agent configuration depend on the agent being present and on parsing itsoutput. Both files are two-key JSON naming the same server, so the redundant one costs a few bytes.
doctornow passes when either file carries the server. Requiring both would fail a repositorythat is working fine — including one where the developer ran
bob mcp addby hand and so has onlymcp.json.The change threads the second file through the existing machinery: conflict detection, the writer,
directory creation, the
.sbx/agent-config.jsonrecord andsbx rm's take-back.Documentation
Testing against Bob 2.0.9 found the guide's Bob section describes a CLI that version does not have.
Corrected, with the specifics:
bob "prompt"too many arguments; use-porrunbob --auth-method ssoBOB_API_KEY, or log in viabob chatbob mcp list→✓ sandbox … - Connectedsandbox: mocactl sbx mcp | enabled | stdio | workspacebob -sfor its own sandbox--helpAdded, because they are steps a reader hits and the guide did not mention:
bob mcp addneeds--before stdio arguments, or it errorsbob runrefuses an untrusted folder; the trust level is choosable inbob chatbob mcp listreports configured state, not a live connection./mcpinsidebob chatis whatconfirms the server actually started
bash,git, Python 3,ripgrep,curl) and the VMhas no network, so a build or test run needs a language the template has. The guide's example
prompt for every agent is "run the test suite and fix what fails", which cannot work in this
repository:
pnpm -r testhas no Node andgo testhas no GoThe one worth reading
Bob prefers its own local tools unless the prompt names the sandbox's. With the server connected
and healthy, an ordinary request runs on the laptop. Naming the tool ("using the sandbox bash
tool") routes it correctly; instructing it not to use local tools does not — that was tested and
ignored. Since
upcannot deny Bob's tools, prompt phrasing is the mitigation there is, so theguide now says so in the Bob section, the agent table and troubleshooting.
The tell is the tool name in each call block:
Bash (sandbox)/Edit (sandbox)are the sandbox's,Execute Commandis the laptop.Testing
Unit:
sbx-agent-config,sbx-doctorandsbx-updoctormocactlsuite: 1637 pass. One unrelated pre-existing flake (overlay-misc.test.tsx, a 5 sTUI timeout) which passes in isolation and on a clean tree
tsc --noEmitand Prettier cleanEnd to end, against the real service with Bob 2.0.9 — built from this branch, fresh sandbox, no
hand-editing:
Then a round trip in
bob chat, prompt naming the sandbox tools. Every call wasFind (sandbox),Read (sandbox),Grep (sandbox),Bash (sandbox)orEdit (sandbox)— noExecute Command:Also
.gitignorenow covers the per-developer agent wiringupwrites (.bob/,.mcp.json,opencode.json,AGENTS.md,.sbx/): it points at one developer's sandbox, differs per workingtree, and is re-merged by the next
up..claude/settings.jsonandCLAUDE.mdare already trackedand stay so —
upmerges into them inside a marked block.Not addressed
Issue 1 (Bob's tool-selection default) and issue 4 (no Go or Node template) are documented here, not
fixed. Issue 1 may not be fixable from this side at all, since Bob exposes no way to remove a tool.
One idea worth testing: whether wording in the
sbx:beginblock thatupwrites intoCLAUDE.md/AGENTS.md, or in Bob's.bobrules, biases its tool choice toward the sandbox. If itdoes,
upcould write it and most of the risk goes away.Assisted-By: Claude Code