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

Đang mở Phù hợp với người mới
#141 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
78/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
backend

Hướng nghiên cứu

Đọc src/llm/internal.ts và theo dõi cách isTitleRequest nhận diện các prompt tiêu đề cũng như cách llm.serve định tuyến các yêu cầu. So sánh các prompt được nhận diện với prompt V2 trong issue, sau đó chạy tái hiện bằng llm.serve và ui.submit("Run a command"). Hoàn tất khi yêu cầu tiêu đề được xử lý như một yêu cầu tiêu đề và serve nhận prompt thực tế ở chỉ mục 0.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
TypeScript
Star
41
Fork
9
Merge trung bình
39 phút
Pull request đã merge (30 ngày)
9

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của anomalyco/opencode-drive

Tất cả issue của anomalyco/opencode-drive

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.