Skip to content

fix(terminal): skip unavailable inline image previews and dedupe repeated renders#446

Open
konard wants to merge 3 commits into
ProverCoderAI:mainfrom
konard:issue-445-9a1f5e5f81b6
Open

fix(terminal): skip unavailable inline image previews and dedupe repeated renders#446
konard wants to merge 3 commits into
ProverCoderAI:mainfrom
konard:issue-445-9a1f5e5f81b6

Conversation

@konard

@konard konard commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Source TZ / Issues

Summary

  • stop rendering the "unavailable" placeholder box (plus 4 spacer rows) when an inline image path cannot be fetched — the clickable path link is unaffected
  • render each image preview at most once per terminal session via a session-level inlineImageRenderedPaths set (previously only per-segment dedup existed, so every re-mention/redraw duplicated the preview)
  • write the leading line break before previews lazily, only before the first preview that actually renders, so fully skipped segments leave terminal output untouched
  • extract the preview sequencing into a pure core function writeTerminalInlineImagePreviews (Functional Core) driven by injected writer callbacks (Imperative Shell)

Proof of fix

  • Причина: при неудачной загрузке картинки создавался UnavailableTerminalInlineImage и рендерился бокс "unavailable" + 4 строки-спейсера; дедупликация путей была только внутри одного сегмента, поэтому каждое повторное упоминание/перерисовка пути рендерила превью заново.
  • Решение: неудачная загрузка теперь возвращает null, и цикл превью полностью пропускает такой путь (неудачи не кэшируются — путь, напечатанный снова после появления файла, всё ещё может получить превью); успешно отрендеренные пути записываются в lifecycle.inlineImageRenderedPaths и повторно не рендерятся; ведущий \r\n пишется лениво только перед первым реально отрендеренным превью.
  • Доказательство: новые регрессионные тесты в packages/terminal/tests/web/terminal-inline-images-core.test.ts (describe("terminal inline image previews (issue 445)")): unavailable-путь не рендерится, один и тот же путь рендерится один раз через несколько сегментов, ведущий перенос строки пишется лениво и ровно один раз, полностью пропущенный сегмент не трогает вывод. Полный набор terminal-тестов: 20 файлов / 154 теста — зелёные.

Requirements Alignment

  • Implemented: both issue requirements — (1) unavailable ссылки больше не рендерятся как превью-плейсхолдеры, (2) одна и та же картинка рендерится не более одного раза за сессию терминала.
  • Out of scope: image path detection, clickable path links (registerLinkProvider), fetch timeout/size limits — unchanged.
  • Security-sensitive changes: none.

Verification

  • bun x vitest run tests/web/terminal-inline-images-core.test.ts (12 tests) in packages/terminal
  • bun x vitest run in packages/terminal — 20 files / 154 tests passed
  • bun run typecheck + bun run build in packages/terminal
  • bun run typecheck in packages/app (re-exports compile against rebuilt dist)
  • bun x biome check src/ tests/ in packages/terminal — clean
  • Note: bun run lint (eslint via vibecode-linter) crashes at config load time on this environment's Node 20 (eslint-plugin-unicorn requires Node ≥ 22 Iterator helpers); verified pre-existing by running it on an unmodified checkout.

Adding .gitkeep for PR creation (default mode).
This file will be removed when the task is complete.

Issue: ProverCoderAI#445
@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@konard, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 43 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 70f85bba-0925-40cc-91bd-3532c1e7cd57

📥 Commits

Reviewing files that changed from the base of the PR and between 9481167 and d18977b.

📒 Files selected for processing (8)
  • .changeset/terminal-inline-image-unavailable-dedupe.md
  • packages/terminal/src/web/terminal-inline-images-core.ts
  • packages/terminal/src/web/terminal-inline-images.ts
  • packages/terminal/src/web/terminal-panel-cleanup-runtime.ts
  • packages/terminal/src/web/terminal-panel-inline-images-runtime.ts
  • packages/terminal/src/web/terminal-panel-runtime-core.ts
  • packages/terminal/src/web/terminal-panel-runtime-types.ts
  • packages/terminal/tests/web/terminal-inline-images-core.test.ts
📝 Walkthrough

Walkthrough

В файл .gitkeep добавлена одна строка — автогенерированный комментарий-заголовок с меткой времени генерации, идентификатором ветки PR и ссылкой на связанный issue. Публичный API и логика приложения не затронуты.

Changes

Обновление служебного файла

Layer / File(s) Summary
Добавление автогенерированного заголовка
.gitkeep
Добавлена строка с меткой времени, идентификатором ветки PR и ссылкой на issue.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Related Issues: #445

Suggested labels: documentation, chore

Suggested reviewers: нет предложений

Poem:
Кролик лапкой застучал,
Файл .gitkeep пометку взял,
Дата, ветка и issue в строке,
Тихий след в пустом уголке. 🐇


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error, 3 warnings)

Check name Status Explanation Resolution
Requirements Alignment ❌ Error В PR изменён только .gitkeep; код для unavailable links/дублей не тронут и тесты под это не добавлены. Нужно внести реальный фикс в рендеринг/кэш изображений для unavailable links и повторных картинок и покрыть оба сценария тестами.
Linked Issues check ⚠️ Warning Связанный issue #445 не реализован: в изменениях нет логики для пропуска недоступных ссылок и предотвращения повторного рендера изображений. Добавьте реализацию обоих требований issue #445 и проверьте, что код не рендерит недоступные ссылки и не дублирует изображения.
Out of Scope Changes check ⚠️ Warning Изменение в .gitkeep с автогенерируемым заголовком и метаданными не связано с целями issue #445 и выглядит как посторонняя правка. Уберите метаданные из .gitkeep и сосредоточьтесь на коде, который решает рендеринг недоступных ссылок и дублирование изображений.
Title check ⚠️ Warning Заголовок про рендер превью терминала, но по сводке изменён только .gitkeep, поэтому он вводит в заблуждение. Переименуйте PR так, чтобы он отражал фактическое изменение, например обновление .gitkeep или генерацию заголовка.
✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Security Regression ✅ Passed Изменён только .gitkeep с одним комментариев; нет кода, конфигов CI/Docker, секретов или путей вне репозитория.
Description check ✅ Passed Описание соответствует шаблону: есть Issues, Summary, Requirements Alignment и Verification с заполненными деталями.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…ated renders

Failed inline image fetches rendered an "unavailable" placeholder box plus
four spacer rows, and every re-mention or redraw of the same image path
rendered another preview, flooding the web terminal with duplicate boxes.

Fetch failures now resolve to null and the preview loop skips them entirely
(the clickable path link is unaffected, and failures are not cached so a
path printed again after the file appears can still preview). Successfully
rendered paths are tracked in a session-level set so each image renders at
most once, and the leading line break before previews is written lazily
only before the first preview that actually renders, so fully skipped
segments leave the output untouched.

Refs ProverCoderAI#445
@konard konard changed the title [WIP] не пытаться рендерить unvalible ссылки + сделать что бы одна и таже картинка не рендерилась несколько раз fix(terminal): skip unavailable inline image previews and dedupe repeated renders Jul 5, 2026
@konard

konard commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

Working session summary

The PR diff is now scoped to exactly the 8 fix-related files (changeset, six source files, one test file), and the working tree is clean. CI is running on the new head commit d18977ba; a background poll is watching gh pr checks 446 and will report when all checks finish, after which I'll mark the PR ready.


This summary was automatically extracted from the AI working session output.

@konard konard marked this pull request as ready for review July 5, 2026 08:31
@konard

konard commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost: $12.726597

📊 Context and tokens usage:

Claude Fable 5: (2 sub-sessions)

  1. 109.8K / 1M (11%) input tokens, 39.0K / 128K (30%) output tokens
  2. 76.3K / 1M (8%) input tokens, 7.0K / 128K (5%) output tokens

Total: (24.1K new + 219.5K cache writes + 5.3M cache reads) input tokens, 56.1K output tokens, $12.726597 cost

🤖 Models used:

  • Tool: Anthropic Claude Code
  • Requested: fable (claude-fable-5)
  • Thinking level: high (~23999 tokens)
  • Model: Claude Fable 5 (claude-fable-5)

📎 Log file uploaded as Gist (2518KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard

konard commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

🔄 Auto-restart triggered (iteration 1)

Reason: CI failures detected

Starting new session to address the issues.


Auto-restart-until-mergeable mode is active. This run will stop after 5 restart iterations.

@konard

konard commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

Working session summary

I'm now waiting on the background job: it will post @coderabbitai review shortly after 09:00 UTC (when the rate limit resets) and then poll the CodeRabbit status on the head commit until it resolves. I'll report back once it completes.

Status so far:

  • The CodeRabbit "failure" is purely a rate-limit/billing status ("Prepaid credits exhausted — enable usage-based reviews", "Next review available in 43 minutes"), not a code finding — there are zero review comments on the PR.
  • All 19 actual CI checks (Build, Lint, Types, Test, all E2E suites, Final Build on 3 OSes, Snapshot, dependency checks) pass on head commit d18977ba.
  • The branch is up to date with upstream/main (f55f2749 is its ancestor; no conflicts, PR reports MERGEABLE).
  • Working tree is clean; PR 446 is already marked ready for review.

This summary was automatically extracted from the AI working session output.

@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown

Your plan includes PR reviews subject to rate limits. More reviews will be available in 32 minutes.

@konard

konard commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

🔄 Auto-restart-until-mergeable Log (iteration 1)

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $1.480466
  • Calculated by Anthropic: $14.207063
  • Difference: $12.726597 (+859.63%)

📊 Context and tokens usage:

  • 50.3K / 1M (5%) input tokens, 6.9K / 128K (5%) output tokens

Total: (3.5K new + 36.7K cache writes + 365.9K cache reads) input tokens, 6.9K output tokens, $1.480466 cost

🤖 Models used:

  • Tool: Anthropic Claude Code
  • Requested: fable (claude-fable-5)
  • Model: Claude Fable 5 (claude-fable-5)

📎 Log file uploaded as Gist (3195KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard

konard commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

🔄 Auto-restart triggered (iteration 2)

Reason: CI failures detected; Uncommitted changes

Starting new session to address the issues.


Auto-restart-until-mergeable mode is active. This run will stop after 5 restart iterations.

@konard

konard commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

Working session summary

Both background jobs are running. I'll report back when the monitor fires — the main job sleeps until 09:16 UTC, posts the re-trigger comment, and polls the CodeRabbit status until it passes.


This summary was automatically extracted from the AI working session output.

@konard

konard commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

🔄 Auto-restart-until-mergeable Log (iteration 2)

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $1.332605
  • Calculated by Anthropic: $15.539668
  • Difference: $14.207063 (+1066.11%)

📊 Context and tokens usage:

  • 39.2K / 1M (4%) input tokens, 6.9K / 128K (5%) output tokens

Total: (3.6K new + 25.5K cache writes + 441.7K cache reads) input tokens, 6.9K output tokens, $1.332605 cost

🤖 Models used:

  • Tool: Anthropic Claude Code
  • Requested: fable (claude-fable-5)
  • Model: Claude Fable 5 (claude-fable-5)

📎 Log file uploaded as Gist (3757KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard

konard commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

🔄 Auto-restart triggered (iteration 3)

Reason: CI failures detected

Starting new session to address the issues.


Auto-restart-until-mergeable mode is active. This run will stop after 5 restart iterations.

@konard

konard commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

Working session summary

Status update — here's where things stand:

The only failing check is CodeRabbit, and it's not a code problem. Its status reads "Prepaid credits exhausted — enable usage-based reviews", and when a re-review was requested earlier, CodeRabbit replied that more reviews become available after its rate-limit window resets (~09:14 UTC; it's currently ~08:51 UTC). All 19 real CI checks (Build, Lint, Types, Test, all E2E jobs, final builds) pass on the head commit d18977ba.

What I verified this session:

  • The branch is up to date with upstream main (0 commits behind) and the working tree is clean.
  • The PR is marked ready (not draft) and GitHub reports it as MERGEABLE.
  • I re-read the full PR diff: it's scoped to exactly the 8 fix-related files, the logic matches both issue requirements (unavailable images are skipped entirely instead of rendering a placeholder; each image path renders at most once per terminal session via inlineImageRenderedPaths, which is cleared on cleanup), and regression tests cover all four behaviors. No new issue or PR feedback needs addressing.
  • There were no CodeRabbit review comments with actionable findings — its "review" never ran due to the credit/rate limit.

Action taken: I started a background job (/tmp/retrigger-coderabbit.sh, logging to /tmp/coderabbit-retrigger.log) that waits until 09:16 UTC, posts @coderabbitai review on PR 446, then polls the CodeRabbit commit status every minute for up to 30 minutes. I'll report the outcome when it completes. Note that if the CodeRabbit account's prepaid credits are genuinely exhausted (rather than just rate-limited), the re-trigger won't help — enabling usage-based billing in the CodeRabbit dashboard is an account-level action only a repo admin can perform, and I'll flag that on the PR if the status doesn't clear.


This summary was automatically extracted from the AI working session output.

@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown

Your plan includes PR reviews subject to rate limits. More reviews will be available in 22 minutes.

@konard

konard commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

🔄 Auto-restart-until-mergeable Log (iteration 3)

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $2.174690
  • Calculated by Anthropic: $17.714358
  • Difference: $15.539668 (+714.57%)

📊 Context and tokens usage:

  • 51.3K / 1M (5%) input tokens, 7.2K / 128K (6%) output tokens

Total: (3.6K new + 64.1K cache writes + 499.4K cache reads) input tokens, 7.2K output tokens, $2.174690 cost

🤖 Models used:

  • Tool: Anthropic Claude Code
  • Requested: fable (claude-fable-5)
  • Model: Claude Fable 5 (claude-fable-5)

📎 Log file uploaded as Gist (4407KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard

konard commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

🔄 Auto-restart triggered (iteration 4)

Reason: CI failures detected

Starting new session to address the issues.


Auto-restart-until-mergeable mode is active. This run will stop after 5 restart iterations.

@konard

konard commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

Working session summary

The diff is still scoped to exactly the 8 expected files (one changeset, six terminal-package source files, one test file), matching the issue's two requirements: skip unavailable inline image previews and deduplicate repeated renders of the same image. Nothing further to change in the code — I'll now wait for the background job to re-trigger CodeRabbit and report back when it completes.

Status so far:

  • The only failing check is CodeRabbit, and it's a billing/rate-limit status, not a code finding. Its status description is "Prepaid credits exhausted — enable usage-based reviews", and its last reply said more reviews become available at ~09:14 UTC. There are zero inline review comments on the PR.
  • All 19 real CI checks (Build, Lint, Lint Effect-TS, Types, Test, all 7 E2E suites, Final Build on ubuntu/macos/windows, Snapshot, dependency checks) pass on head commit d18977ba.
  • The branch is up to date with upstream/main (0 behind, 3 ahead), the working tree is clean, and GitHub reports the PR as MERGEABLE and not a draft.
  • A background job (log: /tmp/coderabbit-retrigger.log) sleeps until 09:16 UTC, posts @coderabbitai review on PR 446, then polls the CodeRabbit commit status every minute for up to 30 minutes; it exits with success as soon as the status flips.

This summary was automatically extracted from the AI working session output.

@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown

Your plan includes PR reviews subject to rate limits. More reviews will be available in 18 minutes.

@konard

konard commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

🔄 Auto-restart-until-mergeable Log (iteration 4)

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $0.864554
  • Calculated by Anthropic: $18.578912
  • Difference: $17.714358 (+2048.96%)

📊 Context and tokens usage:

  • 38.0K / 1M (4%) input tokens, 5.4K / 128K (4%) output tokens

Total: (3.5K new + 16.1K cache writes + 235.7K cache reads) input tokens, 5.4K output tokens, $0.864554 cost

🤖 Models used:

  • Tool: Anthropic Claude Code
  • Requested: fable (claude-fable-5)
  • Model: Claude Fable 5 (claude-fable-5)

📎 Log file uploaded as Gist (4907KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard

konard commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

🔄 Auto-restart triggered (iteration 5)

Reason: CI failures detected; Uncommitted changes

Starting new session to address the issues.


Auto-restart-until-mergeable mode is active. This run will stop after 5 restart iterations.

@konard

konard commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

Working session summary

Everything on the code side is verified and in order. Now I'm waiting on the background job to re-trigger CodeRabbit at 09:15:40 UTC (right after its rate-limit window resets) and poll the result. Here's the status so far:

Current state:

  • The only failing check is CodeRabbit, and it's not a code problem. Its status on the head commit reads "Prepaid credits exhausted — enable usage-based reviews," and each earlier re-review request got a rate-limit reply with a countdown (32 → 22 → 18 minutes, all pointing to a reset at ~09:14:40 UTC). Previous iterations posted the re-trigger too early; my background job posts at 09:15:40 UTC and then polls the status every 30 seconds for up to 25 minutes.
  • All 20 real CI checks pass on head commit d18977ba: Build, Lint, Types, Test, Lint Effect-TS, dependency checks, Snapshot, Final Build on all three OSes, and all 8 E2E suites.
  • The working tree is now clean — I removed the leftover experiments/coderabbit-retrigger.sh (a one-off ops helper for re-triggering CodeRabbit, not part of the fix) and moved it to /tmp so the PR diff stays scoped to the 8 fix-related files.
  • The branch is 0 commits behind upstream/main, mergeable, and not a draft.
  • Self-review passed: the diff implements both issue requirements (unavailable image links no longer render placeholder boxes; each image renders at most once per terminal session via inlineImageRenderedPaths, cleared on cleanup), with four new regression tests covering skip, dedupe, lazy line break, and no-op cases. There are no unaddressed review comments on the PR, and the PR description matches the implementation.

I'll report the CodeRabbit outcome when the background job completes.


This summary was automatically extracted from the AI working session output.

@konard

konard commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

🔄 Auto-restart-until-mergeable Log (iteration 5)

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $1.559095
  • Calculated by Anthropic: $20.138007
  • Difference: $18.578912 (+1191.65%)

📊 Context and tokens usage:

  • 54.0K / 1M (5%) input tokens, 7.1K / 128K (6%) output tokens

Total: (3.5K new + 40.4K cache writes + 363.2K cache reads) input tokens, 7.1K output tokens, $1.559095 cost

🤖 Models used:

  • Tool: Anthropic Claude Code
  • Requested: fable (claude-fable-5)
  • Model: Claude Fable 5 (claude-fable-5)

📎 Log file uploaded as Gist (5586KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard

konard commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

⚠️ Auto-restart limit reached

Hive Mind stopped auto-restart-until-mergeable after 5 restart iterations.

Configured limit: 5
Remaining reason: CI failures detected

No further AI sessions will be started automatically for this run. Please review the remaining blockers manually or rerun with a higher --auto-restart-max-iterations value.


Auto-restart-until-mergeable stopped by the safety limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant