Skip to content

task_create opens issues on upstream repo when gh infers laurentenhoor/devclaw from checkout context #95

@fujiwaranosai850

Description

@fujiwaranosai850

Summary

DevClaw can route GitHub tracker operations to the wrong repository when a project is configured against a fork but the local checkout has mixed origin / upstream remotes.

The problem is broader than task_create alone.

In this environment, the devclaw project is registered against yaqub0r/devclaw, but GitHub operations have drifted toward laurentenhoor/devclaw when ambient gh repository inference was allowed to win over project configuration.

The real bug appears to be that GitHub tracker operations do not consistently use the configured project repository as the single source of truth.

Expected behavior

If the DevClaw project entry points to a specific GitHub repository, all GitHub tracker operations should target that configured repository.

For this project, GitHub tracker operations should target:

  • yaqub0r/devclaw

and should never drift to:

  • laurentenhoor/devclaw

unless that upstream repo is explicitly configured for the project.

Actual behavior

Observed drift has included at least:

  • task_create creating an issue on:
    • laurentenhoor/devclaw#529
  • downstream tracker paths later failing against upstream instead of the configured fork, for example:
    • HTTP 404: Not Found (https://api.github.com/repos/laurentenhoor/devclaw/labels)
  • follow-up regression from an over-broad fix attempt:
    • task_comment failed: unknown flag: --repo

So the failure mode is not just “issue creation went to the wrong repo”.
It is a broader repository-targeting contract problem inside the GitHub provider.

Environment details

Project registry entry:

  • workspace devclaw/projects.json shows repoRemote: https://github.com/yaqub0r/devclaw

Local git remotes in /home/sai/git/devclaw:

  • origin = https://github.com/yaqub0r/devclaw.git
  • upstream = https://github.com/laurentenhoor/devclaw.git

Important clue from the affected environment:

  • gh repo view in that checkout resolved to upstream rather than the fork

This means ambient GitHub CLI repo inference in the checkout can prefer upstream even though the DevClaw project registry points at the fork.

Reproduction

  1. Register/link a DevClaw project whose configured GitHub target is a fork, for example yaqub0r/devclaw.
  2. Use a local checkout whose git remotes include both:
    • origin = fork
    • upstream = canonical upstream
  3. Ensure ambient GitHub CLI repo inference resolves to upstream rather than the configured fork.
  4. Run GitHub-backed DevClaw tool paths.
  5. Observe tracker operations can drift to upstream or fail because they are targeting the wrong repo.

Current understanding of scope

This issue should be treated as a GitHub provider targeting problem, not only a task_create bug.

Potentially affected GitHubProvider behavior includes:

  • issue creation
  • issue reads / edits / closes / reopens
  • label management and transition paths
  • issue comments
  • PR listing / merge / diff / status helper paths
  • reactions
  • GraphQL repo lookup paths
  • attachment upload paths

The underlying contract should be:

the configured project repo is the source of truth for all GitHub tracker operations

and DevClaw should not rely on ambient checkout-based gh repo inference when project config already specifies the tracker target.

Likely root cause

The GitHub issue/provider path appears to rely too heavily on ambient gh repository inference instead of consistently deriving the target repo from registered project configuration.

There is also an important command-family distinction:

  • gh issue, gh pr, gh label, and gh repo can use command-specific explicit repo targeting
  • gh api must not be treated exactly the same way as gh issue / gh pr

A blanket “append --repo everywhere” fix is not correct.

Recommended fix

In the GitHub provider layer:

  • resolve the target repo from the registered project config
  • thread that target explicitly through GitHub provider operations
  • do not rely on checkout-context inference once project config specifies the repo
  • implement explicit targeting in a command-family-aware way
  • ensure gh api paths use a valid explicit-targeting strategy rather than inheriting gh issue / gh pr flag behavior

Acceptance criteria

  • the configured project repo is the single source of truth for GitHub tracker routing
  • mixed origin / upstream remotes do not cause tracker-routing drift
  • task_create creates issues on the configured project repo
  • label-management / transition paths use the configured project repo
  • representative issue-comment and PR-related provider paths use the configured project repo
  • no GitHub provider path relies on ambient checkout repo inference when project config already specifies the repo
  • gh api paths are handled with a valid explicit-targeting strategy and do not fail from invalid --repo injection

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions