Skip to content

[codex] Hold Codex repaints through grid resize#307

Merged
forketyfork merged 1 commit into
mainfrom
fix/codex-new-cell-grid-resize-sync-overlay
May 6, 2026
Merged

[codex] Hold Codex repaints through grid resize#307
forketyfork merged 1 commit into
mainfrom
fix/codex-new-cell-grid-resize-sync-overlay

Conversation

@forketyfork
Copy link
Copy Markdown
Owner

Summary

  • Reuse a populated same-mode render cache while a Codex output hold is active, even if the grid animation changes the cell's pixel size.
  • Keep terminal resize holds alive until GridResizing finishes, so Codex cannot repaint live through the intermediate animated widths.
  • Drop the per-cell DEC 2026 sweep overlay before publishing because short holds looked like flicker. The existing quit overlay stays as it was.

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 all
  • nix develop -c zig build test --summary all
  • nix develop -c just lint
  • Checked the latest Architect log: hold release now happens after grid-debug resize-complete, and cache refreshes happen at stable final cell sizes.

@forketyfork forketyfork requested a review from Copilot May 6, 2026 08:44
@forketyfork forketyfork marked this pull request as ready for review May 6, 2026 08:44
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  • shouldHoldSessionCacheRefresh no longer checks that the cached texture dimensions match rect, which allows held rendering during grid resize. However, when wave_effect is non-null the hold path calls renderWaveStrips(renderer, tex, rect, ...), and renderWaveStrips uses rect.w/h to build the source rectangles (e.g. src_rect.w = tile_w, src_rect.y = src_y). If the cached texture size differs from rect (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.

@forketyfork forketyfork merged commit 4619b27 into main May 6, 2026
8 checks passed
@forketyfork forketyfork deleted the fix/codex-new-cell-grid-resize-sync-overlay branch May 6, 2026 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants