Skip to content

fix(tui): keep user images as clickable placeholders - #227

Merged
daviddanialy merged 4 commits into
mainfrom
fix/user-image-placeholder-spacing
Sep 15, 2026
Merged

daviddanialy merged 4 commits into
mainfrom
fix/user-image-placeholder-spacing

Conversation

@daviddanialy

@daviddanialy daviddanialy commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Keep user-attached images as clickable placeholders without reserved inline preview rows; assistant and tool previews are unchanged.
  • Materialize URI-less replayed images safely, preserve image separators across empty text blocks, and prioritize file-backed candidates within the existing bounded worker attempt budget.
  • Keep retained images openable when stable cache admission fails using ordinary TUI clicks and exact per-label associations, including inline labels, multiple images on a line, and sequential chunks.
  • Retain on-demand files in a bounded, non-evicting session pool so successive opens do not delete paths already handed to external viewers. Reuse repeated image keys and show explicit exhaustion/failure notices.
  • Exclude internal image targets from terminal-native OSC-8 hyperlinks and reject forged Markdown targets.

Resource and interface behavior

  • Stable reconstructed links retain the existing 64-file / 64-MiB bounds.
  • On-demand opened files use a separate 64-file / 32-MiB pool, retained until session switch or exit. Full admission produces an actionable notice rather than invalidating existing viewer paths.
  • Overflow placeholders require ordinary Kit clicks, not terminal modifier-click / OSC-8.
  • No dependency or persistent-artifact schema changes.

Validation

  • mise run test -- --lib tui::: 466 passed, 1 ignored.
  • mise run lint: passed formatting and Clippy for all-feature and no-default-feature configurations.
  • git diff --check: passed.
  • Regressions cover cache exhaustion, per-label byte-correct click routing, real sequential chunk notifications, mixed invalid URI-less / valid file sources, empty text blocks, forged targets, private-file ownership, reuse, capacity refusal, and session cleanup.
  • Final independent review found no remaining blocking correctness or security issues.
  • Actual external viewer launching and terminal modifier-click behavior were not exercised by automated tests.

@kit-code-agent kit-code-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

User-message layout now preserves textual placeholders and explicit newlines without reserving preview rows or scheduling image decoding. Existing link-bearing placeholders retain their click targets, and assistant/tool rendering remains separate. However, supported user images without a source URI lose their only image-viewing path.

Comment thread src/tui/ui.rs Outdated
kit-code-agent[bot]
kit-code-agent Bot previously approved these changes Sep 14, 2026

@kit-code-agent kit-code-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found. The changes look good to merge.

kit-code-agent[bot]
kit-code-agent Bot previously approved these changes Sep 14, 2026

@kit-code-agent kit-code-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found. The changes look good to merge.

Address review findings on the clickable placeholder flow:

- Admission and link lookup now consult the opened pool, so a key
  retained by a click is neither materialized twice nor left as a
  kit-image label that re-decodes on every click.
- Clicks resolve cached keys directly instead of cloning the source
  and round-tripping the image worker.
- The image source limit toast fires once per session rather than on
  every later image-bearing message or resume replay.
- A disconnected image worker reports "unavailable" instead of
  "busy; click again".
- Drop the dead user-block image render arm and the vestigial
  placement tuple from user_block_rows.
- Stop duplicating the 10 MiB materialization limit at the open site.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

@kit-code-agent kit-code-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found. The changes look good to merge.

@daviddanialy
daviddanialy merged commit 80e58e3 into main Sep 15, 2026
6 checks passed
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