Skip to content

fix: use origin remote when fork is not yet configured#197

Open
danchild wants to merge 2 commits into
forge-sdlc:mainfrom
danchild:fix/workspace-fork-remote-fallback
Open

fix: use origin remote when fork is not yet configured#197
danchild wants to merge 2 commits into
forge-sdlc:mainfrom
danchild:fix/workspace-fork-remote-fallback

Conversation

@danchild

@danchild danchild commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Fixes #181

Summary

  • prepare_workspace() defaulted to remote="fork" unconditionally, but on first implementation (before PR creation) the clone only has an "origin" remote
  • git fetch fork failed, falling back to _recreate_workspace_from_fork() which also failed due to missing fork_owner/fork_repo in state
  • Combined with the missing retry_count increment (see fix: increment retry_count when prepare_workspace fails #196), this caused an unbounded retry loop (404 iterations in ~20s on AISOS-2273)
  • Fix: determine effective remote based on whether fork state exists; use "origin" when it doesn't; raise directly on origin sync failures instead of attempting fork recreation

Test plan

  • Existing unit tests pass (test_workspace_setup.py — 7/7, test_implementation.py — 12/12)
  • Verify first-implementation workspace sync uses origin successfully
  • Verify post-PR workspace sync still uses fork remote correctly

🤖 Generated with Claude Code

danchild and others added 2 commits July 23, 2026 15:14
prepare_workspace() defaulted to remote="fork" unconditionally, but on
first implementation (before PR creation) the clone only has "origin".
This caused git fetch fork to fail, falling back to recreation which
also failed due to missing fork_owner/fork_repo state — triggering the
retry loop.

Now determines the effective remote based on whether fork state exists,
and raises directly on origin sync failures instead of attempting the
impossible fork recreation path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Three new tests for the no-fork-state paths:
- uses "origin" remote when fork_owner/fork_repo are not set
- raises directly on origin sync failure instead of attempting fork recreation
- raises ValueError when workspace is missing and fork is not configured

Co-Authored-By: Claude Opus 4.6 <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.

Bug: prepare_workspace defaults to "fork" remote when no fork exists, causing infinite retry loop

1 participant