infra/scripts/workstation
Viktor Barzin 0fa5852ec6
Some checks are pending
Build infra CLI / build (push) Waiting to run
ci/woodpecker/push/default Pipeline was successful
homelab v0.8.2: fix memory recall truncating multibyte UTF-8 mid-character
emo's Claude Code sessions hit "UserPromptSubmit hook error" on almost every
prompt. Root cause: the homelab-memory-recall.py UserPromptSubmit hook runs
`homelab memory recall <prompt>` and strict-decodes its stdout. printMemories
truncated each memory's preview with a BYTE slice (c[:240]), which cuts through
the middle of a 2-byte Cyrillic character and emits invalid UTF-8 (a dangling
0xd0 lead byte). The hook's subprocess.run(text=True) then raised
UnicodeDecodeError — not caught by its `except (TimeoutExpired, OSError)` — so
the hook exited non-zero and Claude surfaced the error. It is Cyrillic-specific
(ASCII has no multibyte chars to split), so it bit emo (Bulgarian prompts) every
turn while English users almost never saw it.

Two-layer fix:
- cli: truncatePreview() now counts RUNES, not bytes, so the preview never
  splits a character. Regression test asserts valid UTF-8 on a long Cyrillic
  string. Fixes the root for every consumer of `memory recall` / `memory list`.
- hook: subprocess.run gains errors="replace" and the except is broadened to
  honor the script's own "best-effort, exit 0" contract — so a truncated or
  otherwise odd payload can never again surface as a hook error.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-28 09:40:51 +00:00
..
claude-hooks homelab v0.8.2: fix memory recall truncating multibyte UTF-8 mid-character 2026-06-28 09:40:51 +00:00
claude-skills devvm: personalize emo's cluster-health skill for ha-sofia 2026-06-26 16:03:14 +00:00
playwright workstation: per-user playwright browser MCP for all users, reproducible from git 2026-06-16 20:33:47 +00:00
skel workstation: per-user long-lived Claude token to end concurrent-refresh logout 2026-06-28 08:07:43 +00:00
.gitignore fix: restore tree dropped by 6d224861; land stem95su gdrive-sync (10m) [ci skip] 2026-06-09 08:45:33 +00:00
claude-auth-sync.sh workstation: per-user long-lived Claude token to end concurrent-refresh logout 2026-06-28 08:07:43 +00:00
managed-settings.json fix(workstation): carry OS/sudo authz policy into managed-settings source + multi-tenancy doc 2026-06-26 08:25:33 +00:00
packages.txt workstation: switch devvm OOM backstop from systemd-oomd to earlyoom 2026-06-22 10:39:16 +00:00
roster.yaml workstation: per-user code_layout — workspace puts project repos under ~/code (ancamilea + tripit) 2026-06-10 18:05:31 +00:00
roster_engine.py workstation: per-user playwright browser MCP for all users, reproducible from git 2026-06-16 20:33:47 +00:00
setup-devvm.sh homelab vault: install bw system-wide + onboarding runbook 2026-06-27 08:16:52 +00:00
test_roster_engine.py workstation: per-user playwright browser MCP for all users, reproducible from git 2026-06-16 20:33:47 +00:00