Skip to content

Show harness and model as coloured chips in the session rail - #904

Merged
realtonyyoung merged 5 commits into
mainfrom
claude-tyoung/rail-harness-model-chips
Sep 11, 2026
Merged

realtonyyoung merged 5 commits into
mainfrom
claude-tyoung/rail-harness-model-chips

Conversation

@realtonyyoung

Copy link
Copy Markdown
Collaborator

Closes #898 — AI-2716
Part of #899 — AI-2717 (model-chip UI; daemon model resolution follows separately)

What & why

The session rail rendered the harness/vendor and model as plain text. The web UI shows the vendor as a per-vendor coloured chip and the model as a single info-tint chip. This brings the rail to that treatment: the vendor palette mirrors the web values exactly, and cursor / any unknown vendor fall back to a neutral pair.

Where to look

VendorChipPalette holds the vendor→colour map. The session-row template now carries a title line plus a chips line (vendor, model, machine badge, meta); a row with no title lets the chips line stand as its identity. Model chips show wherever a model is resolved — Pi today and any explicitly chosen model — so other vendors' default launches stay blank until the daemon resolution (AI-2717) lands.

Verification

dotnet build src/Capacitor.App → 0 warnings. Filtered dotnet run on the App test suite: VendorChipPaletteTests 3/3, RailSessionViewModelTests 13/13, MainWindowSmokeTests 11/11.

The vendor chip palette mirrors the web UI; cursor and unknown vendors fall back to a neutral pair. The model chip appears wherever the daemon has resolved a model — Pi today and any explicitly chosen model; resolving it for other vendors' default launches is a separate change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Show vendor and model chips in the session rail

✨ Enhancement 🧪 Tests 🕐 20-40 Minutes

Grey Divider

AI Description

• Render session vendors with web-matched colours and neutral fallback chips.
• Show resolved models in a shared info-tinted chip.
• Reorganize row metadata while preserving titleless-session identity.
Diagram

graph TD
  A["Agent Row"] --> B["Rail Session VM"] --> C["Session Rail View"]
  C --> D["Vendor Brush Converters"] --> E["Vendor Chip Palette"]
  C --> F["App Color Resources"]
Loading
High-Level Assessment

The current approach is appropriate: a framework-independent palette centralizes vendor colours, converters retain Avalonia brush creation in the view layer, and the view model exposes semantic display fields rather than UI objects. Embedding brushes in the view model or duplicating vendor styles in XAML would increase coupling or repetition without improving the design.

Files changed (7) +153 / -35

Enhancement (5) +106 / -23
App.axamlAdd shared model chip colours +3/-0

Add shared model chip colours

• Defines information foreground and dim-background brushes for model chips, matching the web UI treatment.

src/Capacitor.App/App.axaml

VendorChipPalette.csCentralize vendor chip colour mappings +27/-0

Centralize vendor chip colour mappings

• Adds a case-insensitive frozen palette for supported vendors. Cursor, missing, and unknown vendors receive a neutral foreground and background pair.

src/Capacitor.App/Services/VendorChipPalette.cs

RailSessionViewModel.csExpose separate title, chip, and metadata fields +20/-8

Expose separate title, chip, and metadata fields

• Replaces the combined subtitle with vendor, model, and metadata properties plus visibility flags. Non-agent kinds, borrowed state, and age now form trailing metadata while titleless rows rely on their chips.

src/Capacitor.App/ViewModels/RailSessionViewModel.cs

Converters.csConvert vendor keys into chip brushes +26/-0

Convert vendor keys into chip brushes

• Adds foreground and background converters that resolve palette colours and create immutable Avalonia brushes without placing UI brush concerns in the view model.

src/Capacitor.App/Views/Converters.cs

SessionRailView.axamlRender vendor and model chips in session rows +30/-15

Render vendor and model chips in session rows

• Reworks session rows into an optional title line and a horizontal chip-and-metadata line. Vendor colours come from converters, models use the shared information tint, and long model names are constrained and trimmed.

src/Capacitor.App/Views/SessionRailView.axaml

Tests (2) +47 / -12
RailSessionViewModelTests.csVerify chip-oriented session presentation data +20/-12

Verify chip-oriented session presentation data

• Updates assertions for separate title, vendor, model, and metadata properties. Covers titleless rows, non-agent kinds, borrowed sessions, and unresolved models.

test/Capacitor.App.Tests.Unit/RailSessionViewModelTests.cs

VendorChipPaletteTests.csTest vendor palette lookup and fallbacks +27/-0

Test vendor palette lookup and fallbacks

• Verifies web-aligned known-vendor colours, case-insensitive lookup, and neutral handling for cursor, unknown, and missing vendors.

test/Capacitor.App.Tests.Unit/VendorChipPaletteTests.cs

@qodo-code-review

qodo-code-review Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Three chip comments repeat the markup ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
The Model chip, Vendor chip, and second Model chip comments merely label resources and
controls whose names, bindings, and styles already state those roles. Any later palette or layout
change must update these comments despite their supplying no non-obvious constraint or rationale.
Code

src/Capacitor.App/App.axaml[33]

+            <!-- Model chip: one info tint for every model (the web UI's hk-chip-model). -->
Relevance

●●● Strong

Recent App.axaml and comment-rule precedents accept removing redundant or non-durable comments.

PR-#653
PR-#803

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Compliance rule 2762993 disallows comments that only restate clearly expressed code. The cited
comments label model and vendor chips immediately beside explicitly named resources, bindings, and
controls that already communicate the same information.

Rule 2762993: Restrict comments to documenting non-obvious, behavior‑critical constraints
src/Capacitor.App/App.axaml[33-35]
src/Capacitor.App/Views/SessionRailView.axaml[195-203]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Three newly added chip comments restate self-explanatory resource names and markup without documenting a non-obvious constraint.

## Fix Focus Areas
- src/Capacitor.App/App.axaml[33-35]
- src/Capacitor.App/Views/SessionRailView.axaml[195-203]

## Recommended Fix
Remove the redundant model and vendor chip label comments while leaving the resources and control markup unchanged.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Long chips hide session details ✓ Resolved 🐞 Bug ≡ Correctness
Description
The horizontal StackPanel measures the vendor, model, machine badge, and Meta at their desired
widths, while only the model border has a maximum width and the other externally sourced labels
remain unbounded. When their combined width exceeds the fixed 310-pixel rail, trailing details can
render outside the row or be clipped, and Meta cannot use its configured ellipsis to remain
visible.
Code

src/Capacitor.App/Views/SessionRailView.axaml[194]

+                                                                                    <StackPanel Orientation="Horizontal" Spacing="6">
Relevance

●● Moderate

Layout correctness concerns are plausible, but history lacks a closely matching accepted or rejected
chip-layout precedent.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new horizontal stack contains all four dynamic elements but provides no horizontal allocation
between them; vendor and machine labels have neither maximum widths nor trimming, while the metadata
block is measured after them. The containing sessions surface fixes the entire rail at 310 pixels,
and AgentRow passes daemon-provided vendor, model, and machine names through without
display-length limits.

src/Capacitor.App/Views/SessionRailView.axaml[194-218]
src/Capacitor.App/Views/MainWindow.axaml[31-34]
src/Capacitor.App/Services/AgentRow.cs[28-37]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new horizontal chip row measures dynamic labels without a shared width constraint, so long vendor, machine, or metadata values can overflow or be clipped inside the fixed-width rail.

## Fix Focus Areas
- src/Capacitor.App/Views/SessionRailView.axaml[194-218]

## Recommended Fix
Replace the horizontal `StackPanel` with a width-constrained layout such as a `Grid`, reserve a bounded or remaining-width column for metadata, and apply maximum widths plus text trimming to every externally sourced chip label. Ensure the complete row stays within its available width even when vendor, model, and machine names are long.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Informational

3. Two chip converters lack own files ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
Converters.cs adds VendorChipBackgroundConverter and VendorChipForegroundConverter as public
top-level types in a file whose name matches neither type. Because these types do not qualify for
the narrow private or internal hierarchy exception, later navigation and ownership changes must
continue through an unrelated converter collection.
Code

src/Capacitor.App/Views/Converters.cs[74]

+public sealed class VendorChipBackgroundConverter : IValueConverter {
Relevance

● Weak

Recent one-type-per-file findings in this repository were explicitly rejected, including matching
public-type cases.

PR-#865
PR-#873
PR-#875

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Compliance rule 3162234 requires one public primary type per matching file unless a narrow exception
applies. The cited regions show two new public top-level converter classes added to Converters.cs.

Rule 3162234: One primary type per file, with only narrow documented exceptions
src/Capacitor.App/Views/Converters.cs[71-82]
src/Capacitor.App/Views/Converters.cs[84-94]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The two new public vendor-chip converters are top-level types in `Converters.cs`, so neither primary type has a matching source file.

## Fix Focus Areas
- src/Capacitor.App/Views/Converters.cs[71-94]

## Recommended Fix
Move `VendorChipBackgroundConverter` and `VendorChipForegroundConverter` into `VendorChipBackgroundConverter.cs` and `VendorChipForegroundConverter.cs` respectively, preserving their namespace and behavior.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context sources
✅ Compliance rules (platform): 64 rules
✅ Cross-repo context — repo relationships
  Explored: repo: kurrent-io/kcap-web (sha: 154ca507)
Review mode: ⚖️ Balanced: This is a behavior-changing UI and view-model update spanning palette logic, converters, XAML layout, and session metadata handling, so it warrants a complete single-pass review but is not dense enough for extended review.

Grey Divider

Tip of the day
💡 Did you know, you can switch off images and animations for a plain-text comment

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread src/Capacitor.App/App.axaml Outdated
Comment thread src/Capacitor.App/Views/SessionRailView.axaml Outdated
@linear-code

linear-code Bot commented Sep 11, 2026

Copy link
Copy Markdown

AI-2716

realtonyyoung and others added 4 commits September 11, 2026 15:24
Every externally-sourced chip label (vendor, model, machine badge) is width-capped and ellipsizes, so a long token cannot spill past the 310px rail. Drops the redundant chip-label comments.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The chips row is now a Grid whose meta column takes the remaining width and trims, so the row fits the 310px rail even when every chip is long. The two vendor-chip converters move to their own files (one type per file), and the restating/misleading comments are dropped.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
A WrapPanel wraps chips + meta to a second line instead of overflowing when a label is unusually long; each chip stays individually capped and trimmed. Corrects the chip converters' comments.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

Desktop: show the harness/vendor as a coloured chip in the session rail

1 participant