[codex] Hold Codex repaints through grid resize#307
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the rendering and runtime hold logic so Codex output holds can continue to reuse an already-populated render cache through grid resize animations (where a cell’s pixel size changes over time), preventing live repaints during intermediate animated widths.
Changes:
- Relax the held-cache reuse check to depend on “same render mode + populated texture” rather than exact pixel dimensions.
- Prevent terminal resize holds from expiring while the UI is in
GridResizing, so holds survive the full resize animation. - Update architecture documentation to reflect same-mode cache reuse across pixel-size changes during holds.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/render/renderer.zig |
Allows held cached textures to be reused across rect size changes (same render mode), and updates the related unit test. |
src/app/runtime.zig |
Skips expiring terminal resize holds during GridResizing to avoid holds dropping mid-animation. |
docs/ARCHITECTURE.md |
Documents the updated hold/cache behavior during resize/grid animations. |
Comments suppressed due to low confidence (1)
src/render/renderer.zig:957
shouldHoldSessionCacheRefreshno longer checks that the cached texture dimensions matchrect, which allows held rendering during grid resize. However, whenwave_effectis non-null the hold path callsrenderWaveStrips(renderer, tex, rect, ...), andrenderWaveStripsusesrect.w/hto build the source rectangles (e.g.src_rect.w = tile_w,src_rect.y = src_y). If the cached texture size differs fromrect(now allowed), the source rects can extend past the texture bounds, producing incorrect/partial rendering during a hold.
Suggested fix: either (a) make the hold path disable wave strips when the cache texture size != rect (fall back to renderCachedTexture), or (b) update renderWaveStrips to query the texture size (e.g. SDL_GetTextureSize) and map strip source coordinates proportionally to the texture dimensions.
const tex = cache_entry.texture orelse return false;
if (wave_effect) |wave| {
renderWaveStrips(renderer, tex, rect, wave.elapsed_ms, wave.amplitude, wave.total_ms);
} else {
renderCachedTexture(renderer, tex, rect);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
GridResizingfinishes, so Codex cannot repaint live through the intermediate animated widths.Root cause
The new-terminal path already started resize holds, but those holds could expire while the grid resize animation was still running. Once the hold expired, Codex could enter DEC 2026 with
resize_hold_active=false, and the renderer refreshed live at a sequence of animated cell widths. That was the scroll-through-history window.Validation
nix develop -c zig build --summary allnix develop -c zig build test --summary allnix develop -c just lintgrid-debug resize-complete, and cache refreshes happen at stable final cell sizes.