Skip to content

fix: prioritize system language over timezone for locale detection (#51), clean up session data on deletion (#47, #680)#797

Open
MrRealORG wants to merge 1 commit into
XiaomiMiMo:mainfrom
MrRealORG:fix/auto-0616-locale-priority-session-memleak
Open

fix: prioritize system language over timezone for locale detection (#51), clean up session data on deletion (#47, #680)#797
MrRealORG wants to merge 1 commit into
XiaomiMiMo:mainfrom
MrRealORG:fix/auto-0616-locale-priority-session-memleak

Conversation

@MrRealORG

Copy link
Copy Markdown

Summary

Two fixes in 2 files:

Fix #51 — Locale auto-detection shows wrong language

detectSystemLocale() checked timezone before system language. A user with English macOS but Asia/Shanghai timezone always got Chinese.

Fix: Reorder priority:

  1. Intl.DateTimeFormat().locale (actual OS language setting)
  2. Environment variables (LC_ALL, LC_MESSAGES, LANG, LANGUAGE)
  3. Timezone (geographic hint, last resort)

Fix #47 / #680 — Session deletion memory leak in TUI

When a session was deleted, only the session entry was removed from the array. All associated per-session store data (messages, parts, todos, tasks, actors, permissions, questions, diffs, status, cwd, goal) remained in the SolidJS store forever.

Fix: Clear all 10 session-scoped stores on session.deleted, and remove parts belonging to the deleted session's messages. Follows the same pattern as dropSessionCaches() in packages/app/src/context/global-sync/session-cache.ts.

Test Plan

  • Set macOS to English, timezone to Asia/Shanghai → should show English (was Chinese)
  • Set macOS to Japanese, timezone to Asia/Shanghai → should show Japanese (was Chinese)
  • Delete a session in TUI → verify memory usage drops (previously grew unbounded)

…iaomiMiMo#51), clean up session data on deletion (XiaomiMiMo#47, XiaomiMiMo#680)

- Locale detection: Intl.DateTimeFormat().locale (actual system
  language) is now checked first, before timezone. Previously,
  timezone was checked first, causing users with English macOS but
  Asia/Shanghai timezone to always get Chinese.

- Session deletion: when a session is deleted, all associated
  per-session stores (message, todo, task, actor, permission,
  question, session_cwd, session_diff, session_goal, session_status)
  are now cleared. Parts belonging to the deleted session's messages
  are also removed. Previously, this data remained in the SolidJS
  store forever, causing unbounded memory growth in long-running
  TUI sessions.
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