fix(terminal): resolve image, PTY, and async search defects - #67
Conversation
Prevent unintended temporary-file deletion, unsafe shared-memory access, and image quota bypasses. Preserve PTY tail output and bound all pending writes so a child that stops reading cannot grow the reply queue forever. Correct PNG expansion, image epochs and dimensions, wrapped-line search, and CSI overflow handling. Move history searches outside the UI thread and terminal lock, and reduce redraw, image lookup and GPU resource work. Add regression coverage, repeatable performance probes, and operating limits for drain timeouts, write reservations and image metadata. Validation: cargo build --workspace --locked --offline; cargo test --workspace --locked --offline (2540 passed, 15 ignored); cargo fmt --all -- --check; git diff --check.
Clip wrapped matches to each rendered row, bind search jobs to their submitted screen generation, and apply queued navigation after the matching results arrive. Validate with regression tests, cargo build --workspace, cargo test --workspace, and cargo fmt --all -- --check.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9586a9f3f0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if let Some(worker) = &self.search_worker { | ||
| worker.cancel(); |
There was a problem hiding this comment.
Scope search cancellation to the target pane
When window A has a pending query and focus moves to window B, invoking the menu or command-palette “Clear Search” targets B but this unconditional call cancels the single app-wide job belonging to A. Window A retains its open prompt and displayed query, yet its result will never publish until the query is edited again; cancellation should verify the target terminal or be maintained per pane.
Useful? React with 👍 / 👎.
| if changes_active_space { | ||
| self.screen_generation = self.screen_generation.wrapping_add(1); | ||
| self.invalidate_grid_coordinate_space(); |
There was a problem hiding this comment.
Invalidate searches when repeated alt-screen entry clears them
When already on the alternate screen, a repeated DECSET 47 or 1047 makes changes_active_space false, so this generation is not advanced, although enter_alt_screen unconditionally clears both screens' search state below. An in-flight worker can consequently pass its generation and content checks and restore the query/highlights that the control sequence just cleared; the pending-search validity generation must also change whenever this clearing occurs.
Useful? React with 👍 / 👎.
Kitty image transfers could delete ordinary temporary files, read invalid shared-memory ranges, exceed storage limits after failed placements, or reuse stale GPU textures. PTY exit could overtake final output, and search missed soft-wrapped text while scanning history on the UI thread. This fixes those paths and adds focused regressions.
Validation
cargo fmt --all -- --check— passed.cargo build --workspace --locked— passed.cargo test --workspace --locked --quiet— 2,544 passed, 15 ignored. The sandbox blocked two POSIX shared-memory tests; the complete suite passed outside the sandbox.git diff --check origin/main...HEAD— passed.Regression coverage includes PNG transparency, shared-memory range checks, delayed PTY output, write-budget release, stale search cancellation, queued search navigation, wrapped highlight rendering, and GPU resource reuse.
No interactive macOS screenshot or recording was captured. Linux-specific shared-memory truncation behavior and native GUI latency remain unverified on this macOS host. Existing mechanism measurements and their limits are recorded in performance-measurements.md.
Review notes
No dependencies, configuration keys, or persisted formats change. Sustained terminal output can delay search-result publication; output from descendants can be discarded after the two-second exit drain deadline. Image metadata is capped at 4,096 images and 16,384 frames independently of the pixel-byte limit.
The fix/evidence map and operating policies are in review-fixes-2026-09-05.md; its recorded test count predates the final search regressions. Reverting requires no migration but restores the prior file-deletion and memory-boundary defects.