Skip to content

Fix checkpoint_remote silently falling back to origin on owner mismatch#805

Open
blackgirlbytes wants to merge 1 commit intomainfrom
fix/checkpoint-remote-fork-detection
Open

Fix checkpoint_remote silently falling back to origin on owner mismatch#805
blackgirlbytes wants to merge 1 commit intomainfrom
fix/checkpoint-remote-fork-detection

Conversation

@blackgirlbytes
Copy link
Copy Markdown
Contributor

Summary

  • Removed fork detection skip in resolvePushSettings() — when a user explicitly configures checkpoint_remote, that choice is now respected regardless of owner mismatch between push remote and checkpoint remote
  • Added user-visible stderr warnings for all fallback paths (remote URL lookup failure, URL parse failure, URL derivation failure) so users know when checkpoint_remote is being skipped

Context

When checkpoint_remote was configured (e.g., {"provider": "github", "repo": "alice/checkpoints"}) but the origin remote had a different owner (e.g., org/work-repo), fork detection silently skipped the checkpoint remote and pushed to origin instead. All failure messages went to debug/warn logs in .entire/logs/ — the user had no idea their config was being ignored.

Reproduced with: origin = hydeparksda/invite-automation, checkpoint_remote = blackgirlbytes/genuary2026.

Fixes #800

Test plan

  • Unit tests pass (mise run test)
  • Integration tests pass (mise run test:integration)
  • Lint passes (mise run lint)
  • Updated TestResolvePushSettings_ForkDetection to expect checkpoint URL is set even with owner mismatch
  • Manual verification: configure checkpoint_remote with different owner than origin, push, confirm checkpoints land on checkpoint remote

🤖 Generated with Claude Code

When checkpoint_remote was configured but the origin remote had a different
owner, fork detection silently skipped the checkpoint remote and pushed to
origin instead. Users had no indication their config was being ignored.

Now respects the user's explicit checkpoint_remote configuration regardless
of owner mismatch, and prints visible stderr warnings when fallback occurs
due to URL derivation or parse failures.

Fixes #800

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 328e759b573a
@blackgirlbytes blackgirlbytes requested a review from a team as a code owner March 30, 2026 10:55
Copilot AI review requested due to automatic review settings March 30, 2026 10:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a bug in Entire CLI’s checkpoint remote resolution so that an explicitly configured checkpoint_remote is no longer silently ignored when the push remote owner differs, and it adds user-visible warnings when the tool must fall back to pushing checkpoints to the normal push remote.

Changes:

  • Removed the owner-mismatch “fork detection” skip so checkpoint_remote remains honored even when owners differ.
  • Added stderr warnings for key fallback paths (remote URL lookup/parse/derivation failures).
  • Updated the fork-detection unit test to match the new expected behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
cmd/entire/cli/strategy/checkpoint_remote.go Stops skipping configured checkpoint remotes on owner mismatch; adds stderr warnings when falling back.
cmd/entire/cli/strategy/checkpoint_remote_test.go Updates test expectations so owner mismatch no longer forces fallback to the push remote.

Comment on lines +104 to +105
// Previously this skipped checkpoint_remote entirely (fork detection),
// but the user explicitly configured a checkpoint remote — respect that choice.
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

The behavior here no longer skips checkpoint_remote on owner mismatch, but the function-level comment above resolvePushSettings still states it "Skips if the push remote owner differs". Please update the doc comment to match the new behavior so future readers don't reintroduce the fork-detection skip.

Suggested change
// Previously this skipped checkpoint_remote entirely (fork detection),
// but the user explicitly configured a checkpoint remote — respect that choice.
// We no longer skip checkpoint_remote in this case (previously used for fork detection);
// the user explicitly configured a checkpoint remote, so we always proceed with it.

Copilot uses AI. Check for mistakes.
Comment on lines +493 to +496
// Should proceed with checkpoint remote even when owners differ —
// the user explicitly configured it, respect that choice.
assert.True(t, ps.hasCheckpointURL())
assert.Equal(t, "git@github.com:org/checkpoints.git", ps.pushTarget())
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

The test name TestResolvePushSettings_ForkDetection is now misleading because the expected behavior is to proceed even when owners differ (i.e., fork-detection no longer disables checkpoint_remote). Consider renaming the test to reflect the new requirement (owner mismatch should not cause fallback).

Copilot uses AI. Check for mistakes.
Comment on lines +82 to +83
fmt.Fprintf(os.Stderr, "[entire] Warning: checkpoint_remote is configured (%s) but could not get push remote URL: %v\n", config.Repo, err)
fmt.Fprintln(os.Stderr, "[entire] Checkpoints will be pushed to origin instead. Check your git remote configuration.")
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

The fallback message hard-codes "origin", but resolvePushSettings is called with the remote name passed by the git pre-push hook (not always "origin"). This warning can mislead users when pushing to a different remote; consider referencing pushRemoteName (or wording like "your push remote") instead.

Copilot uses AI. Check for mistakes.
Comment on lines +94 to +95
fmt.Fprintf(os.Stderr, "[entire] Warning: checkpoint_remote is configured (%s) but could not parse push remote URL: %v\n", config.Repo, err)
fmt.Fprintln(os.Stderr, "[entire] Checkpoints will be pushed to origin instead. Check your git remote configuration.")
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

The fallback message hard-codes "origin", but resolvePushSettings may be invoked for other remotes (e.g., when pushing to an alternate remote). Recommend referencing pushRemoteName (or "the push remote") so the stderr guidance is accurate.

Copilot uses AI. Check for mistakes.
Comment on lines +117 to +118
fmt.Fprintf(os.Stderr, "[entire] Warning: checkpoint_remote is configured (%s) but could not derive URL from push remote: %v\n", config.Repo, err)
fmt.Fprintln(os.Stderr, "[entire] Checkpoints will be pushed to origin instead. Check your checkpoint_remote settings.")
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

This fallback warning says checkpoints will be pushed to "origin", but the code actually falls back to pushing to ps.remote (the remote passed into resolvePushSettings). Update the message to avoid implying a specific remote name.

Copilot uses AI. Check for mistakes.
@Soph
Copy link
Copy Markdown
Collaborator

Soph commented Mar 30, 2026

The issue is that the CLI repo has a remote source setup but if you fork it, then you get that setup but have for sure no access to the remote and then the push would also fail. So while this fixes one thing, it makes another thing worse.

I wonder if a better fix is:

  • Skip fork detection if checkpoint_remote is set in settings.local.json (user explicitly configured it)
  • Keep fork detection if it only comes from settings.json (inherited from the repo)

This could be done by checking whether settings.local.json has checkpoint_remote set (using LoadFromFile which already exists), and only applying fork detection when it doesn't. That way the user's explicit local config always wins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

remote checkpoint broken

3 participants