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

Abierto Apto para principiantes
#141 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
78/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
typescript
Área
backend

Línea de trabajo

Lee src/llm/internal.ts y sigue cómo isTitleRequest identifica los prompts de título y cómo llm.serve enruta las solicitudes. Compara los prompts que reconoce con el prompt V2 del issue y luego ejecuta la reproducción con llm.serve y ui.submit("Run a command"). Se considera terminado cuando la solicitud de título se trata como tal y serve recibe el prompt real en el índice 0.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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")).

Lenguaje dominante
TypeScript
Estrellas
41
Forks
9
Merge medio
39 min
PR fusionados (30 d)
9

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de anomalyco/opencode-drive

Todos los issues de anomalyco/opencode-drive

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.