Skip to content

fix(chat): prevent session transcript/plan prefix collisions - #135

Draft
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/critical-bug-investigation-cacc
Draft

fix(chat): prevent session transcript/plan prefix collisions#135
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/critical-bug-investigation-cacc

Conversation

@cursor

@cursor cursor Bot commented Aug 7, 2026

Copy link
Copy Markdown

Summary

  • Fixes a critical cross-session history mix-up: list_transcript_files matched dated transcript names with bare starts_with(session_key), so session s1 also loaded s10-*.jsonl (same class for schedule-1 vs schedule-10).
  • Applies the same boundary rule to list_plan_files and the desktop recent-plan fallback scan.
  • Adds regression tests that fail if prefix-sibling keys are accepted again.

Bug and Impact

  • Trigger: sessions (or schedule keys) where one key is a string prefix of another, with dated files {key}-YYYY-MM-DD.jsonl present for both.
  • Impact: agent chat history / chat_history tool can leak sibling-session messages into the LLM context and return wrong user-facing history; plan listing can surface the wrong session's plans.
  • Desktop transcript reload already used {session_key}-; the executor path used by the agent did not.

Root Cause

Filename convention is {session_key}-{date}.jsonl, but matching used name.starts_with(session_key) without requiring the - boundary after the key.

Fix

  • Match dated transcripts with format!("{}-", session_key) (keep legacy exact {session_key}.jsonl).
  • Match plan stems as exact session_key or {session_key}-….
  • Align desktop recent-plan candidate filter similarly.

Task Linkage

  • Task ID: TASK-2026-071
  • Task folder: tasks/TASK-2026-071-session-transcript-prefix-match/

Injected Specs

  • spec/verification-integrity.md
  • spec/task-artifact-language.md
  • spec/architecture-boundaries.md
  • spec/rust-conventions.md
  • spec/testing-policy.md
  • spec/docs-sync.md (N/A: fail-closed matching only; no docs/env/command surface change)

Validation Evidence

  • Commands executed:
    • cargo test -p skilllite-executor --lib rejects_prefix_sibling_session_keys2 passed
    • cargo test -p skilllite-executor --lib6 passed
    • cargo clippy -p skilllite-executor --all-targets -- -D warnings → clean
    • python3 scripts/validate_tasks.py71 task folders checked passed
  • Key results:
    • s1 listing excludes s10-*.jsonl; schedule-1 excludes schedule-10-*
    • Legacy s1.jsonl / exact plan stems still included

Regression Scope

Docs Sync (EN/ZH)

  • Not needed
  • Updated EN + ZH docs
  • Files:
    • N/A

Review Checklist

  • Acceptance criteria in tasks/TASK-2026-071-session-transcript-prefix-match/TASK.md satisfied
  • STATUS.md updated with validation evidence
  • REVIEW.md includes merge readiness decision
  • tasks/board.md status is up to date
Open in Web View Automation 

cursoragent and others added 3 commits August 7, 2026 11:10
Prevent list_transcript_files and list_plan_files from treating
prefix-sibling keys (s1 vs s10) as the same session when scanning
dated {session_key}-{date} files. Align desktop recent-plan filter
and add regression tests.

Co-authored-by: EXboy <EXboys@users.noreply.github.com>
Record validation evidence, mark TASK-2026-071 done on the board,
and apply rustfmt to the plan listing change.

Co-authored-by: EXboy <EXboys@users.noreply.github.com>
Co-authored-by: EXboy <EXboys@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant