You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: load Coding Moments images across all harnesses - #293
Fix Coding Moments showing image-bearing turns but no loadable screenshots, and fill the missing image-counting and source-loading paths for the other supported harnesses.
Dispatch image loading by the recorded harness source rather than the .jsonl extension.
Support VS Code/Insiders and remote variants, Copilot CLI/App, Claude (including merged and orphan subagents), Codex, OpenCode legacy JSON/current SQLite, and Xcode.
Match screenshots to the exact normalized turn, including Copilot assistant IDs versus user-event attachments, image-only turns, and mirrored Codex events.
Preserve source indexing across cold parsing and cache refresh/reload paths; invalidate older caches.
Extract on demand in the existing parse worker. Limit extraction to four images per turn and 10 MB per image, validate local file paths and image bytes, never fetch remote URLs/network shares, and never modify session logs or retain image payloads in the analytics cache.
Scope gallery caches to both session and request IDs so overlapping request IDs cannot mix up screenshots.
Add parser, source-index, image-limit, worker-lifecycle, Xcode SQLite, RPC, and browser regressions; document harness image support and limits.
Validation (Windows):
npm run check — passed: 82 test files; 1,625 tests passed, 5 skipped (Windows; Ubuntu CI also passed the POSIX-only regressions). Typecheck, lint, spellcheck, knip, and lockfile-lint also passed. Existing lint warnings remain non-blocking.
npm run test:e2e — passed: 110 tests passed, 7 skipped on the preceding implementation. Latest backend-only follow-up: npm run test:e2e -- image-gallery — passed, 3 tests.
npm run build — passed.
npm run check-size — passed: extension bundle 1.63 MB, below the 2 MB budget.
git diff --check — passed.
Native Xcode SQLite -> bundled parse worker -> image data URI smoke test — passed.
The full check required a checksum-verified official SQLite CLI on the validation process's temporary PATH for the existing GitHub App tests. The session-local tools were removed afterward; no dependency manifests or machine-wide settings were changed.
Review follow-up:
Addressed the remaining findings in d300d7c: nonblocking POSIX image opens with native FIFO/replacement regressions, and path-relative containment for Windows drive-root and POSIX-root workspaces. Local full check and Ubuntu CI both pass.
Addressed all seven Copilot review findings in 3b12b79: reject resolved/canonical network paths, support serialized file URIs and fsPath, preserve sibling image bytes, retain richer Codex mirror payloads, keep consecutive image-only turns distinct, and move full session reloads off the extension host with session-scoped OpenCode reads.
Addressed the four additional findings from the follow-up Copilot review in 1700b4e: fallback value bytes, canonical local roots, stable user identities for growing logs, and targeted early-stopping CLI/Codex extraction (zero normalized-request builds for 30 moments).
Addressed the final Claude lookup finding in 31a1a67 with targeted streaming UUID/generated-ID matching, transcript-relative roots, and zero normalized-request builds for 30 Claude images; removed obsolete full-parser collectors.
Addressed the final three reported edge cases in 01cd35d: matched-turn cwd, recursive inline/file fallbacks, and transcript-scoped generated Claude IDs with cache invalidation.
Addressed the additional Code Quality guard diagnostic in c37a69d, with malformed-worker-request coverage.
Addressed all fifteen actionable findings reported across the Copilot reviews, plus the Code Quality diagnostic, with regression tests and follow-up pushes. Inline review threads have been answered and resolved. The complete validation gate and build pass; human review remains requested.
Supersedes #271: this includes the Claude image-extraction/source-index fix and extends it to all supported harnesses. #271 is now closed in favor of this replacement.
Preserve serialized URI and sibling-byte image variables, reject resolved network paths, and reconcile Codex image mirrors without merging distinct image-only user events.
Reload full session details in the existing parse worker and restrict OpenCode detail queries to the requested session. Add regression coverage for all seven Copilot review comments.
Refs #293, #292, #266.
Co-authored-by: Copilot <[email protected]>
Rely on the dispatcher's existing non-null object check at the typed session-source predicate boundary, removing the redundant comparison reported by Code Quality. Verify malformed source descriptors are rejected and subsequent worker jobs still succeed.
Refs #293.
Co-authored-by: Copilot <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Valid symlinked-root images are rejected, and repeated full-session parsing can stall image and detail loading.
No open issues 🎉
2 previously missed issues
In code that hasn't changed since last review
Canonicalize trusted roots before validating image paths
src/core/image-data.ts:200
This checks a canonicalized filename against noncanonical trusted roots. If a workspace root is a symlink or junction to a directory outside the default trusted roots (for example, /work/project → /mnt/project), the first check accepts its images but this check rejects them, so valid screenshots cannot load. Symlinked home or temporary roots have the same problem. Compare the canonical image path against consistently canonicalized allowed roots, preserving network-share rejection and protection against child symlinks escaping those roots. Add a symlinked-root regression.
Avoid reparsing entire sessions for each image request
src/core/session-images.ts:80
Each image request fully reparses the CLI/Codex session, including unrelated responses and tool activity, even after collecting the requested turn. Loading 30 moments from one session therefore scans and rebuilds that session 30 times. The CLI parser explicitly supports multi-GB logs, and these jobs run serially in the same queue as detail reloads. This delays both features and can exceed the webview's 120-second RPC timeout, after which the gallery caches the images as unavailable. Use targeted extraction backed by turn offsets or a bounded per-source index, preserving normalized request IDs and keeping image payloads out of the analytics cache.
Fallback to value bytes when sibling data is empty or invalid
src/core/image-data.ts:67
A valid byte dictionary in value is discarded whenever sibling data is present, even if data is an empty array. The previous value-first extractor loaded this representation; now it returns no image despite the recorded screenshot bytes. Keep data first to preserve the sibling-bytes fix, but retain value as a fallback when decoding data fails. Add a regression with valid value bytes and empty data.
Canonicalize trusted roots before validating image paths
src/core/image-data.ts:200
The canonical image path is checked against noncanonical trusted roots. For a workspace such as ~/project pointing to /mnt/projects/project, the first check passes but this check rejects the screenshot when the target is outside the other trusted roots. The same mismatch affects macOS temporary paths when /var/folders/... resolves under /private/var/folders/.... Canonicalize the allowed local roots for this comparison, while retaining network-path rejection and rejecting attachment symlinks that escape those roots. Add regressions for both cases.
Use stable userEventId for exact attachment matching
src/core/session-images.ts:71
CLI/App request IDs can change while a turn is active: a cached turn may have session:cli:0, but replaying the log after an assistant reply uses that reply's ID instead. The RPC still sends the cached ID, so this comparison misses the unchanged attachment and the gallery caches an empty result. Additional assistant messages can also replace an earlier assistant ID. Pass the cached turn's stable userEventId through the worker protocol for exact attachment matching, with an explicit fallback for records without that ID. Add a regression that appends a reply between parsing and extraction.
Avoid rebuilding entire sessions for every image request
src/core/session-images.ts:80
Every image request rebuilds the entire CLI or Codex session, including unrelated responses and tool analysis. Thirty moments from one log therefore trigger thirty full parses. SessionImageLoader serializes these jobs, so gallery prefetching does not reduce that work and session-detail requests on the same queue must wait behind it. Batch extraction by source or use a targeted extraction path that preserves normalized turn matching without rebuilding every Session for each screenshot.
Retain value-byte fallbacks and canonicalize allowed local image roots without permitting network paths or escaping links. Match active Copilot turns by their cached user-event identity, with explicit index fallback for older records.
Use early-stopping CLI and Codex image scans instead of rebuilding full normalized sessions for every screenshot. Add parity, growing-log, canonical-root, and 30-image request-build regressions for the four follow-up Copilot findings.
Refs #293, #292, #266.
Co-authored-by: Copilot <[email protected]>
Follow-up to Copilot review 5571409865: all four additional findings are fixed in 1700b4e.
Finding
Fix and regression evidence
Valid value bytes lost when sibling data is empty/invalid
Preserve value/URI alternatives and use them when primary data cannot decode; three concrete sibling-data regressions pass.
Canonical local root aliases rejected
Validate against canonical forms of the matching trusted local roots; workspace/temp aliases load, and escaping attachment links and network paths remain rejected.
Active CLI/App turn IDs change after parsing
Pass the cached userEventId and explicit turn index through RPC/worker matching; append-between-parse-and-extract regressions pass for CLI, App, and older ID-less turns.
Full session rebuilt for each image request
Use targeted early-stopping CLI/Codex image scans with shared turn-matching semantics. Thirty-image regressions now build zero normalized requests, versus 900 before the change. Complex Codex tool/token/mirror/abort parity and streaming early-stop tests also pass.
Validation: npm run check passed (82 files; 1,612 passed, 3 skipped), npm run build passed, npm run check-size passed (1.63 MB), git diff --check passed, and npm run test:e2e -- image-gallery passed (3 tests). Requesting a fresh Copilot review and re-running the full browser suite on this head.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Claude image lookups repeatedly rebuild entire transcripts, delaying image and session-detail requests on the shared worker queue.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Avoid reparsing the full session for each Claude image lookup
src/core/session-images.ts:83
Each Claude image lookup invokes the full session parser, rebuilding every normalized request and repeating assistant/tool analysis even after the requested image is collected. Loading 30 moments from an N-turn transcript therefore performs 30 × N request builds; merged subagents also require reparsing preceding files. Image and session-detail jobs share a serialized queue, so this unnecessary work delays both. Add a targeted Claude image scan that stops at the matching user UUID, preserves generated-ID matching, and resolves relative images using the transcript's workspace root. Extend the existing no-request-rebuild regression to cover Claude.
Scan directly to Claude user UUIDs or exact generated request IDs, retaining transcript workspace roots for relative images and merged subagent sources. Extend the 30-image zero-request-build regression to Claude and cover roots recorded after image turns.
Remove obsolete full-parser image collectors now that all JSONL image paths use targeted extraction. Refs #293, #292, #266.
Co-authored-by: Copilot <[email protected]>
Addressed the remaining Claude lookup finding from review 5571709256 in 31a1a67.
Claude screenshots now use a targeted streaming user-turn scan, preserving native UUID and exact generated-ID matching, including merged/orphan subagent sources. Relative image paths use the transcript workspace, including when cwd is first recorded after the image turn. The scan never builds normalized session requests or analyzes assistant/tool output. Removed the now-unused full-parser image collectors.
The 30-image zero-request-build regression now covers Copilot CLI, Codex, and Claude; all three previously produced 900 request builds and now produce zero. The full gate passed: 82 test files, 1,615 tests passed, 3 skipped. Build, 1.63 MB bundle budget, and whitespace checks passed. The full browser suite also passed on the preceding extraction commit (110 passed, 7 skipped); running it again alongside the final review.
All twelve actionable Copilot findings reported across the reviews have now been fixed and pushed on this branch.
Fall back to fileUrl when inline attachment data is invalid
src/core/image-data.ts:65
An Xcode reference containing both a valid fileUrl and empty or invalid data loses its file location here. For example, { fileUrl: 'file:///.../screen.png', data: '' } is counted, but extraction rejects the empty payload without trying the existing file. Preserve the location as a fallback after the inline data, and add a regression for this combination.
Prevent ID collisions across UUID-less parent and subagent turns
src/core/session-images.ts:82
UUID-less parent and subagent turns sharing a sessionId both generate IDs such as <sessionId>:claude:0: buildClaudeRequest restarts the index for each transcript, and merging preserves those IDs. This loop then returns the parent's screenshot for both image-bearing turns, and the gallery's session/request cache key also collides. Make generated IDs transcript-scoped and use the same identity during extraction. Add a regression with distinct parent and subagent images without UUIDs.
Use the matched Claude turn cwd for relative attachments and scope generated request IDs to their transcript to keep UUID-less parent/subagent images distinct. Invalidate older cache identities.
Preserve local-file alternatives when inline attachment data is empty or invalid, including nested image variables. Add regressions for all three remaining Copilot findings. Refs #293, #292, #266.
Co-authored-by: Copilot <[email protected]>
All findings in Copilot review 5571915759 are addressed in 01cd35d:
Relative Claude attachments now prefer the matched user turn's cwd. A two-directory/two-image regression prevents loading the earlier turn's screenshot.
Inline attachment data retains fileUrl/local-location alternatives even when empty or invalid. This also preserves nested image-variable fallbacks; four new regressions cover these paths.
UUID-less Claude request IDs now include deterministic transcript identity, shared by normalization and extraction, so merged parent/subagent turns cannot collide. Distinct-image parent/subagent coverage passes, native UUIDs are unchanged, and older caches are invalidated.
All fifteen actionable findings reported across the Copilot reviews, plus the additional Code Quality diagnostic, now have fixes pushed to this branch. Inline review threads have been answered and resolved.
Final local validation: npm run check passed (82 files; 1,621 tests passed, 3 skipped), npm run build passed, npm run check-size passed (1.63 MB), and git diff --check passed. Waiting for final-head CI and the complete browser-suite rerun; human review from Aymen (@aymenfurter) remains requested.
A drive-root workspace such as D:\ already ends in a separator. Appending another separator makes D:\Screenshots\screen.png fail this prefix check. If no other trusted root covers the attachment, Coding Moments counts it but cannot load it. Use path-relative containment and add a drive-root regression; the same issue affects a POSIX / workspace.
Use nonblocking POSIX file opens before descriptor regular-file validation, including when an attachment is replaced by a FIFO before opening. Use path-relative trusted-root containment so filesystem-root workspaces and Windows drive roots do not fail prefix checks.
Add bounded native FIFO/race regressions, descriptor cleanup checks, and root/sibling/traversal coverage. Refs #293, #292.
Co-authored-by: Copilot <[email protected]>
Addressed the two remaining findings from Copilot review 5572107727 in d300d7c:
FIFO attachments: use nonblocking POSIX opens before descriptor regular-file checks. Rejected descriptors close cleanly and other image candidates still load. Real FIFO and file-to-FIFO replacement regressions run in bounded subprocesses and passed in Ubuntu CI.
Filesystem-root workspaces: replace separator-appending prefix checks with path-relative containment. Windows drive roots (including differing case), POSIX /, exact roots, different drives, sibling directories, and traversal rejection have regression coverage.
Validation:
npm run check — passed on Windows: 82 files, 1,625 tests passed, 5 skipped (including the two POSIX-only FIFO tests).
Ubuntu CI verify — passed, including the native FIFO/replacement tests and POSIX root containment. All latest-head CI checks passed.
npm run test:e2e -- image-gallery — passed, 3 tests.
npm run build, npm run check-size (1.63 MB), and git diff --check — passed.
No runtime dependencies or user-session data were changed. The existing test suite needed a checksum-verified SQLite CLI temporarily on the local validation process PATH; it has not been added to the project or machine-wide settings.
Filesystem-root workspaces lose their root before this assignment. workspaceLocationFromJson strips all trailing slashes, so parseWorkspaceFolderPath returns null for file:/// and D: for file:///D:/. path.normalize cannot restore the missing root separator. Relative screenshots then resolve against the transcript directory or a drive-relative directory instead of the workspace root, leaving images unavailable or selecting the wrong file. Preserve root separators in the JSON and CLI workspace-folder helpers, and add source-registration tests that load a relative image from a filesystem-root workspace; the existing assertTrustedPath tests bypass these helpers.
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
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.
Description
Fix Coding Moments showing image-bearing turns but no loadable screenshots, and fill the missing image-counting and source-loading paths for the other supported harnesses.
.jsonlextension.Validation (Windows):
npm run check— passed: 82 test files; 1,625 tests passed, 5 skipped (Windows; Ubuntu CI also passed the POSIX-only regressions). Typecheck, lint, spellcheck, knip, and lockfile-lint also passed. Existing lint warnings remain non-blocking.npm run test:e2e— passed: 110 tests passed, 7 skipped on the preceding implementation. Latest backend-only follow-up:npm run test:e2e -- image-gallery— passed, 3 tests.npm run build— passed.npm run check-size— passed: extension bundle 1.63 MB, below the 2 MB budget.git diff --check— passed.The full check required a checksum-verified official SQLite CLI on the validation process's temporary PATH for the existing GitHub App tests. The session-local tools were removed afterward; no dependency manifests or machine-wide settings were changed.
Review follow-up:
Addressed the remaining findings in
d300d7c: nonblocking POSIX image opens with native FIFO/replacement regressions, and path-relative containment for Windows drive-root and POSIX-root workspaces. Local full check and Ubuntu CI both pass.Addressed all seven Copilot review findings in
3b12b79: reject resolved/canonical network paths, support serialized file URIs andfsPath, preserve sibling image bytes, retain richer Codex mirror payloads, keep consecutive image-only turns distinct, and move full session reloads off the extension host with session-scoped OpenCode reads.Addressed the four additional findings from the follow-up Copilot review in
1700b4e: fallback value bytes, canonical local roots, stable user identities for growing logs, and targeted early-stopping CLI/Codex extraction (zero normalized-request builds for 30 moments).Addressed the final Claude lookup finding in
31a1a67with targeted streaming UUID/generated-ID matching, transcript-relative roots, and zero normalized-request builds for 30 Claude images; removed obsolete full-parser collectors.Addressed the final three reported edge cases in
01cd35d: matched-turn cwd, recursive inline/file fallbacks, and transcript-scoped generated Claude IDs with cache invalidation.Addressed the additional Code Quality guard diagnostic in
c37a69d, with malformed-worker-request coverage.Addressed all fifteen actionable findings reported across the Copilot reviews, plus the Code Quality diagnostic, with regression tests and follow-up pushes. Inline review threads have been answered and resolved. The complete validation gate and build pass; human review remains requested.
Related Issues
Fixes #292.
Fixes #266.
Supersedes #271: this includes the Claude image-extraction/source-index fix and extends it to all supported harnesses. #271 is now closed in favor of this replacement.
Checklist
npm run checkpasses (typecheck + lint + spellcheck + knip + tests)