llm.serve receives the V2 session-title request as a normal request (isTitleRequest misses the current prompt)

Aperta Adatta ai principianti
#141 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
backend

Direzione di ricerca

Leggi src/llm/internal.ts e segui come isTitleRequest identifica i prompt per i titoli e come llm.serve instrada le richieste. Confronta i prompt riconosciuti con il prompt V2 nell’issue, quindi esegui la riproduzione con llm.serve e ui.submit("Run a command"). Il lavoro è completato quando la richiesta del titolo viene gestita come tale e serve riceve il prompt effettivo all’indice 0.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

Summary

On a current V2 checkout, llm.serve receives the session-title request as a normal model request. The V2 title prompt is:

You name conversations so the user can find them later in a list of past sessions.

isTitleRequest (src/llm/internal.ts) only matches Generate a title for this conversation: and You are a title generator., so the title request is routed to the serve handler. Its response is discarded by the server, and the next request is the real user prompt.

Scripts that route by index (including the skill's index-based examples) therefore answer the title request with the first turn and the real prompt with the second queued response.

Reproduction

yield* llm.serve((request, index) => {
  console.log(index, JSON.stringify((request as any).body.messages[0]).slice(0, 120))
  if (index === 0)
    return Stream.make(
      Llm.toolCall({ index: 0, id: "call_shell", name: "shell", input: { command: "echo hi" } }),
      Llm.finish("tool-calls"),
    )
  return Stream.make(Llm.text("this becomes the real reply"))
})
yield* ui.submit("Run a command")

Observed: index 0 is {"role":"system","text":"You name conversations so the user can find them later..."} with tools: []; index 1 is the real prompt with the full tool list. The tool never runs and the real prompt gets the fallback text.

Expected

The title request is routed to the title handler (or recognized by isTitleRequest), and serve index 0 is the real prompt.

Environment

  • opencode-drive 2.4.0
  • OpenCode b032f90634 (PR #62977 worktree) and d22bc1d1b6 (origin/dev); title prompt is identical on both
  • Run log: /tmp/opencode-drive/run-1af20744-431a-45e0-b993-c3d43340f503/logs/opencode/log/opencode-local.log

Workaround

Route on the serialized body: if (body.includes("You name conversations so the user can find them later")) return Stream.make(Llm.text("Title")).

Lingua principale
TypeScript
Stelle
41
Fork
9
Merge medio
39m
PR unite (30g)
9

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di anomalyco/opencode-drive

Tutte le issue di anomalyco/opencode-drive

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.