[Bug]: OpenCode 2 adapter still passes the thread title at session.create, suppressing OpenCode's native title generation (regression of #13368 on the OpenCode 2 path)

Offen Anfängerfreundlich
#41,748 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
74/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
typescript
Bereich
backend

Rechercherichtung

Beginne in packages/provider-opencode/src/server/v2/adapter.ts etwa bei Zeile 4906, wo session.create mit dem Seed-Titel des Threads aufgerufen wird. Vergleiche mit dem OpenCode-1-Adapter (packages/provider-opencode/src/server/adapter.ts, ca. Zeile 3648) und PR #13368, der den Titel entfernt hat, damit OpenCode seinen eigenen erzeugt. Entferne das Titel-Argument aus dem v2-Aufruf, erstelle dann einen Thread gegen einen OpenCode-2-Server und prüfe über /api/session, dass der Titel nach dem ersten Prompt generiert wird und nicht die erste Nachricht wiederholt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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. Connect T3 Code to an OpenCode 2 server (opencode serve --service, OpenCode 2.4.1).
  2. Create a thread and send a first message.
  3. Check the native session title: opencode api get /api/session (or the OpenCode TUI/web).
Expected behavior

OpenCode 2 generates its own session title after the first prompt (server-side
SessionTitle service in packages/core/src/session/title.ts), like sessions
created from the native OpenCode UI. Auto-titling only runs while the title is
still the New session - <timestamp> fallback (SessionTitle.isUntitled,
packages/core/src/session/runner/llm.ts).

Actual behavior

The native session keeps the thread's seed title (the raw first message),
because the OpenCode 2 adapter passes the thread title at creation —
packages/provider-opencode/src/server/v2/adapter.ts (~line 4906):

const title = threadInput.title?.trim() || undefined;
// A session created with a title is never titled by OpenCode's own model.
const created = yield* client.session.create({
  location: Location.PublicRef.make({ directory: AbsolutePath.make(directory) }),
  model,
  permissions,
  ...(title === undefined ? {} : { title }),
});

The OpenCode 1 adapter behaves correctly since PR #13368
(packages/provider-opencode/src/server/adapter.ts ~line 3648):
client.session.create({ permission }) — no title, with the comment
"OpenCode generates a title only when session.create leaves it unset".
The fix was not carried over to the OpenCode 2 adapter.

Verified independently that OpenCode 2 auto-titling works when the session is
created untitled: a session created via the API (no title) followed by a prompt
received a generated title. Not passing the seed title is therefore sufficient.

Impact

Minor bug or occasional failure

Version or commit

t3 v0.1.11

Environment

Fedora Linux (Atomic/COSMIC); T3 Code mobile app, web and desktop, same
behavior; OpenCode server 2.4.1; provider: OpenCode 2 (adapter server/v2).

Logs or stack traces
$ opencode api get /api/session | jq -r '.data[0] | .title, .location.directory'
<raw first message of the thread> ...
/home/<user>/homelab

Every T3-created OpenCode 2 session has title == first user message
(verified across all recent sessions on the server).

Workaround

Rename the native session manually: opencode api patch /api/session/<id> -d '{"title":"..."}'
(visible in OpenCode web/TUI; it does not sync back to the T3 thread).

Related (separate reports if useful)

Thread renames in T3 do not reach the native OpenCode 2 session
(applyThreadTitle is not implemented by the v2 adapter; done for Claude Code
in PR #34775), and OpenCode-side renames are not synced back to T3.

Vorherrschende Sprache
TypeScript
Sterne
24.8k
Forks
6.4k
Ø Merge
1 Std. 27 Min.
Gemergte PRs (30 T.)
530

Entwicklungsumgebung

In Codespaces öffnen

Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus pingdotgg/t3code

Alle Issues in pingdotgg/t3code

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.