Skip to content

docs/2026 05 18 korean input followup#14

Merged
dancinlife merged 3 commits into
mainfrom
docs/2026-05-18-korean-input-followup
May 18, 2026
Merged

docs/2026 05 18 korean input followup#14
dancinlife merged 3 commits into
mainfrom
docs/2026-05-18-korean-input-followup

Conversation

@dancinlife

Copy link
Copy Markdown
Contributor
  • docs(sessions): 2026-05-18 Korean-input continuation — Decision 2 (chr→from_char_code)
  • fix(harness-cli): modifyOtherKeys leak on exit — explicit Pn=0 + flush
  • fix(harness-cli) + tape(forbidden): remove modifyOtherKeys push entirely — AGENTS.tape @f f8

dancinlife and others added 3 commits May 18, 2026 18:19
…r→from_char_code)

Append follow-up to the 2026-05-18 session log:
- Decision 1 (modifyOtherKeys Lv2→Lv1 + hexa-lang ceiling widening) shipped earlier on
  this branch (commits 0cfe555 + hexa-lang bf943479); confirmed insufficient — Ghostty
  user reported Korean still broken.
- tmux raw UTF-8 reproduce showed bug: 안→H, 녕→U (low-byte truncation).
- Root: `chr(cp)` lowers to `hexa_chr_byte` (1 byte, `cp & 0xFF`) per RFC chr-byte-vs-
  codepoint-asymmetry (2026-05-17). Codepoint→UTF-8 belongs to `from_char_code`.
- Decision 2: option-B-canonical-upstream — swap `chr(cp)` for `from_char_code(cp)` in
  the two decoder paths upstream in hexa-lang (compile-tree only; interpreter polled
  out of scope per user direction).
- hexa-lang fix landed on `fix/input-decoder-chr-vs-from_char_code` branch
  (commit ac72668c, off origin/main). Wilson `~/core/hexa-lang` working tree mirrors
  the fix so local rebuilds keep working.
- Verified end-to-end via tmux + Ghostty: `❯ 안녕 하세요 🌌` renders correctly.
- wilson test 23/23 PASS.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Symptom (user-reported on Ghostty, 2026-05-18):
After typing `/exit` in wilson and getting `bye.`, back in zsh the user
typed Shift+Enter and the screen showed `;2;13~;2;13~;2;13~;2;13~`.
That's the body of `ESC[27;2;13~` (xterm modifyOtherKeys Shift+Enter
encoding) leaking through — wilson failed to disable modifyOtherKeys
before exit, so Ghostty kept reformatting every modified keypress and
zsh ate only the CSI prefix.

Two root causes in `harness_cli_term_modes_off`:

1. Wilson sent `ESC[>4m` (parameterless) — per xterm spec this is
   "reset to default", but Ghostty (and likely other terminals)
   interpret a missing Pn as "no change" and modifyOtherKeys stays on.
   Switched to `ESC[>4;0m` (explicit DISABLE) — unambiguous "off"
   everywhere.

2. After `term_modes_off`, wilson printed `bye.` and returned without
   any flush guarantee. `eprintln + process exit` can race the terminal
   on macOS — the disable bytes can still sit in stdio when wilson dies.
   Added `render_flush()` at the end of `term_modes_off` so the pop
   sequences definitely leave wilson before any exit path returns.

verify: wilson test 23/23 PASS. (Interactive verification: launch
wilson in Ghostty → `/exit` → back at zsh → Shift+Enter should now
behave normally, no `;2;13~` leak.)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ely — AGENTS.tape @f f8

After the chr→from_char_code root-cause fix (Decision 2), revisited the question
"do we even need modifyOtherKeys?". Answer: no — Shift+Enter has two cleaner
cover paths that don't require terminal mode state:
  (1) ESC+CR — claude-code's terminalSetup convention. iTerm2 / VS Code /
      Cursor / Windsurf install shift+enter → `\x1b\r` out of the box;
      Ghostty needs one config line `keybind=shift+enter=text:\x1b\r`.
      Decoded in self/tui/input.hexa::_decode_one (ESC + 13/10 branch).
  (3) `\` + Enter — portable in-buffer fallback. Works on every terminal
      with zero config; already implemented at harness-cli main.hexa:602-608.

Cost of removal: zero functionality (above paths cover Shift+Enter).
Benefit: eliminates an entire class of bugs that ate 2026-05-18 debugging —
  - Lv2 reformatted non-ASCII printables (Hangul/CJK dropped at ASCII ceiling)
  - chr-byte-truncation in codepoint→UTF-8 emit (안→H, 녕→U)
  - on-exit pop-with-Pn-omitted stuck-mode leak (`;2;13~` leaking into zsh)
All three trace back to "we push ESC[>4;Nm at TUI entry". Don't push, no class.

Changes:
- plugins/harness-cli/main.hexa::harness_cli_term_modes_on — push line
  commented out with full history block explaining why + how Shift+Enter
  still works.
- plugins/harness-cli/main.hexa::harness_cli_term_modes_off — defensive
  pop (`ESC[>4;0m`) RETAINED as 1-shot cleanup for sessions inheriting a
  stuck mode from a pre-2026-05-18 wilson build. Idempotent; no negative
  effect when no push has happened.
- AGENTS.tape @f f8 xterm-modifyOtherKeys-push — governance forbidden
  pattern, deny:write. Exception clause preserves the modifyOtherKeys
  *decoder* in hexa-lang (harmless when no one pushes; useful if a
  future feature opts back in deliberately with proper hygiene).
- docs/sessions/2026-05-18-korean-input-modifyotherkeys-fix.md — Decision
  3 appended (option-A-remove-modifyotherkeys-surface, 4 rationale
  bullets + execution log + day-summary of all three decisions).

verify: wilson build OK · wilson test 23/23 PASS · interactive verification
pending (user-side: launch wilson in Ghostty → /exit → Shift+Enter in zsh
should now behave normally, no `;2;13~` leak even on first launch of new
wilson).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dancinlife dancinlife merged commit 632b6ac into main May 18, 2026
@dancinlife dancinlife deleted the docs/2026-05-18-korean-input-followup branch May 18, 2026 10:30
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.

1 participant