Skip to content

feat(git): land a box branch on the host without publishing (git push --host-only)#130

Merged
madarco merged 2 commits into
nightlyfrom
feat/git-push-host-only
Jun 29, 2026
Merged

feat(git): land a box branch on the host without publishing (git push --host-only)#130
madarco merged 2 commits into
nightlyfrom
feat/git-push-host-only

Conversation

@madarco

@madarco madarco commented Jun 29, 2026

Copy link
Copy Markdown
Owner

What

Adds a --host-only flag to agentbox git push <box> (host CLI) and the in-box agentbox-ctl git push. It makes the box's branch available in the host's local repo without pushing to any remote — nothing is published online. Useful for pulling a box's work onto your laptop to git checkout / keep iterating / review before deciding whether to publish.

agentbox git push mybox --host-only                 # land under the box's branch name
agentbox git push mybox --host-only --as feat/login # ...under a chosen name
agentbox git push mybox --host-only --as feat/login --force  # allow non-ff overwrite
# in-box:
agentbox-ctl git push --host-only [--as <branch>] [--force]
  • Destination branch defaults to the box's current branch name; --as <branch> overrides it.
  • Fast-forward-only by default; --force permits a non-ff overwrite.
  • --host-only is incompatible with --remote (exit 64).

How

Same git.push RPC method with a new params.hostOnly (+ as/force). Because nothing leaves the host, the relay skips the push-confirm gate / host-initiated-token path entirely (that gate guards remote pushes).

  • Docker (handleGitSaveToHost, server.ts): the box commits already live in the bind-mounted .git/, so it copies the box branch to refs/heads/<dest> via a self-fetch (git -C <hostMainRepo> fetch . <src>:refs/heads/<dest>). dest == src → no-op success.
  • Cloud (runGitRpc short-circuit, host-actions.ts): reuses the push flow's git-bundle pull-back (bundle in sandbox → download → git fetch <bundle> <src>:refs/heads/<dest>) without the final remote push. Covers all four cloud providers (daytona/hetzner/vercel/e2b) via the shared CloudBoxPollerexecuteCloudAction path.

Docs

Updated the in-box agent system prompt (custom-system-CLAUDE.md, all 5 providers) and docs/host-relay.md, docs/features.md, apps/web/content/docs/{cli,sync-and-git}.mdx.

Verification (docker, live)

  • --host-only --as host-landed → branch lands at the box tip on the host; git ls-remote origin host-landed is empty (not published).
  • default name (no --as) → no-op "already available".
  • in-box agentbox-ctl git push --host-only --as inbox-landed → lands on host.
  • non-ff destination → rejected (exit 1) without --force; forced update with --force.
  • --host-only --remote origin → rejected (exit 64).

pnpm typecheck (25/25), pnpm lint (13/13), relay (187) + ctl (296) unit tests all green.

https://claude.ai/code/session_01TmyXca2hNF9TtK6q9MAh1L


Note

Medium Risk
Touches relay git.push gating and ref updates on the host repo; behavior is scoped to a new flag but incorrect ref handling could overwrite local branches.

Overview
Adds git push --host-only on agentbox git push <box> and in-box agentbox-ctl git push, so a box branch can be copied into the host’s local repo without pushing to any remote. Optional --as <branch> picks the destination ref (default: the box branch); --force allows a non–fast-forward overwrite. --host-only with --remote is rejected (exit 64).

The same git.push RPC now carries hostOnly / as / force. Because nothing is published, the relay skips the push-approval gate and host-initiated token path. Docker lands via handleGitSaveToHost (self-fetch into refs/heads/<dest>); cloud reuses bundle pull-back in runGitRpc without the final remote push.

The host CLI skips token minting for --host-only; ctl buildParams maps host-only force to RPC params and re-appends --force for normal remote pushes (new unit tests). Docs and in-box agent prompts are updated across providers.

Reviewed by Cursor Bugbot for commit 2ab9f58. Configure here.

… --host-only)

Add a `--host-only` flag to `agentbox git push <box>` and in-box
`agentbox-ctl git push` that makes the box's branch available in the host's
*local* repo without pushing to any remote — nothing is published online.

The destination branch defaults to the box's current branch name; `--as
<branch>` overrides it and `--force` allows a non-fast-forward overwrite.
`--host-only` is incompatible with `--remote` (exit 64).

Because nothing leaves the host, the relay skips the push-confirm gate /
host-initiated-token path entirely. Docker copies the box branch ref within the
shared bind-mounted `.git/` via a self-fetch (`handleGitSaveToHost`); cloud
reuses the push flow's git-bundle pull-back, stopping before the remote push
(`runGitRpc` short-circuit), so all four cloud providers are covered.

The in-box agent system prompt (custom-system-CLAUDE.md, all providers) and the
docs (host-relay, features, web cli/sync-and-git) document the new mode.

Claude-Session: https://claude.ai/code/session_01TmyXca2hNF9TtK6q9MAh1L
@vercel

vercel Bot commented Jun 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
agentbox-web Skipped Skipped Jun 29, 2026 11:05pm

Request Review

Comment thread apps/cli/src/commands/git.ts
Making `--force` a known option on `push` (for `--host-only`) meant Commander
consumed it for every push, but only the host-only path forwarded it — a normal
`agentbox git push <box> --force` silently dropped `--force` (`params.force` is
only honored on the host-only land path). Re-append `--force` to the forwarded
git args on a remote push, in both the host CLI and in-box ctl, so the relay
appends it to `git push <remote> <branch>`. The host CLI's predicted params
hash stays in lockstep with ctl's normalized args tail.

Add a pure unit test for ctl's buildParams covering remote --force re-forwarding
vs host-only params.

Verified live (docker): non-ff push rejected without --force (exit 1, remote
unchanged), forced update succeeds with --force; host-only land still works.

Claude-Session: https://claude.ai/code/session_01TmyXca2hNF9TtK6q9MAh1L
@madarco

madarco commented Jun 29, 2026

Copy link
Copy Markdown
Owner Author

bugbot run

@cursor cursor Bot 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.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 2ab9f58. Configure here.

@madarco madarco merged commit 2ab9f58 into nightly Jun 29, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant