Skip to content

Command incorrectly reports "main" as default branch when repository uses "master" #468

@cvjxendra

Description

@cvjxendra

Summary

Description:

The automated environment context injected into agent sessions contains incorrect branch metadata. Specifically, the context block states:

│ "Main branch (you will usually use this for PRs): main"

However, the actual repository's default branch is master. This has caused repeated failures across multiple model sessions when agents attempt to run git commands against main, resulting in fatal: Not a valid object name main errors.

Impact:

  • Agents cannot perform merge checks (git diff main..HEAD, git merge-tree, etc.) without explicit user correction
  • Forces user intervention on every session to override incorrect branch assumptions
  • Breaks automated workflows that depend on accurate default branch detection

Expected Behavior

Command should detect the actual default branch from the repository (git symbolic-ref refs/remotes/origin/HEAD or similar) rather than hardcoding or assuming main.

Actual Behavior

The automated environment context injected into agent sessions contains incorrect branch metadata. Specifically, the context block states:

│ "Main branch (you will usually use this for PRs): main"

However, the actual repository's default branch is master. This has caused repeated failures across multiple model sessions when agents attempt to run git commands against main, resulting in fatal: Not a valid object name main errors.

Steps to reproduce the issue

Just ask for a review. I tryed using Kimi 2.6, Qwen3.7 Max. Just happens with cmd. Works everytime with OpenCode.

Command Code Version

0.33.0

Operating System

Linux

Terminal/IDE

CLI

Shell

bash

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions