Skip to content

fix(tui): six defects found by re-verifying the benchmark findings - #426

Merged
mohitranka merged 1 commit into
mainfrom
fix/benchmark-followups
Aug 22, 2026
Merged

mohitranka merged 1 commit into
mainfrom
fix/benchmark-followups

Conversation

@mohitranka

Copy link
Copy Markdown
Contributor

Follow-ups to the four-way benchmark. I re-verified every claim against the code or a live PTY before fixing it — four of the ten did not survive.

Fixed

Conversation text was clipped, losing characters

render.rs wrapped to sidebar_width - 2, but the sidebar block takes 2 columns for borders and 2 more for Padding::horizontal(1). Every full-width line was two columns too long and the widget clipped the tail — silently, with no ellipsis. The benchmark caught the final repository chec losing its k.

Now wrapped to the block's real inner width, pinned by a test that asks Block::inner() rather than restating the arithmetic.

The command palette repeated itself, and bled through

The detail row under the list was (a) shown even when the selected row displayed the description in full, so it said the same thing twice, and (b) never padded, so whatever it didn't cover showed through from the transcript beneath — Open the terminal panel (Ctrl+\)and CLI option.`

Now drawn only when the selected row actually truncated, and padded to the panel width. The panel is a row shorter when it isn't needed.

The first screen after signing in contradicted itself

A toast saying connected beside a status card saying provider ● not connected. invalidate_connected() existed with exactly one caller — which was not the connect path — so the card served the cached pre-sign-in answer until its TTL lapsed.

Connecting landed on gpt-5.4

apply_default_model_for_profile took the first picker row for the profile. The picker is sorted for reading, so alphabetical gpt-5.4 beat the profile's own declared gpt-5.6-sol (openai_codex.rs:26). Now prefers the declared default, falling back to the first row when it's unavailable.

PageUp moved five rows, not a page

A hard-coded 5 — on wrapped prose about two sentences, so paging back through a long transcript took dozens of presses. Now the conversation viewport height with 2 rows of overlap as an anchor.

Not fixed, because they weren't real

Four claims from my benchmark report were measurement errors in my own tooling, and the report overstated Forge's focus problems as a result:

Claim Reality
Empty focused composer draws the unfocused border It draws ┏━━┓ correctly. I checked the wrong rows while the source viewer had changed the layout height.
File tree has no selection cursor It has one — a background highlight (48;2;38;46;64). Plain tmux capture-pane -p strips colour, so I never saw it.
Keys typed at the Files pane are swallowed They already fall through to the composer, /te included. type_to_compose handles it; its only refusals (Footer, BottomPanel) are deliberate and documented.
Ctrl+O's hint is a lie on older cards tool_expanded applies to every activity group (lib.rs:1048), not just the last. The hint is accurate wherever it appears.

Each was checked against a test or a live PTY run before being dropped.

Still open: reusing the Codex sign-in

Forge asks for its own device-code OAuth even when codex is already signed in to the same ChatGPT account on the same machine (store.rs:116 vs catalog.rs:924 — it reads models_cache.json from ~/.codex/ but never auth.json).

Deliberately not in this PR. Silently adopting another application's credentials is a decision you should make, not one I should slip into a bug-fix branch. If you want it, the shape I'd suggest is an explicit row in the connect picker — "Use the ChatGPT session from Codex" — rather than an automatic import.

Verification

cargo fmt --all -- --check clean · cargo clippy --all-targets clean · cargo test --workspace 45/45 binaries, 0 failures · 990 forge-tui tests.

PTY-confirmed: the palette now shows /connect once, with the panel one row shorter.

https://claude.ai/code/session_018ihDDc3ahfrxu5AYL9moXs

Six real bugs, each with a precise cause. Four other claims from the
benchmark report turned out to be measurement errors in my own tooling and
are not fixed here because there is nothing to fix — see below.

Conversation text was wrapped two columns wider than the area it is drawn
into. The sidebar block takes two columns for borders and two more for
Padding::horizontal(1), but wrapping used width - 2, so the widget clipped
the tail of every full-width line. Characters vanished mid-word with no
ellipsis to admit it — the benchmark caught "the final repository chec"
losing its "k". Now wrapped to the block's real inner width.

The command palette's detail row is now drawn only when the selected row
had to truncate its description, and is padded to the panel width. It was
neither: when nothing was truncated it repeated the line directly above it,
and because it was never padded, whatever it did not cover showed through
from the transcript underneath — "Open the terminal panel (Ctrl+`)and CLI
option.". The panel is a row shorter when the row is not needed.

Connecting now drops the cached connection answer. Without that the first
screen after signing in contradicted itself: a toast saying "connected"
beside a status card still serving the pre-sign-in answer until its TTL
lapsed. invalidate_connected existed and had exactly one caller, which was
not the connect path.

Connecting now lands on the profile's declared default model. It took the
first picker row for the profile instead, and the picker is sorted for
reading, so gpt-5.4 beat the profile's own gpt-5.6-sol. Falls back to the
first row when the declared default is unavailable.

PageUp/PageDown in the conversation now move a page. They moved a
hard-coded 5 rows, which on wrapped prose is about two sentences, so paging
back through a long transcript took dozens of presses. Two rows of overlap
are kept as an anchor across the jump.

Not fixed, because they were not real. An empty focused composer already
draws the thick border; the file tree already draws a selection cursor (as
a background highlight, which plain `tmux capture-pane -p` strips, which is
why I did not see it); unbound keys typed at the Files pane already fall
through to the composer; and Ctrl+O already expands every activity group,
not just the last, so its hint is accurate wherever it appears. Each was
verified against a test or a live PTY run before being dropped.

Claude-Session: https://claude.ai/code/session_018ihDDc3ahfrxu5AYL9moXs
@mohitranka
mohitranka force-pushed the fix/benchmark-followups branch from be3a5d1 to 08ff226 Compare August 22, 2026 23:09
@mohitranka
mohitranka merged commit d3e581f into main Aug 22, 2026
7 checks passed
mohitranka added a commit that referenced this pull request Aug 23, 2026
* feat(connect): reuse a sign-in another CLI already completed

Forge keeps its own credential store and reads nothing else, so a user
already signed in to codex, opencode or grok on the same machine was still
sent through a second device-code grant in a browser. Nothing about that
second grant is more secure — same account, same OAuth client, same machine
— it is just friction, and it was the one thing that blocked Forge from
starting at all during the four-way benchmark.

forge-connect gains an `import` module that finds those sessions:

  ~/.codex/auth.json                      Codex     -> openai_codex, openai
  ~/.local/share/opencode/auth.json       OpenCode  -> openai_codex, xai,
                                                       opencode_go, anthropic
  ~/.grok/auth.json                       Grok      -> xai

Discovery is read-only and never adopts anything on its own. A route that
has a reusable session shows a `reuse Codex` tag in the existing
right-aligned tag column of the provider picker, and pressing Enter on that
row — which is the consent — imports instead of opening a browser. A failed
import falls through to the ordinary flow rather than stranding the user.

Client ids line up, so imported refresh tokens stay refreshable: Forge's
openai-codex profile already uses the Codex CLI's own public client, and the
Grok store is literally keyed by the same client id `oauth_xai` defaults to.

Two format details that would have caused silent misbehaviour. OpenCode
stores expiries in milliseconds while Forge's parser reads bare digits as
epoch seconds, so passing them through unchanged would have dated every
token ~50,000 years out and it would never have been refreshed. Codex
records `last_refresh` rather than an expiry, so that import leaves
`expires_at` unset — "use until the API rejects it" is the honest reading.

Secrets never reach a log line: `DiscoveredLogin` and `DiscoveredSecret`
have hand-written Debug impls that redact, with a test that asserts it.
Discovery takes its paths as arguments rather than reading XDG_DATA_HOME
internally, so it is a pure function of them and the tests are hermetic
rather than passing by luck on a machine where the var happens to be unset.

Also fixes the other half of the connect contradiction #426 addressed.
ConversationRenderKey carried no field for connection state or model, but
the home splash bakes both into its card — so the card was built once and
frozen, and a freshly connected session still read "not connected" while
the footer said otherwise. Invalidating the credential cache (#426) was
necessary but not sufficient; the render cache had to learn about it too.

Verified end to end: a Forge home containing nothing but a copied
.codex/auth.json reaches `provider OpenAI ● connected` on
openai-codex/gpt-5.6-sol with no browser, and answers a real turn.

Claude-Session: https://claude.ai/code/session_018ihDDc3ahfrxu5AYL9moXs

* test(tui): pin the route in the home-card repaint test

It passed locally and failed on CI, for a reason worth recording.

The fixture sets `provider: "mock"`, and `is_mock_provider` short-circuits
`provider_connected_cached` to true — so on CI the card read "connected"
before the test had connected anything, and the first assertion failed. It
passed on this machine only because `TuiApp::new` restored a real persisted
selection (`native` / `xai/grok-3`) over the fixture's mock, which happens
to make the connection logic run for real.

So the test was asserting against whichever provider the host happened to
leave behind. Pin both fields explicitly after construction; neither the
fixture nor the host can reach them now.

Claude-Session: https://claude.ai/code/session_018ihDDc3ahfrxu5AYL9moXs
mohitranka added a commit that referenced this pull request Sep 11, 2026
)

Six real bugs, each with a precise cause. Four other claims from the
benchmark report turned out to be measurement errors in my own tooling and
are not fixed here because there is nothing to fix — see below.

Conversation text was wrapped two columns wider than the area it is drawn
into. The sidebar block takes two columns for borders and two more for
Padding::horizontal(1), but wrapping used width - 2, so the widget clipped
the tail of every full-width line. Characters vanished mid-word with no
ellipsis to admit it — the benchmark caught "the final repository chec"
losing its "k". Now wrapped to the block's real inner width.

The command palette's detail row is now drawn only when the selected row
had to truncate its description, and is padded to the panel width. It was
neither: when nothing was truncated it repeated the line directly above it,
and because it was never padded, whatever it did not cover showed through
from the transcript underneath — "Open the terminal panel (Ctrl+`)and CLI
option.". The panel is a row shorter when the row is not needed.

Connecting now drops the cached connection answer. Without that the first
screen after signing in contradicted itself: a toast saying "connected"
beside a status card still serving the pre-sign-in answer until its TTL
lapsed. invalidate_connected existed and had exactly one caller, which was
not the connect path.

Connecting now lands on the profile's declared default model. It took the
first picker row for the profile instead, and the picker is sorted for
reading, so gpt-5.4 beat the profile's own gpt-5.6-sol. Falls back to the
first row when the declared default is unavailable.

PageUp/PageDown in the conversation now move a page. They moved a
hard-coded 5 rows, which on wrapped prose is about two sentences, so paging
back through a long transcript took dozens of presses. Two rows of overlap
are kept as an anchor across the jump.

Not fixed, because they were not real. An empty focused composer already
draws the thick border; the file tree already draws a selection cursor (as
a background highlight, which plain `tmux capture-pane -p` strips, which is
why I did not see it); unbound keys typed at the Files pane already fall
through to the composer; and Ctrl+O already expands every activity group,
not just the last, so its hint is accurate wherever it appears. Each was
verified against a test or a live PTY run before being dropped.

Claude-Session: https://claude.ai/code/session_018ihDDc3ahfrxu5AYL9moXs
mohitranka added a commit that referenced this pull request Sep 11, 2026
* feat(connect): reuse a sign-in another CLI already completed

Forge keeps its own credential store and reads nothing else, so a user
already signed in to codex, opencode or grok on the same machine was still
sent through a second device-code grant in a browser. Nothing about that
second grant is more secure — same account, same OAuth client, same machine
— it is just friction, and it was the one thing that blocked Forge from
starting at all during the four-way benchmark.

forge-connect gains an `import` module that finds those sessions:

  ~/.codex/auth.json                      Codex     -> openai_codex, openai
  ~/.local/share/opencode/auth.json       OpenCode  -> openai_codex, xai,
                                                       opencode_go, anthropic
  ~/.grok/auth.json                       Grok      -> xai

Discovery is read-only and never adopts anything on its own. A route that
has a reusable session shows a `reuse Codex` tag in the existing
right-aligned tag column of the provider picker, and pressing Enter on that
row — which is the consent — imports instead of opening a browser. A failed
import falls through to the ordinary flow rather than stranding the user.

Client ids line up, so imported refresh tokens stay refreshable: Forge's
openai-codex profile already uses the Codex CLI's own public client, and the
Grok store is literally keyed by the same client id `oauth_xai` defaults to.

Two format details that would have caused silent misbehaviour. OpenCode
stores expiries in milliseconds while Forge's parser reads bare digits as
epoch seconds, so passing them through unchanged would have dated every
token ~50,000 years out and it would never have been refreshed. Codex
records `last_refresh` rather than an expiry, so that import leaves
`expires_at` unset — "use until the API rejects it" is the honest reading.

Secrets never reach a log line: `DiscoveredLogin` and `DiscoveredSecret`
have hand-written Debug impls that redact, with a test that asserts it.
Discovery takes its paths as arguments rather than reading XDG_DATA_HOME
internally, so it is a pure function of them and the tests are hermetic
rather than passing by luck on a machine where the var happens to be unset.

Also fixes the other half of the connect contradiction #426 addressed.
ConversationRenderKey carried no field for connection state or model, but
the home splash bakes both into its card — so the card was built once and
frozen, and a freshly connected session still read "not connected" while
the footer said otherwise. Invalidating the credential cache (#426) was
necessary but not sufficient; the render cache had to learn about it too.

Verified end to end: a Forge home containing nothing but a copied
.codex/auth.json reaches `provider OpenAI ● connected` on
openai-codex/gpt-5.6-sol with no browser, and answers a real turn.

Claude-Session: https://claude.ai/code/session_018ihDDc3ahfrxu5AYL9moXs

* test(tui): pin the route in the home-card repaint test

It passed locally and failed on CI, for a reason worth recording.

The fixture sets `provider: "mock"`, and `is_mock_provider` short-circuits
`provider_connected_cached` to true — so on CI the card read "connected"
before the test had connected anything, and the first assertion failed. It
passed on this machine only because `TuiApp::new` restored a real persisted
selection (`native` / `xai/grok-3`) over the fixture's mock, which happens
to make the connection logic run for real.

So the test was asserting against whichever provider the host happened to
leave behind. Pin both fields explicitly after construction; neither the
fixture nor the host can reach them now.

Claude-Session: https://claude.ai/code/session_018ihDDc3ahfrxu5AYL9moXs
mohitranka added a commit that referenced this pull request Sep 11, 2026
)

Six real bugs, each with a precise cause. Four other claims from the
benchmark report turned out to be measurement errors in my own tooling and
are not fixed here because there is nothing to fix — see below.

Conversation text was wrapped two columns wider than the area it is drawn
into. The sidebar block takes two columns for borders and two more for
Padding::horizontal(1), but wrapping used width - 2, so the widget clipped
the tail of every full-width line. Characters vanished mid-word with no
ellipsis to admit it — the benchmark caught "the final repository chec"
losing its "k". Now wrapped to the block's real inner width.

The command palette's detail row is now drawn only when the selected row
had to truncate its description, and is padded to the panel width. It was
neither: when nothing was truncated it repeated the line directly above it,
and because it was never padded, whatever it did not cover showed through
from the transcript underneath — "Open the terminal panel (Ctrl+`)and CLI
option.". The panel is a row shorter when the row is not needed.

Connecting now drops the cached connection answer. Without that the first
screen after signing in contradicted itself: a toast saying "connected"
beside a status card still serving the pre-sign-in answer until its TTL
lapsed. invalidate_connected existed and had exactly one caller, which was
not the connect path.

Connecting now lands on the profile's declared default model. It took the
first picker row for the profile instead, and the picker is sorted for
reading, so gpt-5.4 beat the profile's own gpt-5.6-sol. Falls back to the
first row when the declared default is unavailable.

PageUp/PageDown in the conversation now move a page. They moved a
hard-coded 5 rows, which on wrapped prose is about two sentences, so paging
back through a long transcript took dozens of presses. Two rows of overlap
are kept as an anchor across the jump.

Not fixed, because they were not real. An empty focused composer already
draws the thick border; the file tree already draws a selection cursor (as
a background highlight, which plain `tmux capture-pane -p` strips, which is
why I did not see it); unbound keys typed at the Files pane already fall
through to the composer; and Ctrl+O already expands every activity group,
not just the last, so its hint is accurate wherever it appears. Each was
verified against a test or a live PTY run before being dropped.

Claude-Session: https://claude.ai/code/session_018ihDDc3ahfrxu5AYL9moXs
mohitranka added a commit that referenced this pull request Sep 11, 2026
* feat(connect): reuse a sign-in another CLI already completed

Forge keeps its own credential store and reads nothing else, so a user
already signed in to codex, opencode or grok on the same machine was still
sent through a second device-code grant in a browser. Nothing about that
second grant is more secure — same account, same OAuth client, same machine
— it is just friction, and it was the one thing that blocked Forge from
starting at all during the four-way benchmark.

forge-connect gains an `import` module that finds those sessions:

  ~/.codex/auth.json                      Codex     -> openai_codex, openai
  ~/.local/share/opencode/auth.json       OpenCode  -> openai_codex, xai,
                                                       opencode_go, anthropic
  ~/.grok/auth.json                       Grok      -> xai

Discovery is read-only and never adopts anything on its own. A route that
has a reusable session shows a `reuse Codex` tag in the existing
right-aligned tag column of the provider picker, and pressing Enter on that
row — which is the consent — imports instead of opening a browser. A failed
import falls through to the ordinary flow rather than stranding the user.

Client ids line up, so imported refresh tokens stay refreshable: Forge's
openai-codex profile already uses the Codex CLI's own public client, and the
Grok store is literally keyed by the same client id `oauth_xai` defaults to.

Two format details that would have caused silent misbehaviour. OpenCode
stores expiries in milliseconds while Forge's parser reads bare digits as
epoch seconds, so passing them through unchanged would have dated every
token ~50,000 years out and it would never have been refreshed. Codex
records `last_refresh` rather than an expiry, so that import leaves
`expires_at` unset — "use until the API rejects it" is the honest reading.

Secrets never reach a log line: `DiscoveredLogin` and `DiscoveredSecret`
have hand-written Debug impls that redact, with a test that asserts it.
Discovery takes its paths as arguments rather than reading XDG_DATA_HOME
internally, so it is a pure function of them and the tests are hermetic
rather than passing by luck on a machine where the var happens to be unset.

Also fixes the other half of the connect contradiction #426 addressed.
ConversationRenderKey carried no field for connection state or model, but
the home splash bakes both into its card — so the card was built once and
frozen, and a freshly connected session still read "not connected" while
the footer said otherwise. Invalidating the credential cache (#426) was
necessary but not sufficient; the render cache had to learn about it too.

Verified end to end: a Forge home containing nothing but a copied
.codex/auth.json reaches `provider OpenAI ● connected` on
openai-codex/gpt-5.6-sol with no browser, and answers a real turn.

Claude-Session: https://claude.ai/code/session_018ihDDc3ahfrxu5AYL9moXs

* test(tui): pin the route in the home-card repaint test

It passed locally and failed on CI, for a reason worth recording.

The fixture sets `provider: "mock"`, and `is_mock_provider` short-circuits
`provider_connected_cached` to true — so on CI the card read "connected"
before the test had connected anything, and the first assertion failed. It
passed on this machine only because `TuiApp::new` restored a real persisted
selection (`native` / `xai/grok-3`) over the fixture's mock, which happens
to make the connection logic run for real.

So the test was asserting against whichever provider the host happened to
leave behind. Pin both fields explicitly after construction; neither the
fixture nor the host can reach them now.

Claude-Session: https://claude.ai/code/session_018ihDDc3ahfrxu5AYL9moXs
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.

1 participant