Skip to content

V2 regression: explicitly attached reference loses its resolved path #41443

Closed

Description

@soetang

Description

In V2, explicitly selecting a configured reference with @alias attaches its root directory listing, but the agent does not receive the reference's resolved checkout path. The agent therefore cannot reliably read files inside the reference.

The same configuration works in V1. After selecting @harness-engineering, the V1 agent reads files directly from the cached repository under:

~/.local/share/opencode/repos/github.com/lopopolo/harness-engineering/

In V2, the reference is displayed as a directory and its root listing is attached, but the agent may incorrectly look for harness-engineering inside the active project.

Configuration:

{
  "references": {
    "harness-engineering": {
      "repository": "lopopolo/harness-engineering",
      "branch": "trunk"
    }
  }
}

Prompt:

Tell me more about @harness-engineering

The missing description is intentional. The reference should only enter context when explicitly selected, not be advertised in every agent prompt.

Adding a description makes V2 inject the reference's resolved path into the system prompt, and follow-up reads then work. This workaround changes the intended behavior because the reference becomes part of the system prompt.

Explicitly selecting a reference should preserve its resolved path for that request without requiring a description.

Plugins

None

OpenCode version

opencode2 v0.0.0-next-17055

The same configuration works in OpenCode V1.

Steps to reproduce

  1. Configure a Git reference without a description.
  2. Start OpenCode V2 in the configured project.
  3. Select the reference using @alias.
  4. Ask the agent to inspect or summarize the reference.
  5. Observe that the root listing is attached, but the agent cannot locate files inside the cached repository.
  6. Add a description to the reference and repeat. The resolved path is added to agent guidance and the reads work.
  7. Repeat without a description in V1. The agent reads files directly from the resolved reference checkout.

Operating System

WSL2, Linux 5.15.167.4-microsoft-standard-WSL2

Terminal

OpenCode TUI, xterm-256color, zsh

Activity

  1. opencode-agent commented on Aug 12, 2026

    @opencode-agent
    Contributor

    Addressed by #41789. V2 canonical message lowering now decodes durable local file: source URIs and includes the resolved directory path in reference context while preserving the attachment content and alias. Focused prompt and provider-boundary tests cover the reference-shaped directory case on POSIX and Windows. Closing as resolved on the v2 branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions