Repository navigation
docs(adr): ADR-0049, sbx push carries the agent config sbx up writes only when git would - #865
Conversation
… 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. rossoctl#677 changed what this repository pushes as a side effect of its .gitignore lines; this records the behavior as a decision (rossoctl#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 rossoctl#683 Assisted-By: Claude Code Signed-off-by: Rong Chang <[email protected]>
ingpaolodettori-dev
left a comment
There was a problem hiding this comment.
Review at 65d7269
Docs/test-only PR: adds ADR-0049 (Proposed), which ratifies option A from #683. sbx push has no rule of its own for the agent config that sbx up writes, so git's ignore rules decide what is pushed, and only .sbx/ is always skipped. The PR also adds a planPush doc comment, two tests that pin the behavior both ways, and two paragraphs in the user guide. I checked the claims against the PR head (base = main f5aefec, 0 behind): planPush uses git ls-files -z --cached --others --exclude-standard and special-cases only isBindingPath and SECRET_RE (push.ts:373-398). .gitignore has carried the anchored /.bob/ /.mcp.json /opencode.json /opencode.jsonc /AGENTS.md /.sbx/ lines since c6ba139 (#677). .claude/settings.json and CLAUDE.md are tracked. AGENT_DIRS/AGENT_FILES refuse pulls of .claude, .bob, .mcp.json and opencode.json(c). MCP_INSTRUCTIONS exists in sandbox-client. The test fixture's CFG order matches the asserted arrays. ADR number 0049 is free on main. No behavior change. No injection attempts found in the PR text.
Author: webchang (MEMBER — maintainer)
Areas reviewed: Docs (ADR, ADR index, user guide), TypeScript (comment only), tests
Agent/IDE config (.claude/.vscode): none. .claude/settings.json appears only in prose, and no path under .claude/ or .vscode/ is changed.
Commits: 1, all signed off: yes
CI status: all checks passing at submit time
Base: 0 behind main; mergeable_state blocked (awaiting review)
Body-only nit: The PR title (~88 chars) and the commit subject (~92 chars) are longer than the advisory 72-character limit.
Drafted by an AI reviewer and approved by a human before posting.
| back, and a `push` can replace them. | ||
| back, and a `push` can replace them. The same holds for an ignored file: in a repository that | ||
| ignores `AGENTS.md`, a hand-written one is not pushed, and one the agent writes may not come | ||
| back. Commit it (`git add -f AGENTS.md`) to have it pushed and pulled (§4); a pulled `AGENTS.md` comes back with a warning. |
There was a problem hiding this comment.
nit: This new line runs to 128 characters, while the rest of the guide wraps at 100. Prettier does not reflow prose, so lint passes, but the paragraph looks inconsistent. Rewrapping would fix it. Also, "a pulled AGENTS.md comes back with a warning" is broader than the code: applyPatch (push.ts) only warns when the patch changes the file outside the sbx block. Suggest "with a warning if it changed outside the sbx block", which matches §3 of this guide.
There was a problem hiding this comment.
Done in cc635be: rewrapped at 100 columns, and it now reads "comes back with a warning if it changed outside the sbx block", matching applyPatch and §3.
… block Review follow-up: rewrap the new line at 100 columns, and match applyPatch, which warns only when the patch changes AGENTS.md outside the sbx block (as the guide's own section 3 says). Refs rossoctl#683 Assisted-By: Claude Code Signed-off-by: Rong Chang <[email protected]>
Closes #683
This records a decision for the maintainers to confirm. It changes no behavior. ADR-0049 is
filed as
Proposed. The decision, in one sentence:This is #683's option A, the one the issue recommends, and it is what
planPushdoes today. Ifyou prefer B or C, the ADR and the two tests are where that change would go.
What changed and why
docs/adrs/0049-sbx-push-agent-config-follows-gitignore.md(new, Proposed) covers:planPushlists files withgit ls-files --cached --others --exclude-standard, special-cases only.sbx/(isBindingPath) and secret-shaped names, andupwrites its config after its first push;The reasons: nothing in the sandbox reads these files, because the steering arrives as the MCP
server's instructions. The deny rules in
.claude/settings.json/opencode.jsonand Cortex modeact on the laptop, so pushing them adds or removes no protection in the VM. The developer's
ignore rules are what says a file stays local. One rule covers every file. A pull never writes
these files back (
AGENT_DIRS/AGENT_FILES). The index indocs/adrs/README.mdlists the ADR.packages/mocactl/src/sbx/push.ts:planPush's doc comment now names the files, states therule and points to ADR-0049 and the tests. This is where a skip or re-include rule would go.
packages/mocactl/test/sbx-up.test.ts: two new tests pin the rule. The stale comment on thepushed 14 filesassertion now says why 14 holds: the fixture ignores none of the files, whilethis repository ignores them.
docs/sbx/user-guide.md: section 4 gains a paragraph saying.gitignoredecides whether thesefiles reach the sandbox. The section 7 note on ignored files now covers an ignored
AGENTS.mdandhow to make it travel (
git add -f).Tests
New, in
mocactl sbx up and rm: the agent configuration:the next push carries the agent configuration a repository does not ignore, never .sbx/ (ADR-0049): the firstuppushes none of the seven files, because it writes them afterward. Thesecond
uppushes exactly.mcp.json,.claude/settings.json,opencode.json,.bob/settings.json,.bob/mcp.json,CLAUDE.mdandAGENTS.md, and no.sbx/file.the next push leaves out what the repository's .gitignore ignores, unless it is tracked (ADR-0049): with this repository's own ignore lines (fix(mocactl): write both of IBM Bob's MCP config filenames #677), the seconduppushes only.claude/settings.jsonandCLAUDE.md. Aftergit add -f AGENTS.md, apushcarriesAGENTS.mdtoo.Results:
isAgentConfigPath,AGENTS.mdandCLAUDE.mdinplanPush): both fail, withexpected [] to deeply equal [ '.mcp.json', …(6) ]andexpected [] to deeply equal [ Array(2) ].git ls-files --others -- AGENTS.md .mcp.json opencode.json .bob): the second test fails withexpected [ '.mcp.json', …(6) ] to deeply equal [ Array(2) ].@moca/mocactlsuite (vitest run --minWorkers=1 --maxWorkers=2): 2075 passed, 4skipped. 5 failed, all on the 5 s timeout in untouched push/pull tests under machine load. Rerun
alone, all 5 pass.
tsc --noEmitis clean, Prettier is clean, andpython3 scripts/check-doc-links.pyfinds 0broken links.
Out of scope
Every commit is signed off (DCO).
Assisted-By: Claude Code