Skip to content

fix(tui): status do modelo fixo à direita no seletor, com reticências em nomes longos - #881

Merged
agenteinstinct1-max merged 6 commits into
dev-vibecodedfrom
fix/model-picker-status-right
Nov 30, 2026
Merged

agenteinstinct1-max merged 6 commits into
dev-vibecodedfrom
fix/model-picker-status-right

Conversation

@agenteinstinct1-max

@agenteinstinct1-max agenteinstinct1-max commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator

Issue for this PR

Closes #883

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

No seletor de modelos (/models), as linhas Pinned renderizavam nome + status via titleView, que contorna o Locale.truncate do Option — nomes longos cortavam no meio da palavra, e a célula da direita mostrava a idade do último check em vez do status.

A mudança (confinada a packages/tui/src/component/dialog-model.tsx):

  • titleView removido das linhas Pinned: o título volta ao truncate nativo com …, com titleWidth calculado do terminal (max(24, min(60, dims-2) - 10) menos o comprimento real de status/descrição/Free), aplicado em Pinned, Recent e All models;
  • o status de saúde (● working/degraded/failing/unknown, colorido) passa ao footer da linha, que o Option ancora à direita;
  • a idade do último check sai da linha (após STALE_MS o status já degrada para unknown).

O mecanismo de sonda de saúde não muda; nada fora do seletor.

How did you verify your code works?

Novo teste de regressão packages/tui/test/cli/tui/model-picker-status.test.tsx monta o DialogModel real (fixture de providers + favoritos semeados, probe de /provider/probe mockado) e verifica: status ancorado à direita em todas as linhas Pinned a 56 colunas (incluindo com o favorito longo como seleção atual e com degraded, 1 coluna mais largo), … em nomes longos a 56, nome completo a 100, sem idade do check. Os quatro estados de saúde passam pelo pipeline real de sonda com o intervalo de 15s reduzido a 25ms com escopo de teste. 5/5 verdes localmente (~3s), pollinations-model-list verde, prettier limpo.

Screenshots / recordings

Capturas do DialogModel real desta branch a 56 e 100 colunas (incluindo os três estados coloridos) foram compartilhadas no review.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Pinned rows rendered the status inside titleView, which bypasses the
option's Locale.truncate, so long model names clipped mid-word and the
last-check age held the right cell. Give the status its own right-aligned
footer cell, restore native ellipsis truncation with a width budget from
the terminal dimensions, and drop the age (staleness already degrades to
unknown). Add a regression test that mounts the real DialogModel at 56
and 100 columns.
@github-actions

Copy link
Copy Markdown

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

agenteinstinct1 added 3 commits November 30, 2026 14:43
…e names

Extend the model-picker regression test: mock /provider/probe to render
working, degraded and failing rows and assert the status cells share one
right edge even though degraded is a column wider; pin a long favorite as
the current selection to prove the marker column is accounted for; and
probe a CJK-heavy name that overflows the character-counted truncation
budget to prove the status cell survives wide titles.
Scope the probe interval down to 25ms for the health-state test instead
of waiting out three real 15s ticks: the full probe pipeline (mocked
/provider/probe, outcome mapping, store, re-sort) still runs end to end,
but the test settles in ~150ms, keeps the default failure mode of waitFor
(OutputBusy-only retry, frame dump on exhaustion) and restores
setInterval before dispose.
: model.cost?.input === 0 && provider.id === "opencode"
? "Free"
: undefined,
titleWidth:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

SUGGESTION: titleWidth can become negative on narrow terminals

titleWidth = rowBudget() - descriptionLength - 1 - statusLength - 1. With rowBudget floored at 24 and long provider names, this subtraction can yield a negative or zero width, which may cause the Option component to render incorrectly. Consider clamping with Math.max(0, ...) or a minimum usable width.

value: { providerID: provider.id, modelID: model },
title: info.name ?? model,
releaseDate: info.release_date,
description,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

SUGGESTION: titleWidth can become negative on narrow terminals

Same pattern as the Pinned/Recent path: titleWidth = rowBudget() - descriptionLength - 1 - freeLength - 1. On narrow terminals with long provider names, this can produce negative values. Consider clamping to a minimum width.

@kilo-code-bot

kilo-code-bot Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • packages/tui/src/component/dialog-model.tsx - 0 issues
  • packages/tui/test/cli/tui/model-picker-status.test.tsx - 0 issues
Previous Review Summary (commit 9c2790e)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 9c2790e)

Status: 2 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 2
Issue Details (click to expand)

SUGGESTION

File Line Issue
packages/tui/src/component/dialog-model.tsx 72 titleWidth can become negative on narrow terminals
packages/tui/src/component/dialog-model.tsx 113 titleWidth can become negative on narrow terminals
Files Reviewed (2 files)
  • packages/tui/src/component/dialog-model.tsx - 2 issues
  • packages/tui/test/cli/tui/model-picker-status.test.tsx - 0 issues

Fix these issues in Kilo Cloud


Reviewed by free · Input: 144.3K · Output: 2.3K · Cached: 72.2K

@github-actions

Copy link
Copy Markdown

Thanks for updating your PR! It now meets our contributing guidelines. 👍

agenteinstinct1 added 2 commits November 30, 2026 15:14
A provider description longer than the row budget drove titleWidth
negative, and Locale.truncate's slice(0, len - 1) then counts from the
end of the string, producing a title longer than the budget and
reintroducing overflow. Clamp at a minimum width and cover it with a
regression test using a 46-column provider name.
…d row

Replace the frame-length containment claim (a char frame cannot show
overflow past a clipping box, so it proved nothing) with assertions the
frame does support: the clamped title is exactly ellipsized, and the
clipped provider description remains a clean prefix of its source.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant