GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — vcs: branch lists omit valid names ending in /HEAD · Issue #65586 · anomalyco/opencode

vcs: branch lists omit valid names ending in /HEAD #65586

New issue
Copy link
New issue
Copy link
Done
#65904
Done
vcs: branch lists omit valid names ending in /HEAD#65586
#65904
Copy link
Labels
area/coreAgent loop, tools and configplatform/windowsWindowsreproducedtype/bugSomething is brokenversion/v2OpenCode 2.x

Description

@chirag127
chirag127
opened on Nov 22, 2026
Issue body actions

Description

The built-in Git branch list drops valid branch names ending in /HEAD.

At dev 10144b53c34c6d1b9c15b1e62fad9e87e1efb673, VcsGit.branches shortens both local and remote refs, then rejects every name satisfying item.endsWith("/HEAD"). This excludes topic/HEAD and origin/topic/HEAD as well as the intended origin/HEAD alias.

A retained disposable Git fixture on Git 2.56.0.windows.4 accepted and emitted both direct refs. Only refs/remotes/origin/HEAD had a symbolic target. The OpenCode omission is derived from the current source predicate; the adapter/API and branch-picker UI have not been executed on that fixture.

Expected: list and search the two real branches while omitting the remote default-branch alias. This extends the correction in #58597, which removed bare remote names and fixed remote-branch search.

Plugins

Built-in Git VCS adapter. No third-party plugins were exercised by the retained Git fixture.

OpenCode version

Source audit of dev 10144b53c34c6d1b9c15b1e62fad9e87e1efb673, read 2026-11-22. Installed 2.3.2 was reported separately; affected installed-release behavior is unverified.

Steps to reproduce

Proposed OpenCode verification; the Git input setup was previously exercised:

  1. In a disposable repository with an initial commit, create local branch topic/HEAD and direct remote refs refs/remotes/origin/main and refs/remotes/origin/topic/HEAD at that commit.
  2. Set symbolic ref refs/remotes/origin/HEAD to refs/remotes/origin/main.
  3. Invoke the built-in VCS branch list with search topic.

Expected: topic/HEAD and origin/topic/HEAD. The inspected filter excludes both. A regression should also verify that origin/HEAD remains omitted, preserving search, ordering and limit behavior.

Screenshot

No UI capture. The evidence is the pinned production predicate and retained real-Git input oracle.

Operating System

Windows NT 10.0.26200, x64. The input oracle used Git 2.56.0.windows.4; no other platform was exercised.

Terminal

Unknown; source/Git-fixture report. Current diagnostic shell was reported as PowerShell 5.1.26100.9818.

Activity

  1. opencodejr
    added
    area/coreAgent loop, tools and config
    platform/windowsWindows
    type/bugSomething is broken
    version/v2OpenCode 2.x
    on Nov 22, 2026
  2. opencodejr commented on Nov 22, 2026

    @opencodejr
    opencodejrBot
    on Nov 22, 2026
    Contributor
    More actions

    Thanks for the precise report. I reproduced this on the released 2.3.2 CLI, and it still happens on the latest dev (8a836dd).

    What I did: I made a test repo with local branch topic/HEAD, direct remote refs origin/main and origin/topic/HEAD, and origin/HEAD as a symbolic ref pointing at origin/main. Then I started opencode serve and queried GET /api/vcs/branch:

    • ?search=topic returned "data":[], so both topic/HEAD and origin/topic/HEAD were missing.
    • With no search it returned ["main","origin/main"].

    Leaving out origin/HEAD is correct, but the two real branches shouldn't be dropped. The script below reproduces it.

    The cause looks like the one you pointed to: VcsGit.branches in packages/core/src/plugin/vcs/git.ts filters on !item.endsWith("/HEAD") after stripping the ref namespace. That catches every branch name ending in /HEAD, not just the remote default-branch alias.

    Reproduction script (repro.sh)
    #!/usr/bin/env bash
    # Reproduces #65586: /api/vcs/branch drops real branches whose names end in /HEAD.
    # Usage: OPENCODE="opencode" ./repro.sh   (or OPENCODE="bun ... packages/cli/src/index.ts")
    set -euo pipefail
    OPENCODE=${OPENCODE:-opencode}
    PORT=${PORT:-4517}
    R=$(mktemp -d /tmp/opencode/headrepo.XXXX)
    cd "$R"
    git init -q -b main
    git -c user.email=a@b -c user.name=a commit -q --allow-empty -m init
    git branch topic/HEAD
    git update-ref refs/remotes/origin/main HEAD
    git update-ref refs/remotes/origin/topic/HEAD HEAD
    git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main
    echo "--- git for-each-ref"
    git for-each-ref --format='%(refname) %(symref)' refs/heads refs/remotes
    export HOME=$(mktemp -d /tmp/opencode/home.XXXX)
    $OPENCODE serve --port "$PORT" --hostname 127.0.0.1 >/tmp/opencode/serve.log 2>&1 &
    PID=$!
    trap 'kill $PID 2>/dev/null || true' EXIT
    for i in $(seq 1 60); do grep -q "server password" /tmp/opencode/serve.log && break; sleep 1; done
    PW=$(sed -n 's/.*server password //p' /tmp/opencode/serve.log | head -1)
    get() { curl -s -u "opencode:$PW" -H "x-opencode-directory: $R" "http://127.0.0.1:$PORT$1"; echo; }
    get /api/vcs/branch >/dev/null; sleep 3
    echo "--- GET /api/vcs/branch?search=topic"
    get "/api/vcs/branch?search=topic"
    echo "--- GET /api/vcs/branch"
    get /api/vcs/branch

    Run it: bash repro.sh

  3. opencodejr
    added
    reproduced
    on Nov 22, 2026
  4. ccclucky commented on Nov 22, 2026

    @ccclucky
    ccclucky
    on Nov 22, 2026
    More actions

    Fixed in #65622: the branch list now reads %(symref) and drops only refs that point at another ref, so the remote default-branch alias stays hidden while real branches such as topic/HEAD and origin/topic/HEAD are listed and searchable. The new live test covers both refs plus the symref.

  5. hearnadam
    closed this as completedin #65904on Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/coreAgent loop, tools and configplatform/windowsWindowsreproducedtype/bugSomething is brokenversion/v2OpenCode 2.x

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.