opencode-native panics on session ID after a multibyte character

未关闭 适合新手
#64,389 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@18o 已经在做这个了。

开始于 2026年11月17日。

  • #64390 来自 @18o —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
79/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
rust
领域
cli, testing-qa

调研方向

从 crates/tui/src/features/session_links.rs 中的 mentions() 开始,尤其检查第 241 行附近的前缀检查,然后运行 issue 中的最小复现程序。查看相邻的会话链接解析测试,并添加会话 ID 前有一个多字节字符的测试覆盖;完成标准是该输入不再触发 panic,且会话 ID 得到正确处理。

由索引模型根据 Issue 内容生成。

描述

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

主要语言
TypeScript
星标
227k
派生
30.7k
平均合并
4 小时 35 分钟
30 天内合并 PR
498

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

anomalyco/opencode 的其他 Issue

查看 anomalyco/opencode 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。