Repository navigation
feat(frontend): chat header with model label and segmented context meter, composer box - #1405
Merged
smart-ssh-coordinator[bot] merged 5 commits intoNov 20, 2026
Conversation
…ter, composer box (#1372) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
10 tasks
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
10 tasks
There was a problem hiding this comment.
Review
Verdict: changes requested
Review level: normal
Blocking
apps/smart-ssh-community/frontend/src/components/chat/Composer.tsx:83,90— the label is bound through a fixed id,id="chat-composer-input". Every connected session tab stays mounted and is only hidden with CSS (App.tsx:245-270), so with two open sessions there are two textareas with the same id.label[for]resolves to the first one in document order, which is the hidden tab's textarea. In the second tab the visible textarea then has no programmatically associated label, and clicking "Message" focuses nothing. That breaks AC 4 as soon as a second session is open. UseuseId(), asui/Field.tsxdoes, and add a test that renders two composers and checks that each textarea gets its own label.apps/smart-ssh-community/frontend/src/components/ContextUsageIndicator.tsx:33-36— the meter text still comes fromchat.contextUsage("Context {{used}} / {{window}}"), so the header reads "Context 12.4k / 200k". The requirement, AC 2 ("shows "12.4k / 200k""), the design (Main.png: "12.4k / 200k" next to the segments) and the updated Spec 0057 example ("120k / 200k") all show the numbers only. The tests miss this because they only checktoContain("12.4k"). Render the bare numbers (keep or adapt the screen-reader text as needed) and assert the exact text.apps/smart-ssh-community/frontend/src/components/ChatPanel.tsx:99-110— the header shows whichever provider is active when the panel mounts. The PR body says "the chat resolves the active provider per request,chat.rs:589". That line isstart_new_chatand only records the provider id. The provider a session talks to is built once at connect (crates/app-shell/src/commands/connect/mod.rs:223-231) and stays pinned to the session;set_active_ai_providerdoes not touch live sessions. The issue's Technical Notes cover exactly this case: "pins it at connect → expose the pinned provider's name and model with the existing session data instead of guessing in the frontend". Scenario: start connecting to a server (host-key or password prompt open), switch the active provider in Settings, finish the connect. The session uses the old provider, but the header shows the new one. That breaks AC 3 ("for the provider the session uses"). The new Spec 0034 §11 wording, "des aktiven KI-Anbieters", describes the same wrong behaviour.docs/specs/0057-rich-session-model.md:166— the spec says the meter sits next to "KI · ", but the code renders the literal "AI · " in every locale, and Spec 0034 §11 says "AI · ". The two specs disagree with each other and 0057 disagrees with the code. Use one wording that matches what is rendered.ChatPanel.tsx:267-325,:345-353,ChatSessionPickerScreen.tsx:98— the requirement line says status rows, the drop highlight and the read-only and no-provider hints get a "flat style with icons from the set", and the session picker gets "label typography". The PR removed the rounding but added no icons: the retrying, waiting and generating rows still use the animated dot, and the read-only and no-provider hints have no icon. The "Past sessions" heading still uses its owntext-xs font-semibold uppercaseclasses instead oftext-label. (Unsure about the exact intent of "with icons from the set".) Either add the icons and label typography, or state in the PR why none applies, so that the requirement is not narrowed silently.
Non-blocking
src/components/ChatPanelNewChat.test.tsx:178-180—findByTestId("chat-header-title")resolves at once on the initial "AI" text, and the exacttoBe("AI · claude")only passes because the mocked promise settles inside the sameactflush. ADR 0122 R6 says to wait for the final DOM state:await screen.findByText("AI · claude"). Line 186 readsmock.calls[0][0]without thewaitFor(... toHaveBeenCalled())that the older test at :82 uses.e2e/tests/long-content-dialogs.spec.ts:61—div.bg-surface-raisedwithhas: titlecan also match an ancestor container. A test id on the card would be more robust. It passed 10/10 runs.
Verified
- files read: 8/8 logic files plus 5/5 test files, full diff (read:
git diff origin/develop...HEAD -- <file>) - counter-proof: not applicable. This is a feature, not a bug fix. The new
contextSegmentstests cannot pass on base, where the helper does not exist (read). - edge cases: two open session tabs → finding (duplicate id); provider switched during connect → finding; meter at 0 / unknown window / over 100 % → ok (
contextSegmentsclamps to 0..8, tests cover it); no meter before the first answer → ok (read and test); MCP read-only tab has no header → ok (read:readOnlyHintbranch unchanged); narrow composer: "+" only with registered actions, Send visible, 44 px input row (min-h-11) → ok (read) - callers checked:
ContextUsageIndicator(1 call site, nowChatPanel) → ok;ComposercontextUsageprop removed (1 call site) → ok;contextSegments/CONTEXT_SEGMENTSnew → ok (rg) - backend counterpart:
connect/mod.rs:223pins the provider;ai_providers.rs:137set_active_ai_provideronly writes the store (read) - tests run locally:
npx vitest runon ContextUsageIndicator, ChatPanelNewChat/Input/Attachments/VoiceInput/AiWait/AiError/Scroll,src/lib,src/locales→ 431 passed, 6 skipped (executed);npx tsc -b→ ok (executed);npm run lint→ exit 0, colour guard and locale checks included (executed) - UI:
chat-panel-review.spec.ts,narrow-chat.spec.ts,accessibility.spec.ts→ 118 passed in all projects (executed locally). The changed tests "composer: labelled box…" and "note diff preview…" ran with--repeat-each=5→ 40/40 passed (executed). No own screenshots: the comparison withMain.pngwas by reading, and the meter-text deviation above comes from it. - CI: all checks green (executed:
gh pr checks 1405) - data: not touched
Timing analysis
- 5 test files analysed.
ChatPanelNewChat.test.tsx:178-180: reported as likely (assertion runs before the async provider load). Dismissed as a timing risk because the mock resolves through microtasks only, with no wall-clock dependency, so the order does not change under load. Kept as an ADR 0122 R6 non-blocking note above.:186(mock.calls[0][0]without waiting) → possible, non-blocking. The other files: no timing dependency found.
Spec
- visible behaviour changed: new chat header (model label with provider tooltip, segmented meter moved from the composer to the header, "+ New chat" with icon); composer with visible "Message" label, 2-row box, toolbar row, Send with icon, ">" glyph removed; flat status rows, toasts and picker
- spec searched (
rg -il 'Eingabefeld|Composer|Kontextanzeige|Kontext.*Fenster|Neuer Chat|Sprach-?eingabe|Senden' docs/specs/); covering specs: 0057 "Anzeige im Chat", 0034 §11, 0113 §4a (narrow composer, still accurate), 0110 §10 (composer actions, still accurate) - verdict: spec change present but does not match the code. 0057 says "KI · " while the code renders "AI · …"; 0034 §11 says "aktiven KI-Anbieters" while the session uses the provider pinned at connect (blocking, see above).
Security checks
- Frontend presentation only. No filter, risk, redaction, credential or execution path touched;
review-levelis normal. The header shows the provider display name and model id, no secrets. "Threat model: no change – presentation-only frontend change" holds. No new IPC command. The public boundary is ok: English PR texts, no internals.
Follow-ups
None.
…ue composer label id (#1372) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Contributor
Author
|
Review points, fixed in 4bacb83 unless noted:
Threat model: no change – the new command only reads the session's already-visible provider label and model, no secrets. |
There was a problem hiding this comment.
Review
Verdict: changes requested
Review level: normal
Blocking
src/components/ChatPanel.tsx:299,312,323,:357-364,src/components/ChatSessionPickerScreen.tsx:98(frontend paths) — previous finding 5 is still open, and the reason given for leaving it ("the acceptance criteria don't require icons there") is not enough. The issue's Requirements are normative, and this line was narrowed: "Status rows, jump-to-latest button (square), drop highlight, read-only and no-provider hints: flat style with icons from the set" and "Session picker screen …: square panels, 1 px rules, label typography". The retrying, waiting, automatic-mode and generating rows still use the round pulsing dot (animate-ping rounded-full), so they are not flat and use no icon from the set. The read-only and no-provider hints have no icon. The "Past sessions" heading still uses its owntext-xs font-semibold tracking-wide uppercaseclasses instead oftext-label. Narrowing a requirement line is never non-blocking. Replace the dots with an icon from the set (e.g. a static or spinning set icon), add set icons to the two hints, and switch the picker heading totext-label. If you think a part does not apply, record it under "Assumptions" with the reason so the maintainer can decide; do not drop it silently.src/components/ChatPanelNewChat.test.tsx:18-20,182— the pinned-provider fix (previous finding 3) is not covered by any test. Counter-proof: withChatPanel.tsxreset to the previous commit (header built from the active provider oflistAiProviders()),ChatPanelNewChat.test.tsxstill passes 7/7, because both mocks return the same provider (Claude/claude). Make the active provider inlistAiProvidersdiffer from the pinned one thatgetSessionAiProviderreturns (e.g. activeOpenAI/gpt-4o, pinnedClaude/claude). Then assert that the header shows the pinned one: wait for the final text (await screen.findByText("AI · claude"), ADR 0122 R6) and check the tooltip. Also rename the test, which still says "active provider's model".
Non-blocking
- The PR body is out of date. It still says "the chat resolves the active provider per request,
chat.rs:589" and "AI · <model>of the active provider". Since 4bacb83 the header uses the provider pinned at connect (get_session_ai_provider). Please update the Summary, AC and Assumptions sections. crates/app-shell/src/commands/chat.rs:586-596—get_session_ai_providerhas no Rust test. It is a trivial read ofsession.ai.label/session.ai.model, whichsession_builder.rs:392-401sets once at connect.ChatPanelNewChat.test.tsx:188:mock.calls[0][0]is still read without first waiting withwaitFor(() => expect(onChatContextUsage).toHaveBeenCalled())(carried over from the last review).
Verified
- files read: 6/6 logic and test files of the delta 6a6aa9b..4bacb83 (read:
git diff 6a6aa9baf..HEAD) - counter-proof: label id:
chat/Composer.test.tsxfails with the previousComposer.tsxand passes with the fix (executed). Meter text:ChatPanelNewChat.test.tsxmeter test fails with the previousContextUsageIndicator.tsxand passes with the fix (executed). Pinned provider: stays green without the fix (executed) → finding above. - backend:
AiConfig.label/modelcome only fromsession_builder.rs:392(the active config at connect). Reconnect keeps the sameSessionobject, so the pinned values stay correct (read). The command has no side effects and returns no secrets. - edge cases: unknown session / command error → header falls back to "AI" (read:
.catch); session id changes → stale response ignored viacancelled(read); two mounted composers → unique ids (test, executed) - callers checked:
chat.contextUsagekey removed →rgfinds no remaining use, lint and locale parity green (executed);getSessionAiProvider(1 call site), added toapiMockandfakeBackend→ ok - tests run locally:
npx vitest run src/components/chat src/components/ContextUsageIndicator.test.tsx src/components/ChatPanel* src/lib/contextUsage src/locales→ 319 passed, 6 skipped (executed);npm run lint→ exit 0 (executed);cargo fmt --all --check,cargo check -p app-shell --locked→ ok (executed) - UI:
chat-panel-review.spec.ts,narrow-chat.spec.ts,accessibility.spec.ts→ 118 passed, all projects (executed locally) - CI: all checks green (executed:
gh pr checks 1405) - data: not touched
Timing analysis
- 2 test files analysed (delta).
ChatPanelNewChat.test.tsx:184-185: reported as likely (header assertion before the provider promise settles). Dismissed as a load risk, as in the last round: the mock resolves through microtasks only. ADR 0122 R6 still applies, so the test should wait for the final text (part of the blocking test fix above).:188→ possible, non-blocking.chat/Composer.test.tsx: synchronous, no timing dependency.
Spec
- visible behaviour changed (delta): the header shows the session-pinned provider; the meter text is now the bare numbers
- spec searched:
rg -il 'Kopfzeile|Composer|Kontextanzeige|Neuer Chat|AI · |Modell' docs/specs/; covering specs: 0034 §11, 0057 "Anzeige im Chat" - verdict: both now say "AI · ", 0034 §11 says "the provider this session was bound to at connect", and 0057 says "120k / 200k". Both match the code. The spec has no rule about status-row icons, so it needs no change for the blocking item.
Security checks
- Presentation only, plus a read-only IPC command without side effects that returns the provider display name and model (no key, no secret). No filter, risk, redaction, credential or execution path touched. "Threat model: no change" holds.
check-commands(lint) confirms the registration. English texts, no internals.
Previous findings
- 1 duplicate composer id → fixed in 4bacb83 (
useId, two-composer test, counter-proof done) - 2 meter text "Context …" → fixed in 4bacb83 (exact assertion, counter-proof done)
- 3 provider pinned at connect → fixed in 4bacb83 (
get_session_ai_provider); no meaningful test yet (blocking above) - 4 spec wording KI/AI → fixed in 4bacb83
- 5 icons and label typography → still open (blocking above)
Follow-ups
None.
… session picker, pinned-provider test (#1372) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Contributor
Author
There was a problem hiding this comment.
Review
Verdict: approved
Review level: normal
Blocking
None.
Non-blocking
ChatPanel.tsx:311-314: the automatic-mode status row now shows twosparkicons side by side, the new pulsing one and the existing inline one before the text. Consider dropping one of them. This is cosmetic only.- PR body, Summary: the text still says "
AI · <model>of the active provider" right before "the session's pinned provider". The code and Spec 0034 §11 use the pinned provider.
Verified
- delta reviewed:
4bacb83ee..4e325f6d8, 3 files (read: full delta diff); files read: 3/3 logic files of the delta - counter-proof:
ChatPanelNewChat.test.tsx› "shows the session's pinned provider, not the currently active one". I switched the header source back to the active provider fromlistAiProviders(): the test fails. With the PR code restored it passes, and the clone is clean again (executed:npx vitest run src/components/ChatPanelNewChat.test.tsx -t "pinned provider") - edge cases:
getSessionAiProviderrejects → header shows plain "AI" (read:ChatPanel.tsx:108-119, the default mock rejects) → ok. Session switch: the effect is keyed onsessionIdand has a cancel flag → ok. Read-only MCP hint and no-provider hint keep their text inside a<span>, with an icon added → ok - icons used:
spark,lock,warnexist in the shared set (read:src/components/ui/Icon.tsx:42,72);text-labelis a defined utility (read:src/index.css:386) - callers checked:
getSessionAiProvider(1 production call site; handler ine2e/harness/fakeBackend.ts:257; registered ingenerate_handler!) → ok - tests run locally:
npx vitest run src/components/ChatPanel* src/components/ChatSessionPicker* src/components/ContextUsageIndicator.test.tsx src/components/NoteSuggestionToast* src/components/NoteShrink*→ 183 passed (executed);npx tsc -bandnpm run lint→ clean (executed) - UI:
chat-panel-review.spec.ts,narrow-chat.spec.ts,accessibility.spec.ts→ 118 passed in Chromium and WebKit (executed locally). The e2e specs did not change in this delta, so I did not repeat the 5× run. - CI: all checks green on head
4e325f6d8(executed:gh pr checks 1405); PR is mergeable - data: not touched
Timing analysis
- 1 test file analysed (
ChatPanelNewChat.test.tsx, new pinned-provider test): no timing dependency found. The test waits withfindByText, and its absence check runs only after the final state is in place.
Spec
- visible behaviour changed in this delta: icons on the status rows and the read-only/no-provider hints, label typography on the session picker heading. These are presentation only and are covered by the issue's redesign requirements.
- spec searched (executed:
rg -il 'kopfzeile|Kontext.*Chat|Neuer Chat|Modell' docs/specs/). The header and meter are in Spec 0057 "Anzeige im Chat" and Spec 0034 §11, both updated in this PR and matching the code (header label from the session's pinned provider, 8 segments, "12.4k / 200k", warning colour from 75 %). - verdict: the spec changes are present and match the code; the delta needs no further spec change. A changelog fragment is present.
Security checks
- Frontend presentation delta only. The read-only
get_session_ai_providercommand from the previous round returns only the provider label and model, with no secrets and no side effects. No filter, confirmation or redaction path is touched, andThreat model: no changeis justified.
Manual checks pending
- AC 1 (pixel match against
Main.png,MainLight.pngandMobChat.png), desktop and narrow: compare visually.
Previous findings (follow-up round only)
- Round 1 #5 / round 2 #1 (status-row icons, hint icons, picker
text-label) → fixed in 4e325f6 - Round 2 #2 (pinned-provider test without effect) → fixed in 4e325f6; the counter-proof now fails without the fix
- Round 2 non-blocking (PR body said "per request") → corrected; a small wording leftover is noted above
Follow-ups
None.
smart-ssh-coordinator
Bot
deleted the
issue-1372-redesign-chat-panel-header-with-model
branch
November 20, 2026 14:47
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1372
Summary
Chat header (40 px):
AI · <model>of the active provider (provider name in the tooltip; the session's pinned provider, as resolved at connect), the 8-segment context meter with numbers, and "+ New chat". The composer is now a labelledsurface-sunkenbox with a 2-row textarea and a toolbar row (composer actions, ghost voice button, Send with icon); the>glyph is gone. Status rows, jump button, drop highlight, session picker and note toasts are flat/square. New strings (chat.messageLabel,chat.headerProviderTooltip) in all 25 locales.Acceptance Criteria
data-near-limit, none before first answer: met —ContextUsageIndicator.test.tsx:fills ceil(used / window × 8) segments,…renders 8 aria-hidden segments…;ChatPanelNewChat.test.tsx:shows the active provider's model in the header and the meter only after the first answer.ChatPanelInput.test.tsx:has a visible label associated with the textarea; existing Enter/Shift+Enter/IME tests unchanged and green.ChatPanelVoiceInput/Attachments/AiWait/Scroll/NewChattests green.chat-panel-review.spec.ts:Tab order of the message area and the input,accessibility.spec.tschat screens,narrow-chat.spec.ts(all pass, chromium + webkit).localeKeyParity.test.ts.chat-panel-review.spec.tscomposer test rewritten (no>span); others needed no change.Tests
vitest
src/components(1196) green, locale parity green, Playwright chat-panel-review / narrow-chat / accessibility green. No regression-bug fix, so no counter-proof.Assumptions
Spec
updated 0057, updated 0034
Threat model: no change – presentation-only frontend change.
Manual test steps
Follow-ups
None.
🤖 Generated with Claude Code
Review follow-up: status rows now use the
sparkicon (pulsing) instead of the round dot; read-only and no-provider hints carrylock/warnicons; the session picker heading usestext-label. Added ChatPanelNewChat.test.tsx test with differing active vs pinned provider (not counter-proven against the pre-fix code).