Skip to content

OpenCode 取り込みのロバスト性: 無ガード行パース + 位置カーソルのズレ #21

Description

@senna-lang

概要

OpenCode (SQLite) 取り込みが 1 行の破損で全体を中断し、位置ベースのカーソルで新規ターンを取りこぼす。

詳細

  • 無ガード行パース indexer._load_opencode_raw_entries: json.loads(row["data"]) / _epoch_ms_to_iso(row["time_created"]) が無ガードで、1行破損や NULL が DB 全体 (全プロジェクト/セッション) の取り込みを中断os.path.realpath(row["worktree"]) は NULL で TypeError
  • 位置カーソルのズレ indexer.index_opencode_db: ply_start(time_created, id) 順リストの添字。順序が前後する新規メッセージ到着で添字がシフトし、新規ターンを取りこぼす/旧ターンを再emit (exchange-id dedup が再emitを隠すが新規は欠落)。
  • (関連) sqlite3.connect(f"file:{path}?mode=ro") はパスに ?/#/空白を含むと URI 誤解釈。

修正案

  • 行単位で try/except し破損行はスキップ
  • worktree None ガード
  • カーソルを安定 message id ベースに変更
  • DB パスを percent-encode

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1-highHigh: correctness bugarea:indexbugSomething isn't working

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions