Repository navigation
fix: stop cap record cleanly before the drive fills - #4583
Open
richiemcilroy wants to merge 2 commits into
Open
richiemcilroy wants to merge 2 commits into
richiemcilroy wants to merge 2 commits into
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
richiemcilroy
marked this pull request as ready for review
November 27, 2026 12:57
|
Sandchest reviewed Sandchest reviews every change for vulnerabilities an attacker could use · 1 credit · Review details |
Comment on lines
+250
to
+255
| DiskSpaceStatus::Exhausted => { | ||
| log_storage( | ||
| storage, | ||
| "Recording storage is low; stopping to save the recording", | ||
| ); | ||
| return; |
Contributor
There was a problem hiding this comment.
Low-space warning can be skipped
watch_storage skips on_warning when its first sample is Exhausted. A recording can start just above 512 MiB free and reach this branch before the first check two seconds later. It stops and saves, but never emits the documented storage event. Detached sessions also keep storageLow false until saving finishes.
Report the low-space transition before returning, unless it was already reported.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/cli/src/record.rs
Line: 250-255
Comment:
**Low-space warning can be skipped**
`watch_storage` skips `on_warning` when its first sample is `Exhausted`. A recording can start just above 512 MiB free and reach this branch before the first check two seconds later. It stops and saves, but never emits the documented `storage` event. Detached sessions also keep `storageLow` false until saving finishes.
Report the low-space transition before returning, unless it was already reported.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.This branch has not been deployed
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.

cap recordnow watches free space on the recording's drive with the same rule and cadence as Cap Desktop. It refuses to start at 512 MB free or less, emits astorageevent when space runs low, and before saving would no longer fit it stops by itself, saves everything captured, emitsstoppedwithreason: lowStorageand exits 3. Detached sessions record the same incap record status, andcap record stopreports it. Successful recordings print and return exactly what they did before.Docs:
cap guide --json(exit code 3,storageevent), README and the Cap skill.Testing: unit tests for the stop reason, events and session fields; real recordings on small volumes on macOS, Windows and Linux, base vs head (results in the PR thread).
The PR appears safe to merge, with a non-blocking gap in low-space warning reports.
Findings
Fix with agent prompt
Summary
Adds low-space protection to CLI recordings using Desktop's shared storage checks.
Reviews (1) · Last reviewed commit: "style: rustfmt" · Reviewed by Greptile