Skip to content

Show first messages immediately and refresh Home in the background - #1902

Merged
santoshkumarradha merged 4 commits into
devfrom
fix/snappy-tui-navigation
Oct 22, 2026
Merged

santoshkumarradha merged 4 commits into
devfrom
fix/snappy-tui-navigation

Conversation

@santoshkumarradha

@santoshkumarradha santoshkumarradha commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Sending a first message from Home or a new tab previously left the starter on screen until its conversation finished opening. It now immediately shows a chat screen with the submitted message and opening conversation… · esc cancels, before any model token arrives. The Chats navigation is selected during that preview.

Home paints its last completed reading and refreshes conversations, memory changes, spending, deliverables and folder availability off the UI loop. One outstanding read is shared across visits; stale replies cannot replace a newer visit. Page-entry spending refreshes also run in the background. Failed openings preserve drafts and attachments; cancellation cannot click through the preview into an old page target. New-tab recent conversations were already loaded lazily and retain that path.

Measured first-message response

Compared current dev ed7fe43d5 against 58a554c6d, using freshly built binaries and the real running TUI. All values are milliseconds; each cell is median / p95.

First sent-message row visible Samples per build Before After
From Home, ordinary setup 5 33.59 / 40.75 19.19 / 19.92
From new tab, ordinary setup 5 36.19 / 42.51 21.17 / 38.31
From Home, controlled 800 ms backend stall 5 839.71 / 850.46 19.87 / 27.93
From new tab, controlled 800 ms backend stall 5 834.42 / 838.38 20.67 / 21.83

During the controlled stall, the visible wait falls by 97.6% from Home and 97.5% from a new tab. The model still starts after its conversation is ready; the UI no longer waits with it.

Navigation, typing and model timings
Observation Samples per build Before median / p95 After median / p95
Open Home with two spaces 20 17.45 / 18.80 18.21 / 20.48
Open a new tab 20 17.60 / 19.91 15.46 / 20.38
Open Settings 20 18.07 / 20.15 18.74 / 19.80
Typing appears in the composer 20 17.93 / 20.35 18.25 / 20.00
Escape from Home 20 67.21 / 72.47 67.87 / 73.18
Escape from a new tab 20 67.99 / 71.59 66.30 / 72.20
Escape from Settings 20 67.31 / 70.98 68.01 / 72.29
Provider time to first token, from usage records 20 246.00 / 438.00 260.50 / 330.00
Short answer visible, ordinary setup 10 344.38 / 791.71 355.54 / 468.45
Short answer visible, controlled stall 10 1096.43 / 1342.19 1162.62 / 1592.42

Warm navigation and typing were already fast and remain around 15–20 ms. These small changes are within the measurement resolution; no general navigation speedup is claimed. Model timings vary with serving conditions and are reported separately, without a model-speed claim.

How the timing is measured

  1. Drive the built TUI in a 140 × 42 terminal. Start the clock immediately before delivering the input and stop when the requested state appears in the actual terminal framebuffer.
  2. Measure Home, new-tab, Settings, typing and return transitions 20 times each. Measure first-message visibility five times per entry point, both normally and while the backend is unavailable for a controlled 800 ms.
  3. Count only the sent-message row in the chat body; exclude its existing draft composer and tab title. Read provider TTFT separately from recorded usage, and measure the short answer separately from the immediate acknowledgement.
  4. Observe at 5 ms intervals plus command overhead. The usual test-helper settling delay is excluded. With five samples, p95 is the largest observation; these timings are diagnostic rather than machine-independent guarantees.

Both final runs passed: baseline 40.69 s, candidate 41.62 s. Each sent 20 live messages through OpenRouter with deepseek/deepseek-v4.1-flash. Each run audited 198 model-log rows / 98 completed requests; every primary and auxiliary record named that exact model.

Reproduce with an existing OpenRouter key configured:

make build
CODEAF_E2E_MODEL=deepseek/deepseek-v4.1-flash go test -tags e2e ./internal/e2e -run '^TestNavigationLatency$' -count=1 -timeout 8m -v

Validation and limits

  • make pr-ready passed on 58a554c6d: build, vet, formatting, packed manuals, repository laws and fresh touched-package tests, including all eight TUI shards.
  • Focused concurrency and opening regressions also passed with -race -count=1 on the final head.
  • Focused coverage checks blocked-reader responsiveness, coalescing across visits, stale replies, draft preservation, opening failures, immediate first-message display and cancelling pointer presses. Existing assertions now await background arrivals.
  • Opening previews sanitize and wrap at most four bytes per viewport cell; no full pasted-message render is required. No session or model request is created merely by opening a new tab.
  • Full application startup time, legacy shared-session opening, and every possible page/data size are outside this measurement. A first Home visit can show its shell before its rows arrive.

Timing evidence is inline above. Raw measurements, binary hashes, model receipts and actual terminal captures are preserved locally. Direct PR attachment upload is unavailable; no evidence files are committed.

GitHub PR gate: all six jobs passed; the CLA check also passed.

The owner reviewed the timing results and approved merging once all checks were green.

@santoshkumarradha
santoshkumarradha marked this pull request as ready for review October 22, 2026 23:02
@santoshkumarradha
santoshkumarradha merged commit 47a3f80 into dev Oct 22, 2026
7 checks passed
@santoshkumarradha
santoshkumarradha deleted the fix/snappy-tui-navigation branch October 22, 2026 23:06
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