Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

v2: sessions with path=NULL (around v1's add_session_path schema change) are missing from project session lists

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

Hướng nghiên cứu

Bắt đầu với packages/core/src/session/store.ts quanh dòng 108 và so sánh bộ lọc theo phạm vi dự án với packages/opencode/src/session/session.ts quanh các dòng 970-976. Kiểm tra cách SessionStore.list xử lý một đường dẫn con gốc và tái hiện truy vấn đối với các hàng mà path IS NULL. Được xem là hoàn tất khi các phiên gốc được gán đúng xuất hiện trong danh sách dự án mà không thay đổi hành vi của tất cả dự án.

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

Mô tả

Description

Sessions with path = NULL are missing from project session lists after the v1→v2 upgrade, even though their project_id is correct.

v1 began with no path column; 20260428004200_add_session_path added it (default NULL), and v1's inserts still left it NULL for root-level sessions for a while (in our DB: a clean NULL window 2026-04-03→05-05, with every later session writing ''). The v1→v2 importer copies path verbatim, so these rows arrive in session_v2 with path IS NULL. The project-scoped picker sends {project, subpath: ''} and SessionStore.list filters with an exact eq(SessionTable.path, input.subpath) (packages/core/src/session/store.ts:108) — in SQL, NULL = '' is not true, so the rows are excluded. The projector only rewrites the path of the session that triggered a Resolved event; historical rows are never backfilled.

Scope in our DB (opencode 2.0.14, upgraded from 1.18.x): 90 sessions — 88 in one git repo (87 top-level, mostly user-initiated forks, ~1,300 messages total) + 2 in a second repo. All have directory = project.worktree, so the correct value is ''. They are only reachable via "all projects" scope / global search.

This is a different defect from #50980 (where the row is absent from session_v2 entirely) and from the project_id='global' family (#50551, #50800, #50999): here the project attribution is right, only path is null.

Plugins

None relevant (server-side data/filter behavior).

OpenCode version

2.0.14 (affected, by source comparison: 2.0.14–2.0.16; not fixed on latest tag)

Steps to reproduce
  1. In opencode v1, create sessions in a git repo root during the window where v1 didn't write path (around the 20260428004200_add_session_path change — e.g. after the path column exists but before v1 started writing '').
  2. Upgrade to v2.0.14–2.0.16 and open that repo. The import copies path = NULL into session_v2.
  3. List sessions in the project: the NULL-path sessions don't appear, though "all projects" scope shows them.

Check your own DB:

SELECT project_id, directory, COUNT(*) FROM session_v2 WHERE path IS NULL GROUP BY 1, 2;
Expected Behavior

Sessions whose directory equals the project worktree should be listed at subpath = '', i.e. NULL should be treated as the empty path (the dev branch already adds this: and(isNull(path), eq(directory, …)) at packages/opencode/src/session/session.ts:970-976).

Related issues
  • #35750 — v1-era: new path column not back-filled during migration (origin of these NULLs)
  • #50980 — sister symptom: v1-era session missing from session_v2 entirely
  • #50551 — the project_id='global' family (different root cause, same picker filter)
Operating System

Arch Linux, x86_64

Terminal

kitty

Ngôn ngữ chính
TypeScript
Star
210k
Fork
27.8k
Merge trung bình
8 giờ 1 phút
Pull request đã merge (30 ngày)
357

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.