Skip to content

fix(dolt): exit 0 when push/pull finds no remote configured#3194

Open
sjsyrek wants to merge 1 commit intogastownhall:mainfrom
sjsyrek:fix/dolt-push-graceful-no-remote
Open

fix(dolt): exit 0 when push/pull finds no remote configured#3194
sjsyrek wants to merge 1 commit intogastownhall:mainfrom
sjsyrek:fix/dolt-push-graceful-no-remote

Conversation

@sjsyrek
Copy link
Copy Markdown
Contributor

@sjsyrek sjsyrek commented Apr 11, 2026

Summary

Fixes #3031. bd dolt push and bd dolt pull exit 1 when no Dolt remote is configured, causing agent session-close protocols to error out. This changes both commands to exit 0 with an informational message when the error is specifically "remote not found", since the absence of a remote is a valid configuration — not a failure.

Changes Made

  • Added printNoRemoteGuidance() helper in cmd/bd/dolt.go — prints the existing "no remote" guidance to stdout (not stderr) and returns without error. Replaces the duplicated guidance blocks in push and pull.
  • Changed bd dolt push exit behavior — when isRemoteNotFoundErr() is true, calls printNoRemoteGuidance() and returns (exit 0) instead of os.Exit(1). Other errors (diverged history, connection failures) still exit 1.
  • Changed bd dolt pull exit behavior — same treatment: graceful exit 0 on remote-not-found, error exit on everything else.
  • Deduplicated push error handling — the force-push and regular-push branches had identical 15-line "no remote" blocks; now both go through a single error-handling path.
  • Added TestPrintNoRemoteGuidance — verifies the guidance mentions "No remote is configured", "skipping", and how to add a remote.

Backward Compatibility

No behavioral change for configured remotes: push/pull with a valid remote work exactly as before
No behavioral change for other errors: diverged history, connection failures, auth errors still exit 1
Agents benefit immediately: session close protocols that call bd dolt push will no longer fail on fresh workspaces

Technical Details

The key behavioral changes:

Scenario Before After
bd dolt push (no remote) stderr + exit 1 stdout + exit 0
bd dolt pull (no remote) stderr + exit 1 stdout + exit 0
bd dolt push (diverged) stderr + exit 1 stderr + exit 1 (unchanged)
bd dolt push (auth fail) stderr + exit 1 stderr + exit 1 (unchanged)

The guidance text is written to stdout (not stderr) because it's informational, not an error condition.

Size: Small ✓

Two-file change with a net reduction in code (deduplication removes ~20 lines of copy-pasted guidance).

🤖 Generated with Claude Code

bd dolt push and bd dolt pull now exit 0 with an informational message
when no Dolt remote is configured, instead of exiting 1 with an error.
This makes the session close protocol safe for agents to follow
regardless of whether the user has set up Dolt replication.

Also deduplicates the "no remote" guidance that was copy-pasted across
the force-push and regular-push branches into a shared helper, and
applies the same treatment to bd dolt pull.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

bd setup claude injects 'bd dolt push' into session workflow regardless of Dolt mode or remote config

1 participant