feat(expose): warm previews from project cache#369
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughChangesAdds an in-memory tmux preview cache with lifecycle management, periodic refresh, failure resilience, and project-root normalization. Metadata and daemon expose responses include available per-window preview snapshots when requested. Expose preview snapshots
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant MetadataServer
participant ExposePreviewCache
participant TmuxRuntimeManager
Client->>MetadataServer: request switchable agents with includePreview=1
MetadataServer->>ExposePreviewCache: track items and read snapshots
ExposePreviewCache->>TmuxRuntimeManager: capture target output asynchronously
TmuxRuntimeManager-->>ExposePreviewCache: return captured output
ExposePreviewCache-->>MetadataServer: return preview snapshot
MetadataServer-->>Client: serialized item with preview snapshot
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/expose-preview-cache.ts`:
- Around line 79-83: Prevent trackedTargets from retaining dead windows
indefinitely by adding failure-based eviction to the refresh/capture flow around
trackItems and refresh. Track consecutive capture failures per target, remove a
target after repeated failures, and ensure successful captures reset its failure
state; add a test verifying a repeatedly failing target is eventually dropped.
- Around line 93-100: Remove the synchronous tmux capture from
ExposePreviewCache.refresh by making the refresh/capture flow asynchronous and
updating TmuxRuntimeManager.captureTarget to use a non-blocking execution
mechanism. Ensure schedule handles the asynchronous refresh completion and
errors without blocking the event loop, while preserving timer cleanup and
refresh behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 29afdfdc-0de5-466d-9cb3-91a84c137fae
📒 Files selected for processing (5)
src/daemon.tssrc/expose-preview-cache.test.tssrc/expose-preview-cache.tssrc/metadata-server.test.tssrc/metadata-server.ts
|
Sub-agent review finding fixed in 7a40995: preview snapshots are now gated behind |
|
Sub-agent review finding fixed in c4dacb0: preview warming now captures only the current |
|
Sub-agent review finding fixed in c4dacb0: the preview cache no longer prunes scoped route items against a context-free |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/expose-preview-cache.ts`:
- Around line 86-92: Update the pruning logic in the target-tracking flow to
delete each removed window’s entry from snapshots alongside trackedTargets and
failureCounts. In the capture completion and rejection handlers, verify that the
current tracked target for the window is the same target object that initiated
the capture before mutating snapshots or failure state, preventing stale
in-flight results from repopulating cache state. Add a regression test covering
a demand swap while capture is in flight.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 8be63af5-eb3b-47fc-9c39-8dfa0940d8e0
📒 Files selected for processing (3)
src/expose-preview-cache.test.tssrc/expose-preview-cache.tssrc/metadata-server.ts
💤 Files with no reviewable changes (1)
- src/metadata-server.ts
|
Sub-agent review findings fixed in 156aa2d: preview demand is now unioned per active window with expiry instead of replacing the whole cache on every request, and refresh batches abort/reschedule when demand generation changes. |
|
Sub-agent review finding fixed in 156aa2d: in-flight preview captures now use stable window-id plus demand generation checks, so identical re-demand is accepted while expired/recreated demand rejects stale output. |
|
Sub-agent review findings fixed in 156aa2d: global |
Summary
Validation
Summary by CodeRabbit
includePreview=1support to expose items and switchable-agent controls to return cached terminal preview snapshots when available.includePreview=1request/response wiring across expose scopes.