Skip to content

docs(adr): ADR-0049, sbx push carries the agent config sbx up writes only when git would - #865

Merged
webchang merged 2 commits into
rossoctl:mainfrom
webchang:pr/i683-adr-agent-config
Nov 17, 2026
Merged

webchang merged 2 commits into
rossoctl:mainfrom
webchang:pr/i683-adr-agent-config

Conversation

@webchang

Copy link
Copy Markdown
Member

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:

sbx push has no rule of its own for the agent configuration sbx up writes: each file is pushed
exactly when git would list it (tracked, or untracked and not ignored), and only .sbx/ is always
left out.

This is #683's option A, the one the issue recommends, and it is what planPush does today. If
you 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:

    • the question;
    • what the code does: planPush lists files with git ls-files --cached --others --exclude-standard, special-cases only .sbx/ (isBindingPath) and secret-shaped names, and
      up writes its config after its first push;
    • options A, B and C from the issue, and the decision with its reasons;
    • the consequences, including the accepted costs.

    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.json and Cortex mode
    act 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 in docs/adrs/README.md lists the ADR.

  • packages/mocactl/src/sbx/push.ts: planPush's doc comment now names the files, states the
    rule 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 the
    pushed 14 files assertion now says why 14 holds: the fixture ignores none of the files, while
    this repository ignores them.

  • docs/sbx/user-guide.md: section 4 gains a paragraph saying .gitignore decides whether these
    files reach the sandbox. The section 7 note on ignored files now covers an ignored AGENTS.md and
    how 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 first up pushes none of the seven files, because it writes them afterward. The
    second up pushes exactly .mcp.json, .claude/settings.json, opencode.json,
    .bob/settings.json, .bob/mcp.json, CLAUDE.md and AGENTS.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 second up pushes only
    .claude/settings.json and CLAUDE.md. After git add -f AGENTS.md, a push carries
    AGENTS.md too.

Results:

  • On main's code, both pass. They pin the current behavior.
  • Mutation 1, never push agent config (skip isAgentConfigPath, AGENTS.md and CLAUDE.md in
    planPush): both fail, with expected [] to deeply equal [ '.mcp.json', …(6) ] and
    expected [] to deeply equal [ Array(2) ].
  • Mutation 2, always push them past the ignore rules (also list
    git ls-files --others -- AGENTS.md .mcp.json opencode.json .bob): the second test fails with
    expected [ '.mcp.json', …(6) ] to deeply equal [ Array(2) ].
  • The @moca/mocactl suite (vitest run --minWorkers=1 --maxWorkers=2): 2075 passed, 4
    skipped. 5 failed, all on the 5 s timeout in untouched push/pull tests under machine load. Rerun
    alone, all 5 pass.
  • tsc --noEmit is clean, Prettier is clean, and python3 scripts/check-doc-links.py finds 0
    broken links.

Out of scope

  • No behavior change: the push code is untouched apart from its comment.
  • The SBX0 spec (§6.2/§6.3) is not edited. Specs are point-in-time, and the ADR links to them.

Every commit is signed off (DCO).

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. 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]>
@webchang
webchang requested a review from pdettori as a code owner November 17, 2026 19:05
@pdettori pdettori added the ready-for-ai-review Request automated AI code review from clawgenti label Nov 17, 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.

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.

Comment thread docs/sbx/user-guide.md Outdated
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.

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: 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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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]>
@webchang
webchang merged commit 0114735 into rossoctl:main Nov 17, 2026
17 checks passed
@pdettori pdettori added this to the v0.11.0 milestone Nov 19, 2026
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.

Decide deliberately: should up's agent-config files be pushed to the sandbox? (gitignoring them in #677 changed it by side effect)

3 participants