Skip to content

setup_workspace does not ensure fork remote before implementation push #200

Description

@danchild

Problem

When GITHUB_FORK_OWNER is configured (e.g., danchild), the setup_workspace node does not set up the fork remote if fork_owner/fork_repo are not already in workflow state. This means the first implementation run (before any PR is created) has no "fork" git remote, causing push_to_fork() to fall back to origin (the upstream repo), which fails with a 403 permission error:

Fork remote not configured; falling back to origin for push
remote: Permission to forge-sdlc/forge.git denied to danchild.
fatal: unable to access 'https://github.com/forge-sdlc/forge.git/': The requested URL returned error: 403

Root Cause

The fork_owner/fork_repo state values are only populated when the create_pr node runs — which happens after implement_bug_fix. So during the first implementation pass:

  1. setup_workspace checks state.get("fork_owner") → empty
  2. No fork remote is added
  3. implement_bug_fix completes and calls push_to_fork()
  4. _effective_push_remote() finds no "fork" remote → falls back to "origin"
  5. Push to upstream fails with 403

Expected Behavior

setup_workspace should ensure the fork exists (using GITHUB_FORK_OWNER from config) and add the fork remote before implementation, so that all pushes go to the fork.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions