opencode-native panics on session ID after a multibyte character

Đang mở Phù hợp với người mới
#64,389 1 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

@18o đang làm issue này rồi.

Từ ngày 17/11/2026.

  • #64390 của @18o — đang mở

Đá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
79/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ệ
rust
Lĩnh vực
cli, testing-qa

Hướng nghiên cứu

Bắt đầu tại crates/tui/src/features/session_links.rs ở mentions(), đặc biệt là phần kiểm tra tiền tố gần dòng 241, sau đó chạy trình tái hiện tối thiểu từ issue. Kiểm tra các bài kiểm thử lân cận về phân tích liên kết phiên và bổ sung phạm vi kiểm thử cho một ký tự nhiều byte đứng trước ID phiên; công việc được xem là hoàn tất khi đầu vào đó không còn gây panic và ID phiên được xử lý chính xác.

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

Mô tả

area/tui platform/macos status/repro-plausible type/bug version/v2
Description

opencode-native (Rust client on the oc-rust branch) panics while rendering a session message that contains a session ID after a multibyte character:

panicked at crates/tui/src/features/session_links.rs:241:37:
start byte index 83 is not a char boundary; it is inside '现' (bytes 82..85 of string)

mentions() checks the optional @session: prefix by slicing text[at - PREFIX.len()..at]. When no prefix is present, that byte offset can land inside a multibyte character. The TypeScript reference uses a regex and does not crash.

Plugins

None relevant; the JS host was off.

OpenCode version

Local cli-rs build from origin/oc-rust (d1df62cd7b), reported as opencode-native vlocal; server 2.2.0.

Steps to reproduce
  1. Build with bun run --cwd packages/cli-rs cargo build --release --bin opencode-native.
  2. Open a session whose Markdown contains a session ID after a multibyte character, e.g. 现abcd文ses_knownknownknownknownknownk.
  3. The TUI panics in the session-links inline hook during set_markdown.

Minimal unit reproducer: mentions("现abcd文ses_knownknownknownknownknownk").

Screenshot

Not applicable; terminal panic and the log entry are described above.

Operating System

macOS arm64

Terminal

Ghostty

Ngôn ngữ chính
TypeScript
Star
227k
Fork
30.7k
Merge trung bình
4 giờ 35 phút
Pull request đã merge (30 ngày)
498

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

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

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

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.