Skip to content

fix(desktop): repair mojibake project labels - #53373

Open
LeonSGP43 wants to merge 1 commit into
NousResearch:mainfrom
LeonSGP43:hermes/fix-53367-desktop-projects-mojibake
Open

fix(desktop): repair mojibake project labels#53373
LeonSGP43 wants to merge 1 commit into
NousResearch:mainfrom
LeonSGP43:hermes/fix-53367-desktop-projects-mojibake

Conversation

@LeonSGP43

Copy link
Copy Markdown
Contributor

Summary

  • repair UTF-8/GBK mojibake in Desktop Projects auto/discovered labels without touching ids or paths
  • apply the same display-only repair to projects.discover_repos payloads and auto project tree labels
  • add regressions for the garbled 001鍥炴棫 case and for valid Chinese labels staying unchanged

Testing

  • uv run --frozen pytest tests/tui_gateway/test_project_tree.py tests/tui_gateway/test_projects_rpc.py
  • uv run --frozen ruff check tui_gateway/project_tree.py tui_gateway/server.py tests/tui_gateway/test_project_tree.py tests/tui_gateway/test_projects_rpc.py
  • git diff --check

Closes #53367

@alt-glitch alt-glitch added type/bug Something isn't working comp/tui Terminal UI (ui-tui/ + tui_gateway/) P3 Low — cosmetic, nice to have labels Jun 27, 2026

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary

Verdict: Approved

Clean fix for mojibake (garbled UTF-8/GBK) project labels in the desktop. The repair_display_label function correctly detects and fixes common UTF-8/GBK encoding issues. Good test coverage with dedicated test cases.

Looks Good

  • Well-tested with specific mojibake test cases
  • Correct encoding detection and repair logic
  • No security concerns
  • Small, focused change

Reviewed by Hermes Agent

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tracing the affected Desktop project-label paths. The reported input still flows unchanged on current main through tui_gateway/server.py:11013-11014,11027 and tui_gateway/project_tree.py:621-627, so the fix remains needed.

Problems

  • tui_gateway/project_tree.py:70 in d273efabf85e6acaf1df239c62226b803fb00811 accepts a reversible GBK/UTF-8 conversion as evidence of mojibake. Running the exact proposed routine repairs 001鍥炴棫 as intended, but converts the valid Chinese label to Cyrillic һ. The current 项目 regression does not cover this false-positive class.
  • The helper is applied to path-derived repository and lane labels at PR lines 133 and 136, and to discovered labels at tui_gateway/server.py:10321-10323, so normal user-visible labels can be changed incorrectly.

Suggested changes

  • Restrict repair to labels with a proven malformed-byte provenance instead of applying a generic reversible decode to arbitrary display text.
  • Add preservation regressions for and a valid Chinese repository/branch label alongside the reported mojibake case.

Automated hermes-sweeper review.

continue
except (UnicodeDecodeError, UnicodeEncodeError):
continue
return repaired

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking: a GBK→UTF-8 round trip is not proof that value is mojibake. The exact function changes valid Chinese into Cyrillic һ; please constrain this to a proven malformed-label source and add a regression for that false-positive case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tui Terminal UI (ui-tui/ + tui_gateway/) P3 Low — cosmetic, nice to have sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: garbled Chinese text in Desktop projects list

4 participants