Skip to content

fix(ai-vault): show Copilot sessions under their workspace with the original prompt as title - #31160

Merged
nwparker merged 4 commits into
stablyai:mainfrom
anmol0b:fix/copilot-session-location-and-title
Oct 24, 2026
Merged

nwparker merged 4 commits into
stablyai:mainfrom
anmol0b:fix/copilot-session-location-and-title

Conversation

@anmol0b

@anmol0b anmol0b commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Copilot sessions in Agent Session History could appear under Unknown location with timestamp markup in their titles. The history now uses the recorded launch folder and branch, shows the original prompt, and builds Resume commands for that folder.

What Changed

  • Read session.start.data.context.cwd (falling back to gitRoot) and branch. Legacy folder-trust notices fill only a missing launch directory.
  • Prefer the displayed user content over Copilot's model-facing transformedContent for titles, previews, and the existing transcript consumer. Suppress current_datetime blocks in titles/previews when only transformed content is available.
  • Invalidate the current metadata cache (5→6) and search cache (7→8), so unchanged transcripts acquire the corrected metadata and original message text after updating. Keep current main's addSessionText integration.

Linked Issue

Fixes #30985

Visual Proof

N/A. This changes transcript parsing and cache semantics. Verification uses real JSONL files, the production parser and cached reader, and real SQLite metadata/search stores; no renderer layout changes.

Testing

  • Reproduced on fresh main d9dc87b2fb08 before production edits: six of the original author's seven real-file parser regressions failed. Failures covered missing cwd, trust-notice override, Windows resume location, original prompt selection, and transformed-only datetime markup.
  • The original patch fixes the parser reproduction. A further unchanged-transcript cache regression then reproduced stale parsed/indexed metadata and transformed search messages under today's cache versions.
  • 87 tests passed across seven focused parser, normalization, parse-cache, persistence, search-schema, and search-consumer suites; all 87 passed again on committed head 448299cfbb98.
  • Targeted typecheck passed over all six changed files and their 529-file import/type graph with the repository's node options and explicit existing Node/Electron ambient types. Full project/platform validation remains with fresh CI.
  • Formatting, changed-code-quality (zero new findings in six files), and git diff --check pass.
  • Committed-head verification passed. Independent adversarial source and validation review completed with no blocking findings at 448299cfbb98. Cache rebuild/performance review also found no blocker.

Review

Merge risk: low, following independent adversarial source and evidence review. The material cost is one full metadata/search cache rebuild across agents after upgrade. Search results repopulate through the normal background indexer; transcripts remain the source of truth.

No new path parsing, shell quoting, process launch, IPC, or wire fields. Windows paths pass through to the existing resume-command builder; Unix and Windows resume behavior are covered. Folder workspaces can supply cwd without git metadata. Local, SSH/WSL/server, and mobile consumers keep the same session contract; older hosts retain their parsing until upgraded.

AI Disclosure

Anmol Bhardwaj's original investigation, implementation and tests used Claude Code, as documented in the preserved original commit. Maintainer reproduction, current-main adaptation, cache correction, and review used native Codex agents.

Agent skill upstream boundary

  • Not applicable; no upstream skill-installer source or resources are copied or translated.

Author

Original fix by Anmol Bhardwaj (@anmol0b). Original commit 62cf5e884035 is preserved as an ancestor of this updated PR.

Checklist

  • Current-main bug reproduced before applying the fix
  • Original author and history retained
  • Meaningful parser and persisted-cache regression coverage
  • Cross-platform, remote, mobile, and folder-workspace impact considered
  • Independent adversarial review and committed-head verification
  • Required fresh CI passes

…riginal prompt as title

Copilot sessions in Agent Session History showed "Unknown location" and
titles prefixed with an injected <current_datetime> tag.

The Copilot parser only learned a session's folder from the
"Folder X has been added to trusted folders" notice, which Copilot does
not write for every session. It now reads the launch directory, git
root and branch from session.start's context, and the trust notice only
fills a folder the start did not name, so resume runs in the start
directory as it does for other agents.

User messages now take the original `content` before
`transformedContent`, which carries context Copilot injects.
`current_datetime` joins the hidden blocks so a transformed-only
message still gets a clean title.

Bump the session parse cache schema so histories cached with the old
parser are re-read once instead of keeping the wrong folder and title.

Fixes stablyai#30985
@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

We couldn't safely recover the incremental review. No full review was started, and the last reviewed checkpoint was preserved. Retry later, or explicitly request a full review by commenting @coderabbitai full review.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review.

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 79119c45-4fdb-4842-99e0-21ac63419224
📥 Commits

Reviewing files that changed from the base of the PR and between 98e7dbe and 62cf5e8.

📒 Files selected for processing: 4
  • src/main/ai-vault/session-parse-cache-database.ts
  • src/main/ai-vault/session-scanner-copilot-parser.test.ts
  • src/main/ai-vault/session-scanner-copilot-parser.ts
  • src/main/ai-vault/session-scanner-text-normalization.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Walkthrough

The Copilot session parser now reads the working directory and branch from session context, with fallbacks for the working directory. User-message titles and previews prefer original content over transformed content. Text normalization skips current_datetime blocks. The parse-cache schema version increased from 4 to 5. Tests cover context extraction, fallback behavior, Windows resume commands, and title generation.

Priority: Normal

Severity of issue fixed: Medium

Merge Risk: Minimal · up to 62cf5

The session-location and prompt-display changes are ready to merge after normal checks.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check Warning The description is detailed and covers the main template sections, linked issue, testing, visual proof, AI disclosure, review, and checklist. However, it reports metadata and search cache changes of 5… Correct the cache-version details to match the actual changes, and add the missing Why and Notes sections or clearly incorporate their required information under existing headings. Align file and test-count claims with the committed changes…
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: associating Copilot sessions with their workspace and using the original prompt as the title.
Linked Issues check Passed Issue #30985 is directly linked and remains open. The parser now reads session.start.data.context.cwd, falls back to gitRoot, and records branch. The trusted-folder message only supplies cwd w…
Out of Scope Changes check Passed The changes stay within issue #30985. The seven parser tests verify the requested location, title, fallback, and resume behavior. The normalization update supports removal of the reported injected tag…
Full details: Linked Issues check

Explanation

Issue #30985 is directly linked and remains open. The parser now reads session.start.data.context.cwd, falls back to gitRoot, and records branch. The trusted-folder message only supplies cwd when no start context supplied one. User messages now prefer content over transformedContent. The shared normalization list removes current_datetime blocks from transformed-only text. The cache schema increases from 4 to 5, which invalidates stale cached session meaning. The new tests cover these behaviors and Windows resume paths.

Full details: Out of Scope Changes check

Explanation

The changes stay within issue #30985. The seven parser tests verify the requested location, title, fallback, and resume behavior. The normalization update supports removal of the reported injected tag. The cache version bump supports migration of existing cached histories. No unrelated product behavior or unrelated files are changed.

Full details: Description check

Explanation

The description is detailed and covers the main template sections, linked issue, testing, visual proof, AI disclosure, review, and checklist. However, it reports metadata and search cache changes of 5→6 and 7→8, while the provided changes show only SESSION_PARSE_CACHE_SCHEMA_VERSION changing from 4→5. It also omits explicit Why and Notes sections.

Resolution

Correct the cache-version details to match the actual changes, and add the missing Why and Notes sections or clearly incorporate their required information under existing headings. Align file and test-count claims with the committed changes.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

# Conflicts:
#	src/main/ai-vault-search/session-search-schema.ts
#	src/main/ai-vault/session-parse-cache-database.ts
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.

[Bug] Copilot session history: Unknown location and current_datetime in titles

2 participants