W-22203667: add timestamp, session type, and index to agent preview sessions output#400
Open
andresrivas-sf wants to merge 2 commits intomainfrom
Open
Conversation
…s output W-22203667 - Add `timestamp` (ISO string) and `sessionType` (simulated/live/published) to `session-meta.json` written by `agent preview start` - Introduce `index.json` in the sessions directory to maintain creation-ordered session metadata for easier browsing by humans and agents - Surface new fields as "Started At" and "Session Type" columns in `agent preview sessions` table and JSON output - `listCachedSessions` prefers the index for ordered results, falls back to directory scan for sessions created before this change - Update JSON schema and add tests for index write, removal, ordering, and fallback Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Author
|
The NUT failures in this run are pre-existing and unrelated to this PR's changes. The same assertion failure at |
WillieRuemmele
requested changes
Apr 24, 2026
| const sessionsDir = dirname(historyDir); | ||
| const indexPath = join(sessionsDir, SESSION_INDEX_FILE); | ||
| const index = await readSessionIndex(indexPath); | ||
| if (!index.some((e) => e.sessionId === sessionId)) { |
Contributor
There was a problem hiding this comment.
If we're writing a file in the session history, it should be done in the library, so VSC and plugin conversations save the same data to the same locations
| /** | ||
| * Read the sessions index file, returning an empty array if missing or unreadable. | ||
| */ | ||
| async function readSessionIndex(indexPath: string): Promise<SessionIndex> { |
Contributor
There was a problem hiding this comment.
this should be in the library, reading/writing files
Contributor
|
and then claude review: |
- Fix race condition on concurrent createCache/removeCache calls by using atomic write (temp file + rename) via updateSessionIndex helper - Remove export from SessionIndex type — used only internally - Fix sessionType widening: use SessionType union instead of string in AgentPreviewSessionsResult and resolveSessionType return type - Replace inline import() type annotation with top-level named import - Eliminate double-read in fallback dir scan by capturing displayName during the first pass - Update JSON schema to use $ref for SessionType enum Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
timestamp(ISO string) andsessionType(simulated/live/published) tosession-meta.jsonwritten onagent preview startindex.jsonin the sessions directory to maintain creation-ordered session metadata for easier browsing by humans and agentsagent preview sessionstable and JSON outputlistCachedSessionsprefers the index for ordered results, falls back to directory scan for sessions created before this changeTest plan
yarn test)agent-preview-sessionscommand@W-22203667@
🤖 Generated with Claude Code