Skip to content

fix(mecatui): render sharp splash in direct Ghostty 1.4+ - #2596

Merged
jbeda merged 1 commit into
mainfrom
impl/2586-ghostty-sharp-splash
Oct 29, 2026
Merged

jbeda merged 1 commit into
mainfrom
impl/2586-ghostty-sharp-splash

Conversation

@jbeda

@jbeda jbeda commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #2586.

  • Reuse the existing source-resolution mascot path for exact TERM_PROGRAM=ghostty, strict SemVer TERM_PROGRAM_VERSION >= 1.4.0, and absent TMUX.
  • Preserve native Kitty precedence, capability detection, overrides, and multiplexer fallbacks. Missing, malformed, or older Ghostty versions keep the target-sized PNG.
  • Add version/environment boundary coverage and an exported-entry regression that decodes the actual transmitted PNG and checks resolution, alpha, and placement controls.

No terminal probing, tmux passthrough work, or Mosh policy changes. The SemVer parser was already pinned; only its indirect/direct classification changes.

Verification

  • Regression demonstrated failing before the selector change
  • go test ./cmd/mecatui/ui/welcome ./cmd/mecatui/ui
  • Exported-entry regression with poisoned native Kitty/terminal/version/tmux environment
  • task test
  • task lint
  • task test:race
  • task build
  • go run ./cmd/mecademo — tool call, permission ask/approval, and final result verified
  • Independent Spec, Standards, Test adequacy, and Domain reviews: no findings
  • Live Ghostty splash rendering manually verified by @jbeda.

API compatibility

Local terminal presentation only. No server/engine/wire contracts, exported signatures, feature identifiers, or stored formats change; no major bump or upgrade action is required. Native Kitty and capability/fallback behavior remain unchanged.

The full approved implementation plan is archived in a PR conversation comment; it describes intended checks separately from the actual results above. Its complete content and SHA-256 were verified after publication.

Reuse source-resolution Kitty graphics for direct Ghostty sessions with a strict SemVer >= 1.4.0, preserving capability detection and multiplexer fallbacks. Cover version selection and the exported PNG transmit path.

Co-authored-by: Mecatl <[email protected]>
@jbeda

jbeda commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

Implementation plan archive

  • Slug: 2586-ghostty-sharp-splash
  • Source provenance: .scratch/2586-ghostty-sharp-splash-plan.md (local ignored plan, not a remote link)
  • Implementation branch: impl/2586-ghostty-sharp-splash; base: main
  • Branch start: 5c1a60808e5ccb51e97c6a7cfdde4e359ff0e61f
  • Local implementation commit: 7a27373998e95cf4015076477d47a116f6768532
  • Updated: 2026-10-28T23:26:24Z
  • SHA-256 of the full plan portion below (including its final newline): 9ffece1c1ce123dd66137a57f8f0a41a8b5d0f52ef8d4cff7e893e1787f2fea0

This archives the approved plan and its verification intentions, not a claim that every planned check has completed. Actual gate results and the outstanding live Ghostty visual check are recorded in the PR description. No plan content was redacted.


Direct Ghostty 1.4+ sharp splash

Slug: 2586-ghostty-sharp-splash
Implementation branch: impl/2586-ghostty-sharp-splash
Base branch: main

Goal and scope

Address #2586: let direct Ghostty 1.4+ use the existing source-resolution mascot path instead of the cell-footprint downscale. Expected code scope: cmd/mecatui/ui/welcome/kitty.go and kitty_test.go, plus promoting an existing SemVer dependency to direct in root go.mod if required. No new dependency version or module pin changes.

Keep capability detection, overrides, native Kitty behavior, placement, chunking, image lifetime, half-block fallback, and UI callers unchanged. No terminal probe, tmux passthrough work, Mosh policy change, or general terminal support expansion. The operator approved this narrow scope and authorized implementation and PR creation; tmux passthrough and runtime probing remain explicitly excluded.

Current behavior and minimum approach

  • kittyNativeResolution (kitty.go:149) already chooses source resolution for KITTY_WINDOW_ID or TERM containing kitty.
  • TransmitMascot (kitty.go:178) passes that decision into transmitMascot; true preserves the decoded embedded image and alpha, false uses cols × (rows*2) pixels. Keep this encoder and its existing source-resolution path.
  • Model.maybeKittyTransmit (cmd/mecatui/ui/update.go:2111) independently gates capability, splash visibility, and tier before transmitting via tea.Raw. No caller changes are needed.
  • detectKitty (kitty.go:89) suppresses Ghostty heuristics under tmux/screen, with existing native Kitty and explicit override exceptions. Do not change it.
  • The upstream report ghostty-org/ghostty#13056 concerns virtual placement under tmux on 1.3.1, not a universal direct-session failure. Correct nearby comments without claiming the report proves a generic large-payload bug.

Extend the existing pure resolution selector after its existing native Kitty checks. The additional Ghostty path is true only if:

  1. TERM_PROGRAM is exactly ghostty (not the broader capability detector's aliases).
  2. TMUX is absent, including rejecting a present-but-empty value.
  3. TERM_PROGRAM_VERSION is valid strict SemVer and compares >= 1.4.0.

Use the already-pinned github.com/blang/semver/v4 (root go.mod currently indirect), whose Parse validates SemVer; do not write a parser or use tolerant coercion. Bare 1.4.0 is accepted; incomplete, whitespace-padded, leading-v, and malformed values are rejected. SemVer prerelease precedence applies: 1.4.0-rc.1 is below the threshold; 1.4.1-rc.1 is above; build metadata does not change precedence. Native Kitty signals retain their current precedence and results, even when other environment values coexist. The TMUX condition restricts only the new Ghostty route; it must not override the existing native Kitty behavior.

Update the selector/transmit comments to describe the expanded resolution policy accurately. Renaming the private selector is optional, not a reason to expand the diff. No image resampling optimization or encoder refactor is necessary.

Observable acceptance and tasks

1. Resolution decision and regressions

Extend the existing map-backed truth table in kitty_test.go and implement the new branch in kitty.go.

Cover exact threshold, later minor/major versions (including 1.10.0 to catch lexical comparisons), older versions, absent/empty/malformed/incomplete versions, prereleases and metadata, wrong/missing/capitalized terminal identity, and TMUX present with nonempty or empty values. Preserve existing Kitty window-ID/TERM behavior, including conflicting Ghostty variables and tmux. Keep capability detection tests intact; add direct Ghostty 1.4 and tmux cases if needed to explicitly prove version selection does not enable graphics where capability detection rejects it. Explicit force may enable graphics under tmux but must not enable the new full-resolution Ghostty branch.

Completion: map-backed focused tests pass without ambient terminal state; no detector behavior changes.

2. Prove the production entry point selects the correct PNG

Add a small nonparallel, environment-controlled test of exported TransmitMascot, not just transmitMascot(..., true). Set/clear all variables read by the resolution selector using test-owned environment values (including native Kitty signals), then reassemble and decode the real APC payload using existing helpers.

  • Direct Ghostty 1.4.0 produces the embedded source dimensions (currently 1254×1254) with source alpha intact.
  • An older/invalid Ghostty version and Ghostty with TMUX present produce cols × (rows*2) pixels.
  • Controls retain the requested c/r footprint, existing image ID, PNG format and virtual placement; full-resolution payloads remain correctly chunked/reassembled.

Reuse existing native-alpha, payload-bound, placement, and PNG helpers/tests rather than duplicating a protocol test suite. Keep their downscaled assertions scoped to the compatibility path.

Completion: a wiring regression that hardcodes the exported entry point back to downscaled output fails the new positive test; a regression always selecting full resolution fails negative cases.

3. Integration and visual verification

Run the focused welcome package tests, then the direct UI boundary: go test ./cmd/mecatui/ui/welcome and go test ./cmd/mecatui/ui.

For the integrated change set run task test once (1800-second outer timeout). Before PR-ready handoff run task lint (600 seconds), task test:race (1800 seconds), and go run ./cmd/mecademo (600 seconds); verify the demo's tool call, permission ask/approval, and result. Build through task build (600 seconds), never bare root go build.

Manually run the built mecatui in a real direct Ghostty 1.4+ session and confirm the splash is sharp, correctly sized, transparent, and remains correctly placed across a size-tier change. Check tmux retains its existing default fallback. Environment spoofing alone cannot establish visual correctness; if no actual terminal is available, record this check as outstanding rather than claiming completion.

No user-docs update is expected: this restores rendering quality without a new setting or workflow. No tracked Markdown, generated references, architecture, or domain model changes are expected. If Markdown changes become necessary, run task docs (600 seconds).

Compatibility and delivery

API compatibility: local terminal presentation only; no server, engine, wire messages, feature negotiation, Go exported signatures, or persisted formats change. No wire major/feature identifier changes or upgrades are required. Existing Kitty behavior is preserved; only the explicit new Ghostty route changes source image resolution.

Run implementation panel-review against the branch's recorded start commit (capture it when implementation begins, do not use a moving base). Review subsequent fixes incrementally against the last reviewed candidate. Do not rebase without a separate request.

Planning creates no branch, implementation, commit, or PR. If an implementation PR is later requested, preserve a publication-safe full copy of the latest plan in one identifiable PR conversation comment, verify readback, and record its URL only in ignored metadata. Humans merge.

Risks and open decisions

  • A full-resolution payload is substantially larger; this deliberately reuses the existing Kitty chunked path rather than adding caching or a new transport.
  • Environment variables are a conservative heuristic, not proof of terminal capability. The issue explicitly excludes runtime probing and additional Mosh handling.
  • The operator confirmed the narrow issue scope and authorized implementation and PR creation. Strict parsing follows the issue's SemVer requirement; no tolerant version normalization is included.
  • Independent fresh-context design review found no correctness or requirements gaps (reviewed an inline copy because ignored scratch files are unavailable in the child checkout). Runtime checks are implementation work; live visual verification remains explicitly separate.

@jbeda
jbeda merged commit 8d9e6ea into main Oct 29, 2026
44 checks passed
@jbeda
jbeda deleted the impl/2586-ghostty-sharp-splash branch October 29, 2026 01:01
@toolhive-release-app toolhive-release-app Bot mentioned this pull request Nov 18, 2026
2 tasks
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.

tui: render a sharp splash in direct Ghostty 1.4+

1 participant