Skip to content

[Bug]: OpenCode project-local agents are missing from the agent picker #11871

Description

@KostasKgr

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. Create a project-local OpenCode agent at .opencode/agent/readonly.md inside a project's folder, not global config:

    ---
    description: Read-only agent for inspecting the project.
    mode: all
    permission:
      edit: deny
      bash: deny
      todowrite: deny
    ---
    
    You are a read-only agent.
  2. From the project directory, run:

    opencode agent list
  3. Confirm that OpenCode reports the project-local agent:

    build (primary)
    plan (primary)
    readonly (all)
    
  4. Add or open the same directory as a project in T3 Code.

  5. Select the OpenCode provider and open the agent selector.

Expected behavior

T3 Code should include visible project-local OpenCode agents whose mode is primary or all.

The readonly agent should appear alongside the built-in build and plan agents, matching the agents OpenCode reports when invoked from that project directory.

Actual behavior

The project-local readonly agent is absent from the T3 Code agent selector.

The OpenCode provider cache contains only the globally discovered build and plan agents, even though:

  • The chat session is started with the correct project directory.
  • opencode agent list from that directory reports readonly (all).
  • The agent definition is valid and available in the native OpenCode interface.

This appears to happen because OpenCode agent capabilities are cached at the provider-instance level using a discovery directory that can differ from the selected project's directory. Project-local agents are therefore not represented in the cached model capabilities used by the composer.

Impact

Major degradation or frequent failure

Project-specific agents are a supported OpenCode configuration mechanism. Their absence means workflows and permission profiles defined by individual projects cannot be selected through T3 Code.

Version or commit

  • T3 Code: 0.0.40
  • OpenCode: 1.18.31

Environment

Linux, T3 Code web/server mode, OpenCode provider.

Logs or stack traces

# From the affected project:
$ opencode agent list

build (primary)
compaction (primary)
explore (subagent)
general (subagent)
plan (primary)
summary (primary)
title (primary)
readonly (all)

# Agent options represented in ~/.t3/caches/opencode.json:
[
  "build",
  "plan"
]

The corresponding OpenCode session metadata confirms that T3 starts the chat with the affected project as its working directory.

Related issues

Workaround

Use the project-local agent through the native OpenCode tui or web ui. No T3 Code workaround is currently known.

Activity

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

    bugSomething is broken or behaving incorrectly.via-triageFiled through npx t3 triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions