Skip to content

fix(cli): CJK characters misaligned in /resume and sessions list tables #44199

@Weidows

Description

@Weidows

Bug Description

The /resume and hermes sessions list commands render session tables using Python str.format() fixed-width formatting ({var:<32}), which assumes every character occupies one terminal column. CJK characters (Chinese, Japanese, Korean) are double-width in modern terminals, causing severe misalignment.

Example Output (broken)

  #   Title                            Preview                                  Last Active   ID
  ─── ──────────────────────────────── ──────────────────────────────────────── ───────────── ────────────────────────
  2   整理论文和更新README #4                 我更新了paper/和 …   6d ago        20260604_195221_254cc9

Notice how the Preview, Last Active, and ID columns are shifted right because the Chinese characters in Title and Preview take 2 terminal columns each but Python counts them as 1.

Affected Code Paths

  1. cli.pyHermesCLI._show_recent_sessions() (the /resume inline list)
  2. hermes_cli/main.pycmd_sessions() list action (the hermes sessions list CLI command)

Both use the same print(f"{var:<N}") pattern that does not account for double-width characters.

Expected Behavior

  • Columns should be properly aligned regardless of CJK characters in titles/previews.
  • Using rich.table.Table (which the project already depends on) handles CJK display widths correctly.
  • Consider moving Last Active and ID to the left side so variable-length content (Title/Preview) on the right doesn't push them out of alignment.

Environment

  • Hermes version: main branch as of 2026-06-11
  • OS: Windows 10 (also affects any terminal with CJK text)
  • Terminal: any modern terminal emulator with Unicode support

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low — cosmetic, nice to havecomp/cliCLI entry point, hermes_cli/, setup wizardtype/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions