Beautiful, AI-native markdown IDE and LLM wiki
TypeScript 2nd-brainagent-skillsclaudecodexcompany-braindocsknowledge-knowledge-baseknowledge-managementllmllm-wikillm-wiki-karpathymarkdownmarkdown-editormdmdxnotespkmsecond-brainskills
Record evidence for unexplained desktop exits (PRD-9299, PRD-9311) (#6195)
Andrew Mikofalvy15f2e605ecd3
diff --git a/.changeset/prd-9299-prd-9311-unexplained-exit-evidence.md b/.changeset/prd-9299-prd-9311-unexplained-exit-evidence.mdnew file mode 100644index 000000000..70d2c2e3b--- /dev/null+++ b/.changeset/prd-9299-prd-9311-unexplained-exit-evidence.md@@ -0,0 +1,6 @@+---+"@inkeep/open-knowledge": patch+"@inkeep/open-knowledge-desktop": patch+---++Bug reports now show when Linux's display server disconnected the desktop app, and when a window stopped responding before the app closed.diff --git a/docs/content/reference/what-open-knowledge-writes.mdx b/docs/content/reference/what-open-knowledge-writes.mdxindex 5c0915327..b5cc3e819 100644--- a/docs/content/reference/what-open-knowledge-writes.mdx+++ b/docs/content/reference/what-open-knowledge-writes.mdx@@ -59,7 +59,7 @@ On every platform the app writes app-level state and logs on launch. The table b| `~/Library/Caches/@inkeepopen-knowledge-desktop-updater/` | Staged auto-update downloads (electron-updater) | Outside-project (home dir) || `~/Library/Caches/com.inkeep.open-knowledge.ShipIt/` | Install log of the macOS update helper (Squirrel's ShipIt), which swaps the app bundle after the app has quit. The only record of why an update failed to install, so a bug report you send collects it — only this app's, never those of other applications that use the same update mechanism | Outside-project (home dir) || `~/Library/Logs/DiagnosticReports/` | Not written by OpenKnowledge at all — this is macOS's own crash-report directory, shared by every application on the machine. When the OS ends one of this app's processes it records why there, which is sometimes the only account of a session that stopped without a crash dump, so a bug report you send at the **Detailed diagnostics** level collects the reports macOS wrote for this app and its helper processes — only ours, never those of any other application, and never at the standard level. A report of ours still names the processes it was running alongside. A report also carries machine details macOS puts in every one of them — the account uid, the Mac model, and the name of the process that launched the app, which on a managed machine can be internal tooling — while the identifiers that would link your bundles to each other are replaced before bundling. `ok diagnose bundle` collects them too, on every run: that command produces the Detailed superset by design, and its summary tells you what the search found before it writes the zip | Outside-project (home dir) |-| `/Library/Logs/DiagnosticReports/JetsamEvent-*.ips`; on Linux, the system journal; on Windows, the System and Application event logs | Not written by OpenKnowledge at all. These are the operating system's own records, shared by every application on the machine, of the times it ended a process from outside: macOS's low-memory kills (jetsam), the Linux kernel's out-of-memory killer and `systemd-oomd`, and on Windows the crash and hang records of applications plus the system's records of shutdowns, restarts, power losses, and low-memory warnings. A process ended that way runs none of its own code, so this is often the only account of a session that stopped with no crash dump. A bug report you send at the **Detailed diagnostics** level reads the past week of these records, and `ok diagnose bundle` reads them on every run. From macOS and Linux it keeps only the records that name this app's processes. On macOS it keeps, for each of this app's processes in a report, the process id, its memory use and peak, and whether macOS ended it. On Linux it keeps the time, the action, the process name and id, and the unit name, and drops the machine name, the cgroup paths, and the account uid the journal line carries. From the Windows Application log it keeps only this app's crash and hang records, with any value that looks like a file path removed. From the Windows System log it keeps the time and kind of every shutdown, restart, power loss, and low-memory warning on the machine, planned or not and whichever application they concerned, with no other detail. The result is `state/os-termination-evidence.json` in the zip, which a project's zip lists in `manifest.json`. A system-wide zip's README names it whenever records were kept | Machine-wide (OS logs) |+| `/Library/Logs/DiagnosticReports/JetsamEvent-*.ips`; on Linux, the system journal and your own user journal; on Windows, the System and Application event logs | Written by the operating system, not by OpenKnowledge, with the one Linux exception described below. These are the operating system's own records, shared by every application on the machine, of the times it ended a process from outside: macOS's low-memory kills (jetsam), the Linux kernel's out-of-memory killer and `systemd-oomd`, and on Windows the crash and hang records of applications plus the system's records of shutdowns, restarts, power losses, and low-memory warnings. A process ended that way runs none of its own code, so this is often the only account of a session that stopped with no crash dump. A bug report you send at the **Detailed diagnostics** level reads the past week of these records, and `ok diagnose bundle` reads them on every run. From macOS and Linux it keeps only the records that name this app's processes. On macOS it keeps, for each of this app's processes in a report, the process id, its memory use and peak, and whether macOS ended it. On Linux it keeps the time, the action, the process name and id, and the unit name, and drops the machine name, the cgroup paths, and the account uid the journal line carries. The user journal is the one exception that OpenKnowledge itself writes to: when the Linux display server drops the app, its desktop process prints a display-connection error just before it exits, and your user journal records it. From your user journal it keeps only those errors from this app's own desktop process, matched against the process ids in its desktop logs, with the time, the process id, and the message cut to 200 characters. From the Windows Application log it keeps only this app's crash and hang records, with any value that looks like a file path removed. From the Windows System log it keeps the time and kind of every shutdown, restart, power loss, and low-memory warning on the machine, planned or not and whichever application they concerned, with no other detail. The result is `state/os-termination-evidence.json` in the zip, which a project's zip lists in `manifest.json`. A system-wide zip's README names it whenever records were kept | Machine-wide (OS logs) || `~/Library/Application Support/OpenKnowledge/Crashpad/` | Native crash minidumps, written by the OS crash handler (Electron's Crashpad) if the app ever crashes. Local-only: the crash reporter runs with `uploadToServer: false`, so no dump is ever uploaded automatically | Outside-project (home dir) || `~/Library/Application Support/OpenKnowledge/bug-report-dirty-shutdown.json` | Dirty-shutdown sentinel — written on **every** launch, refreshed as it runs, and removed on a clean quit. The next launch reads it to tell an app crash (prompts you) from the endings that are not a crash: a reboot, an OS shutdown, or dying asleep (all suppressed and logged instead), an update install shutting the app down to replace its files (logged either way, and suppressed in almost every case: a shutdown the app had no chance to record, or one it cannot date because the previous session left no heartbeat, can still prompt so you are able to report it), and a death the app can date to more than a week ago, which is too stale to report usefully — the diagnostics a report would gather describe the day you sent it rather than the day it happened. A fresh crash dump still overrides those, the same as it does for a reboot, a suspend or an OS shutdown — except in the first 30 seconds after the app committed to quitting for an update install, where a dump is part of that same shutdown rather than a crash you could act on. A session that left neither a heartbeat nor a crash dump cannot be dated, so it is never treated as stale | Outside-project (home dir) || `~/Library/Application Support/OpenKnowledge/bug-report-crash-acks.json` | Records which crash-report invitations you already answered or dismissed, so the same crash never re-prompts. Answering is what retires a crash: an invitation you simply never saw — because it went unanswered for a day, or the window it was waiting on never appeared — is dropped rather than answered, so that crash can be offered again the next time you open the app | Outside-project (home dir) |diff --git a/packages/app/src/components/ReportBugDialogBody.tsx b/packages/app/src/components/ReportBugDialogBody.tsxindex a55a503aa..756cc0b0a 100644--- a/packages/app/src/components/ReportBugDialogBody.tsx+++ b/packages/app/src/components/ReportBugDialogBody.tsx@@ -554,6 +554,12 @@ function ReportBugDialog({journal recorded in the past week, without the machine name, accountid, or folder paths.</Trans>+ )}{' '}+ {desktopPlatform === 'linux' && (+ <Trans>+ It also adds any display-connection errors OpenKnowledge wrote to your+ user journal in the past week, each message cut to 200 characters.+ </Trans>)}{desktopPlatform === 'win32' && (<Trans>diff --git a/packages/app/src/locales/ar/messages.json b/packages/app/src/locales/ar/messages.jsonindex 43c1608f6..ca6c76149 100644--- a/packages/app/src/locales/ar/messages.json+++ b/packages/app/src/locales/ar/messages.json@@ -5317,6 +5317,9 @@"lond3p": ["يظهر فوق متن الكود. يُحفظ ويُستعاد كـ `title=\"...\"` في Markdown."],"lrhetp": ["+ ", ["overflow"], " إضافية"],"lwCV5v": ["تعذّر فتح ", ["0"], " للتحرير: ", ["1"]],+ "lwvkBP": [+ "كما يضيف أي أخطاء في الاتصال بالشاشة كتبها OpenKnowledge في سجل المستخدم الخاص بك خلال الأسبوع الماضي، مع اقتطاع كل رسالة إلى 200 حرف."+ ],"lyWa43": ["صفحات منفصلة على مستوى المشروع"],"lzmtKp": ["فشل تحميل خصائص المجلد: ", ["message"]],"lzsa2d": ["نسخ الخطأ"],diff --git a/packages/app/src/locales/ar/messages.po b/packages/app/src/locales/ar/messages.poindex 1e17912d8..6d09149e9 100644--- a/packages/app/src/locales/ar/messages.po+++ b/packages/app/src/locales/ar/messages.po@@ -8133,6 +8133,10 @@ msgstr "رابط المشاركة غير صالح."msgid "Invalid YAML"msgstr "YAML غير صالح"+#: src/components/ReportBugDialogBody.tsx+msgid "It also adds any display-connection errors OpenKnowledge wrote to your user journal in the past week, each message cut to 200 characters."+msgstr "كما يضيف أي أخطاء في الاتصال بالشاشة كتبها OpenKnowledge في سجل المستخدم الخاص بك خلال الأسبوع الماضي، مع اقتطاع كل رسالة إلى 200 حرف."+#: src/components/ReportBugDialogBody.tsxmsgid "It also adds the crash and hang records Windows logged for OpenKnowledge in the past week, without file paths, and the times of every shutdown, restart, power loss, and low-memory warning on this computer in that week, whatever caused them."msgstr "كما يضيف سجلات التعطّل وعدم الاستجابة التي سجّلها Windows لـ OpenKnowledge خلال الأسبوع الماضي، دون مسارات الملفات، وأوقات كل إيقاف تشغيل وإعادة تشغيل وانقطاع للطاقة وتحذير من نقص الذاكرة على هذا الكمبيوتر خلال ذلك الأسبوع، أيًّا كان سببها."diff --git a/packages/app/src/locales/bn/messages.json b/packages/app/src/locales/bn/messages.jsonindex bdd6c917a..305d8f488 100644--- a/packages/app/src/locales/bn/messages.json+++ b/packages/app/src/locales/bn/messages.json@@ -4498,6 +4498,9 @@"lond3p": ["কোডের মূল অংশের উপরে দেখা যায়। markdown-এ `title=\"...\"` হিসেবে ফিরে আসে।"],"lrhetp": ["+ আরও ", ["overflow"]],"lwCV5v": [["0"], " সম্পাদনার জন্য খোলা যায়নি: ", ["1"]],+ "lwvkBP": [+ "এটি গত সপ্তাহে OpenKnowledge আপনার ব্যবহারকারী জার্নালে ডিসপ্লের সঙ্গে সংযোগের যে ত্রুটিগুলো লিখেছে সেগুলোও যোগ করে, প্রতিটি বার্তা 200 অক্ষরে ছেঁটে।"+ ],"lyWa43": ["প্রকল্প-স্তরের বিচ্ছিন্ন পাতা"],"lzmtKp": ["ফোল্ডার প্রপার্টি লোড করতে ব্যর্থ: ", ["message"]],"lzsa2d": ["ত্রুটি কপি করুন"],diff --git a/packages/app/src/locales/bn/messages.po b/packages/app/src/locales/bn/messages.poindex cb77c1f9e..c188a402f 100644--- a/packages/app/src/locales/bn/messages.po+++ b/packages/app/src/locales/bn/messages.po@@ -8129,6 +8129,10 @@ msgstr "শেয়ার URL সঠিক নয়।"msgid "Invalid YAML"msgstr "অবৈধ YAML"+#: src/components/ReportBugDialogBody.tsx+msgid "It also adds any display-connection errors OpenKnowledge wrote to your user journal in the past week, each message cut to 200 characters."+msgstr "এটি গত সপ্তাহে OpenKnowledge আপনার ব্যবহারকারী জার্নালে ডিসপ্লের সঙ্গে সংযোগের যে ত্রুটিগুলো লিখেছে সেগুলোও যোগ করে, প্রতিটি বার্তা 200 অক্ষরে ছেঁটে।"+#: src/components/ReportBugDialogBody.tsxmsgid "It also adds the crash and hang records Windows logged for OpenKnowledge in the past week, without file paths, and the times of every shutdown, restart, power loss, and low-memory warning on this computer in that week, whatever caused them."msgstr "এটি গত সপ্তাহে Windows OpenKnowledge-এর জন্য যে ক্র্যাশ ও আটকে যাওয়ার রেকর্ড লগ করেছে তা ফাইলের পাথ ছাড়া যোগ করে, এবং সেই সপ্তাহে এই কম্পিউটারে প্রতিটি শাটডাউন, রিস্টার্ট, বিদ্যুৎ বিভ্রাট ও কম মেমরির সতর্কতার সময়ও যোগ করে, কারণ যা-ই হোক।"diff --git a/packages/app/src/locales/en/messages.json b/packages/app/src/locales/en/messages.jsonindex effc19a2a..a674efaf5 100644--- a/packages/app/src/locales/en/messages.json+++ b/packages/app/src/locales/en/messages.json@@ -4652,6 +4652,9 @@"lond3p": ["Shows above the code body. Round-trips as `title=\"...\"` in markdown."],"lrhetp": ["+ ", ["overflow"], " more"],"lwCV5v": ["Couldn't open ", ["0"], " for editing: ", ["1"]],+ "lwvkBP": [+ "It also adds any display-connection errors OpenKnowledge wrote to your user journal in the past week, each message cut to 200 characters."+ ],"lyWa43": ["Project-level disconnected pages"],"lzmtKp": ["Failed to load folder properties: ", ["message"]],"lzsa2d": ["Copy error"],diff --git a/packages/app/src/locales/en/messages.po b/packages/app/src/locales/en/messages.poindex 1c2a14a3c..fb0de971e 100644--- a/packages/app/src/locales/en/messages.po+++ b/packages/app/src/locales/en/messages.po@@ -8133,6 +8133,10 @@ msgstr "Invalid share URL."msgid "Invalid YAML"msgstr "Invalid YAML"+#: src/components/ReportBugDialogBody.tsx+msgid "It also adds any display-connection errors OpenKnowledge wrote to your user journal in the past week, each message cut to 200 characters."+msgstr "It also adds any display-connection errors OpenKnowledge wrote to your user journal in the past week, each message cut to 200 characters."+#: src/components/ReportBugDialogBody.tsxmsgid "It also adds the crash and hang records Windows logged for OpenKnowledge in the past week, without file paths, and the times of every shutdown, restart, power loss, and low-memory warning on this computer in that week, whatever caused them."msgstr "It also adds the crash and hang records Windows logged for OpenKnowledge in the past week, without file paths, and the times of every shutdown, restart, power loss, and low-memory warning on this computer in that week, whatever caused them."diff --git a/packages/app/src/locales/es/messages.json b/packages/app/src/locales/es/messages.jsonindex 23cf90f66..18a90bb1f 100644--- a/packages/app/src/locales/es/messages.json+++ b/packages/app/src/locales/es/messages.json@@ -5365,6 +5365,9 @@],"lrhetp": ["+ ", ["overflow"], " más"],"lwCV5v": ["No se pudo abrir ", ["0"], " para editarlo: ", ["1"]],+ "lwvkBP": [+ "También añade los errores de conexión con la pantalla que OpenKnowledge escribió en tu registro de usuario durante la última semana, con cada mensaje recortado a 200 caracteres."+ ],"lyWa43": ["Páginas desconectadas de todo el proyecto"],"lzmtKp": ["No se pudieron cargar las propiedades de la carpeta: ", ["message"]],"lzsa2d": ["Copiar el error"],diff --git a/packages/app/src/locales/es/messages.po b/packages/app/src/locales/es/messages.poindex 27d26f969..982c4dcd1 100644--- a/packages/app/src/locales/es/messages.po+++ b/packages/app/src/locales/es/messages.po@@ -8133,6 +8133,10 @@ msgstr "URL para compartir no válida."msgid "Invalid YAML"msgstr "YAML no válido"+#: src/components/ReportBugDialogBody.tsx+msgid "It also adds any display-connection errors OpenKnowledge wrote to your user journal in the past week, each message cut to 200 characters."+msgstr "También añade los errores de conexión con la pantalla que OpenKnowledge escribió en tu registro de usuario durante la última semana, con cada mensaje recortado a 200 caracteres."+#: src/components/ReportBugDialogBody.tsxmsgid "It also adds the crash and hang records Windows logged for OpenKnowledge in the past week, without file paths, and the times of every shutdown, restart, power loss, and low-memory warning on this computer in that week, whatever caused them."msgstr "También añade los registros de fallos y bloqueos que Windows anotó para OpenKnowledge durante la última semana, sin rutas de archivo, y las horas de cada apagado, reinicio, corte de energía y aviso de memoria baja de este equipo en esa semana, fuera cual fuera su causa."diff --git a/packages/app/src/locales/fr/messages.json b/packages/app/src/locales/fr/messages.jsonindex 3d4f00293..442c559ba 100644--- a/packages/app/src/locales/fr/messages.json+++ b/packages/app/src/locales/fr/messages.json@@ -5412,6 +5412,9 @@],"lrhetp": ["+ ", ["overflow"], " de plus"],"lwCV5v": ["Impossible d'ouvrir ", ["0"], " pour modification : ", ["1"]],+ "lwvkBP": [+ "Il ajoute aussi les erreurs de connexion à l'affichage qu'OpenKnowledge a écrites dans votre journal utilisateur la semaine dernière, chaque message étant tronqué à 200 caractères."+ ],"lyWa43": ["Pages isolées au niveau du projet"],"lzmtKp": ["Échec du chargement des propriétés du dossier : ", ["message"]],"lzsa2d": ["Copier l'erreur"],diff --git a/packages/app/src/locales/fr/messages.po b/packages/app/src/locales/fr/messages.poindex 935f0eaf7..a225844b6 100644--- a/packages/app/src/locales/fr/messages.po+++ b/packages/app/src/locales/fr/messages.po@@ -8133,6 +8133,10 @@ msgstr "URL de partage non valide."msgid "Invalid YAML"msgstr "YAML non valide"+#: src/components/ReportBugDialogBody.tsx+msgid "It also adds any display-connection errors OpenKnowledge wrote to your user journal in the past week, each message cut to 200 characters."+msgstr "Il ajoute aussi les erreurs de connexion à l'affichage qu'OpenKnowledge a écrites dans votre journal utilisateur la semaine dernière, chaque message étant tronqué à 200 caractères."+#: src/components/ReportBugDialogBody.tsxmsgid "It also adds the crash and hang records Windows logged for OpenKnowledge in the past week, without file paths, and the times of every shutdown, restart, power loss, and low-memory warning on this computer in that week, whatever caused them."msgstr "Il ajoute aussi les plantages et blocages qu'a consignés Windows pour OpenKnowledge la semaine dernière, sans chemins de fichiers, ainsi que les heures de chaque arrêt, redémarrage, coupure de courant et alerte de mémoire insuffisante de cet ordinateur pendant cette semaine, quelle qu'en soit la cause."diff --git a/packages/app/src/locales/hi/messages.json b/packages/app/src/locales/hi/messages.jsonindex dd763d58f..8fd25a45f 100644--- a/packages/app/src/locales/hi/messages.json+++ b/packages/app/src/locales/hi/messages.json@@ -4494,6 +4494,9 @@"lond3p": ["कोड के मुख्य भाग के ऊपर दिखता है। markdown में `title=\"...\"` के रूप में वापस आता है।"],"lrhetp": ["+ ", ["overflow"], " और"],"lwCV5v": [["0"], " संपादन के लिए नहीं खोली जा सकी: ", ["1"]],+ "lwvkBP": [+ "यह पिछले सप्ताह OpenKnowledge द्वारा आपके उपयोगकर्ता जर्नल में लिखी गई डिस्प्ले कनेक्शन की त्रुटियाँ भी जोड़ता है, हर संदेश को 200 वर्णों तक छोटा करके।"+ ],"lyWa43": ["प्रोजेक्ट-स्तर के असंबद्ध पेज"],"lzmtKp": ["फ़ोल्डर प्रॉपर्टी लोड करने में विफल: ", ["message"]],"lzsa2d": ["त्रुटि कॉपी करें"],diff --git a/packages/app/src/locales/hi/messages.po b/packages/app/src/locales/hi/messages.poindex b46618c96..786400f48 100644--- a/packages/app/src/locales/hi/messages.po+++ b/packages/app/src/locales/hi/messages.po@@ -8129,6 +8129,10 @@ msgstr "साझा करने का URL अमान्य है।"msgid "Invalid YAML"msgstr "अमान्य YAML"+#: src/components/ReportBugDialogBody.tsx+msgid "It also adds any display-connection errors OpenKnowledge wrote to your user journal in the past week, each message cut to 200 characters."+msgstr "यह पिछले सप्ताह OpenKnowledge द्वारा आपके उपयोगकर्ता जर्नल में लिखी गई डिस्प्ले कनेक्शन की त्रुटियाँ भी जोड़ता है, हर संदेश को 200 वर्णों तक छोटा करके।"+#: src/components/ReportBugDialogBody.tsxmsgid "It also adds the crash and hang records Windows logged for OpenKnowledge in the past week, without file paths, and the times of every shutdown, restart, power loss, and low-memory warning on this computer in that week, whatever caused them."msgstr "यह पिछले सप्ताह Windows द्वारा OpenKnowledge के लिए दर्ज क्रैश और अटकने के रिकॉर्ड, फ़ाइल पाथ के बिना, और उस सप्ताह इस कंप्यूटर पर हर शटडाउन, रीस्टार्ट, बिजली जाने और कम मेमोरी चेतावनी का समय भी जोड़ता है, कारण चाहे जो हो।"diff --git a/packages/app/src/locales/id/messages.json b/packages/app/src/locales/id/messages.jsonindex 526d71816..03872952a 100644--- a/packages/app/src/locales/id/messages.json+++ b/packages/app/src/locales/id/messages.json@@ -4656,6 +4656,9 @@"lond3p": ["Muncul di atas badan kode. Bolak-balik sebagai `title=\"...\"` di markdown."],"lrhetp": ["+ ", ["overflow"], " lagi"],"lwCV5v": [["0"], " tidak bisa dibuka untuk disunting: ", ["1"]],+ "lwvkBP": [+ "Ini juga menambahkan galat koneksi layar yang ditulis OpenKnowledge ke jurnal pengguna Anda dalam seminggu terakhir, dengan setiap pesan dipotong menjadi 200 karakter."+ ],"lyWa43": ["Halaman terputus di tingkat proyek"],"lzmtKp": ["Gagal memuat properti folder: ", ["message"]],"lzsa2d": ["Salin galat"],diff --git a/packages/app/src/locales/id/messages.po b/packages/app/src/locales/id/messages.poindex 83a01f8ba..479dec029 100644--- a/packages/app/src/locales/id/messages.po+++ b/packages/app/src/locales/id/messages.po@@ -8129,6 +8129,10 @@ msgstr "URL berbagi tidak valid."msgid "Invalid YAML"msgstr "YAML tidak valid"+#: src/components/ReportBugDialogBody.tsx+msgid "It also adds any display-connection errors OpenKnowledge wrote to your user journal in the past week, each message cut to 200 characters."+msgstr "Ini juga menambahkan galat koneksi layar yang ditulis OpenKnowledge ke jurnal pengguna Anda dalam seminggu terakhir, dengan setiap pesan dipotong menjadi 200 karakter."+#: src/components/ReportBugDialogBody.tsxmsgid "It also adds the crash and hang records Windows logged for OpenKnowledge in the past week, without file paths, and the times of every shutdown, restart, power loss, and low-memory warning on this computer in that week, whatever caused them."msgstr "Ini juga menambahkan catatan crash dan macet yang dicatat Windows untuk OpenKnowledge dalam seminggu terakhir, tanpa jalur file, serta waktu setiap pematian, mulai ulang, listrik padam, dan peringatan memori rendah di komputer ini selama minggu itu, apa pun penyebabnya."diff --git a/packages/app/src/locales/ko/messages.json b/packages/app/src/locales/ko/messages.jsonindex 890e45119..1fe4ce307 100644--- a/packages/app/src/locales/ko/messages.json+++ b/packages/app/src/locales/ko/messages.json@@ -4457,6 +4457,9 @@"lond3p": ["코드 본문 위에 표시됩니다. Markdown에서 `title=\"...\"` 형식으로 왕복 변환됩니다."],"lrhetp": ["+ ", ["overflow"], "개 더"],"lwCV5v": [["0"], " 편집용 열기 실패: ", ["1"]],+ "lwvkBP": [+ "또한 지난 한 주 동안 OpenKnowledge가 사용자 저널에 기록한 디스플레이 연결 오류를 각 메시지를 200자로 줄여 추가합니다."+ ],"lyWa43": ["프로젝트 수준 연결 끊긴 페이지"],"lzmtKp": ["폴더 속성을 불러오지 못했습니다: ", ["message"]],"lzsa2d": ["오류 복사"],diff --git a/packages/app/src/locales/ko/messages.po b/packages/app/src/locales/ko/messages.poindex 5a0510722..3988cb300 100644--- a/packages/app/src/locales/ko/messages.po+++ b/packages/app/src/locales/ko/messages.po@@ -8133,6 +8133,10 @@ msgstr "잘못된 공유 URL입니다."msgid "Invalid YAML"msgstr "잘못된 YAML"+#: src/components/ReportBugDialogBody.tsx+msgid "It also adds any display-connection errors OpenKnowledge wrote to your user journal in the past week, each message cut to 200 characters."+msgstr "또한 지난 한 주 동안 OpenKnowledge가 사용자 저널에 기록한 디스플레이 연결 오류를 각 메시지를 200자로 줄여 추가합니다."+#: src/components/ReportBugDialogBody.tsxmsgid "It also adds the crash and hang records Windows logged for OpenKnowledge in the past week, without file paths, and the times of every shutdown, restart, power loss, and low-memory warning on this computer in that week, whatever caused them."msgstr "또한 지난 한 주 동안 Windows가 OpenKnowledge에 대해 기록한 충돌 및 응답 없음 기록을 파일 경로 없이 추가하고, 그 주에 이 컴퓨터에서 발생한 모든 종료, 다시 시작, 전원 손실, 메모리 부족 경고의 시각을 원인과 관계없이 추가합니다."diff --git a/packages/app/src/locales/pl/messages.json b/packages/app/src/locales/pl/messages.jsonindex fdd4c9b5f..ef9614cb6 100644--- a/packages/app/src/locales/pl/messages.json+++ b/packages/app/src/locales/pl/messages.json@@ -5476,6 +5476,9 @@"lond3p": ["Wyświetlane nad treścią kodu. Zapisywane jako `title=\"...\"` w markdownie."],"lrhetp": ["+ ", ["overflow"], " więcej"],"lwCV5v": ["Nie udało się otworzyć ", ["0"], " do edycji: ", ["1"]],+ "lwvkBP": [+ "Dodaje też błędy połączenia z ekranem, które OpenKnowledge zapisało w ostatnim tygodniu w Twoim dzienniku użytkownika, przycinając każdy komunikat do 200 znaków."+ ],"lyWa43": ["Strony projektu bez powiązań"],"lzmtKp": ["Nie udało się wczytać właściwości folderu: ", ["message"]],"lzsa2d": ["Kopiuj błąd"],diff --git a/packages/app/src/locales/pl/messages.po b/packages/app/src/locales/pl/messages.poindex 46a1e5fcb..ffe46b74a 100644--- a/packages/app/src/locales/pl/messages.po+++ b/packages/app/src/locales/pl/messages.po@@ -8133,6 +8133,10 @@ msgstr "Nieprawidłowy adres URL udostępniania."msgid "Invalid YAML"msgstr "Nieprawidłowy YAML"+#: src/components/ReportBugDialogBody.tsx+msgid "It also adds any display-connection errors OpenKnowledge wrote to your user journal in the past week, each message cut to 200 characters."+msgstr "Dodaje też błędy połączenia z ekranem, które OpenKnowledge zapisało w ostatnim tygodniu w Twoim dzienniku użytkownika, przycinając każdy komunikat do 200 znaków."+#: src/components/ReportBugDialogBody.tsxmsgid "It also adds the crash and hang records Windows logged for OpenKnowledge in the past week, without file paths, and the times of every shutdown, restart, power loss, and low-memory warning on this computer in that week, whatever caused them."msgstr "Dodaje też zapisane przez Windows w ostatnim tygodniu awarie i zawieszenia OpenKnowledge, bez ścieżek plików, a także godziny każdego wyłączenia, ponownego uruchomienia, utraty zasilania i ostrzeżenia o małej ilości pamięci na tym komputerze w tym tygodniu, niezależnie od przyczyny."diff --git a/packages/app/src/locales/pseudo/messages.json b/packages/app/src/locales/pseudo/messages.jsonindex 714a19a1c..57dc4d0f6 100644--- a/packages/app/src/locales/pseudo/messages.json+++ b/packages/app/src/locales/pseudo/messages.json@@ -4652,6 +4652,9 @@"lond3p": ["Śĥōŵś àƀōvē ţĥē ćōďē ƀōďŷ. Ŕōũńď-ţŕĩƥś àś `ţĩţĺē=\"...\"` ĩń ḿàŕķďōŵń."],"lrhetp": ["+ ", ["overflow"], " ḿōŕē"],"lwCV5v": ["Ćōũĺďń'ţ ōƥēń ", ["0"], " ƒōŕ ēďĩţĩńĝ: ", ["1"]],+ "lwvkBP": [+ "Ĩţ àĺśō àďďś àńŷ ďĩśƥĺàŷ-ćōńńēćţĩōń ēŕŕōŕś ŌƥēńĶńōŵĺēďĝē ŵŕōţē ţō ŷōũŕ ũśēŕ Ĵōũŕńàĺ ĩń ţĥē ƥàśţ ŵēēķ, ēàćĥ ḿēśśàĝē ćũţ ţō 200 ćĥàŕàćţēŕś."+ ],"lyWa43": ["ƤŕōĴēćţ-ĺēvēĺ ďĩśćōńńēćţēď ƥàĝēś"],"lzmtKp": ["Ƒàĩĺēď ţō ĺōàď ƒōĺďēŕ ƥŕōƥēŕţĩēś: ", ["message"]],"lzsa2d": ["Ćōƥŷ ēŕŕōŕ"],diff --git a/packages/app/src/locales/pseudo/messages.po b/packages/app/src/locales/pseudo/messages.poindex 2b2f100f3..4b4c3a790 100644--- a/packages/app/src/locales/pseudo/messages.po+++ b/packages/app/src/locales/pseudo/messages.po@@ -8129,6 +8129,10 @@ msgstr ""msgid "Invalid YAML"msgstr ""+#: src/components/ReportBugDialogBody.tsx+msgid "It also adds any display-connection errors OpenKnowledge wrote to your user journal in the past week, each message cut to 200 characters."+msgstr ""+#: src/components/ReportBugDialogBody.tsxmsgid "It also adds the crash and hang records Windows logged for OpenKnowledge in the past week, without file paths, and the times of every shutdown, restart, power loss, and low-memory warning on this computer in that week, whatever caused them."msgstr ""diff --git a/packages/app/src/locales/pt-BR/messages.json b/packages/app/src/locales/pt-BR/messages.jsonindex b59d1bec5..5ede23928 100644--- a/packages/app/src/locales/pt-BR/messages.json+++ b/packages/app/src/locales/pt-BR/messages.json@@ -5258,6 +5258,9 @@"lond3p": ["Aparece acima do corpo do código. No markdown, vai e volta como `title=\"...\"`."],"lrhetp": ["+ mais ", ["overflow"]],"lwCV5v": ["Não deu para abrir ", ["0"], " para edição: ", ["1"]],+ "lwvkBP": [+ "Também adiciona os erros de conexão com a tela que o OpenKnowledge gravou no seu diário de usuário na última semana, com cada mensagem cortada em 200 caracteres."+ ],"lyWa43": ["Páginas desconectadas em todo o projeto"],"lzmtKp": ["Falha ao carregar as propriedades da pasta: ", ["message"]],"lzsa2d": ["Copiar o erro"],diff --git a/packages/app/src/locales/pt-BR/messages.po b/packages/app/src/locales/pt-BR/messages.poindex 4ebaad263..f485f1ab8 100644--- a/packages/app/src/locales/pt-BR/messages.po+++ b/packages/app/src/locales/pt-BR/messages.po@@ -8129,6 +8129,10 @@ msgstr "URL de compartilhamento inválida."msgid "Invalid YAML"msgstr "YAML inválido"+#: src/components/ReportBugDialogBody.tsx+msgid "It also adds any display-connection errors OpenKnowledge wrote to your user journal in the past week, each message cut to 200 characters."+msgstr "Também adiciona os erros de conexão com a tela que o OpenKnowledge gravou no seu diário de usuário na última semana, com cada mensagem cortada em 200 caracteres."+#: src/components/ReportBugDialogBody.tsxmsgid "It also adds the crash and hang records Windows logged for OpenKnowledge in the past week, without file paths, and the times of every shutdown, restart, power loss, and low-memory warning on this computer in that week, whatever caused them."msgstr "Também adiciona os registros de falhas e travamentos que o Windows anotou para o OpenKnowledge na última semana, sem caminhos de arquivo, e os horários de cada desligamento, reinicialização, queda de energia e aviso de pouca memória deste computador nessa semana, seja qual for a causa."diff --git a/packages/app/src/locales/ur/messages.json b/packages/app/src/locales/ur/messages.jsonindex b6a747d96..dde9fc14f 100644--- a/packages/app/src/locales/ur/messages.json+++ b/packages/app/src/locales/ur/messages.json@@ -4736,6 +4736,9 @@],"lrhetp": ["+ ", ["overflow"], " مزید"],"lwCV5v": [["0"], " ترمیم کے لیے نہیں کھل سکا: ", ["1"]],+ "lwvkBP": [+ "یہ پچھلے ہفتے OpenKnowledge کی طرف سے آپ کے صارف جرنل میں لکھی گئی ڈسپلے کنکشن کی خرابیاں بھی شامل کرتا ہے، ہر پیغام کو 200 حروف تک مختصر کر کے۔"+ ],"lyWa43": ["پروجیکٹ کی سطح کے منقطع صفحات"],"lzmtKp": ["فولڈر کی خصوصیات لوڈ نہیں ہو سکیں: ", ["message"]],"lzsa2d": ["خرابی نقل کریں"],diff --git a/packages/app/src/locales/ur/messages.po b/packages/app/src/locales/ur/messages.poindex 11077d844..685e89609 100644--- a/packages/app/src/locales/ur/messages.po+++ b/packages/app/src/locales/ur/messages.po@@ -8133,6 +8133,10 @@ msgstr "شیئر URL درست نہیں۔"msgid "Invalid YAML"msgstr "YAML درست نہیں"+#: src/components/ReportBugDialogBody.tsx+msgid "It also adds any display-connection errors OpenKnowledge wrote to your user journal in the past week, each message cut to 200 characters."+msgstr "یہ پچھلے ہفتے OpenKnowledge کی طرف سے آپ کے صارف جرنل میں لکھی گئی ڈسپلے کنکشن کی خرابیاں بھی شامل کرتا ہے، ہر پیغام کو 200 حروف تک مختصر کر کے۔"+#: src/components/ReportBugDialogBody.tsxmsgid "It also adds the crash and hang records Windows logged for OpenKnowledge in the past week, without file paths, and the times of every shutdown, restart, power loss, and low-memory warning on this computer in that week, whatever caused them."msgstr "یہ پچھلے ہفتے Windows کی جانب سے OpenKnowledge کے لیے درج کریش اور اٹکنے کے ریکارڈ، فائل پاتھ کے بغیر، اور اس ہفتے اس کمپیوٹر پر ہر شٹ ڈاؤن، ری اسٹارٹ، بجلی جانے اور کم میموری کی وارننگ کے اوقات بھی شامل کرتا ہے، وجہ جو بھی ہو۔"diff --git a/packages/app/src/locales/zh-Hans/messages.json b/packages/app/src/locales/zh-Hans/messages.jsonindex 8eae332e7..8f28f1372 100644--- a/packages/app/src/locales/zh-Hans/messages.json+++ b/packages/app/src/locales/zh-Hans/messages.json@@ -4049,6 +4049,9 @@"lond3p": ["显示在代码正文上方。在 markdown 中以 `title=\"...\"` 的形式往返。"],"lrhetp": ["+ 还有 ", ["overflow"], " 个"],"lwCV5v": ["无法打开 ", ["0"], " 进行编辑:", ["1"]],+ "lwvkBP": [+ "它还会添加 OpenKnowledge 在过去一周内写入你的用户日志的显示连接错误,每条消息截断为 200 个字符。"+ ],"lyWa43": ["项目级孤立页面"],"lzmtKp": ["加载文件夹属性失败:", ["message"]],"lzsa2d": ["复制错误"],diff --git a/packages/app/src/locales/zh-Hans/messages.po b/packages/app/src/locales/zh-Hans/messages.poindex 5ef7f7490..b0e45c597 100644--- a/packages/app/src/locales/zh-Hans/messages.po+++ b/packages/app/src/locales/zh-Hans/messages.po@@ -8133,6 +8133,10 @@ msgstr "共享链接无效。"msgid "Invalid YAML"msgstr "无效的 YAML"+#: src/components/ReportBugDialogBody.tsx+msgid "It also adds any display-connection errors OpenKnowledge wrote to your user journal in the past week, each message cut to 200 characters."+msgstr "它还会添加 OpenKnowledge 在过去一周内写入你的用户日志的显示连接错误,每条消息截断为 200 个字符。"+#: src/components/ReportBugDialogBody.tsxmsgid "It also adds the crash and hang records Windows logged for OpenKnowledge in the past week, without file paths, and the times of every shutdown, restart, power loss, and low-memory warning on this computer in that week, whatever caused them."msgstr "它还会添加 Windows 在过去一周内为 OpenKnowledge 记录的崩溃和无响应记录(不含文件路径),以及这台电脑在那一周内每次关机、重启、断电和内存不足警告的时间,无论原因为何。"diff --git a/packages/app/src/locales/zh-Hant/messages.json b/packages/app/src/locales/zh-Hant/messages.jsonindex 3600e1c82..ef85cc07f 100644--- a/packages/app/src/locales/zh-Hant/messages.json+++ b/packages/app/src/locales/zh-Hant/messages.json@@ -4069,6 +4069,9 @@"lond3p": ["顯示在程式碼內文上方。在 markdown 中以 `title=\"...\"` 的形式往返。"],"lrhetp": ["+ 還有 ", ["overflow"], " 個"],"lwCV5v": ["無法開啟 ", ["0"], " 進行編輯:", ["1"]],+ "lwvkBP": [+ "它還會加入 OpenKnowledge 在過去一週內寫入你的使用者日誌的顯示連線錯誤,每則訊息截斷為 200 個字元。"+ ],"lyWa43": ["專案層級的孤立頁面"],"lzmtKp": ["載入資料夾屬性失敗:", ["message"]],"lzsa2d": ["複製錯誤"],diff --git a/packages/app/src/locales/zh-Hant/messages.po b/packages/app/src/locales/zh-Hant/messages.poindex 58515d58d..93720fb7d 100644--- a/packages/app/src/locales/zh-Hant/messages.po+++ b/packages/app/src/locales/zh-Hant/messages.po@@ -8133,6 +8133,10 @@ msgstr "分享網址無效。"msgid "Invalid YAML"msgstr "無效的 YAML"+#: src/components/ReportBugDialogBody.tsx+msgid "It also adds any display-connection errors OpenKnowledge wrote to your user journal in the past week, each message cut to 200 characters."+msgstr "它還會加入 OpenKnowledge 在過去一週內寫入你的使用者日誌的顯示連線錯誤,每則訊息截斷為 200 個字元。"+#: src/components/ReportBugDialogBody.tsxmsgid "It also adds the crash and hang records Windows logged for OpenKnowledge in the past week, without file paths, and the times of every shutdown, restart, power loss, and low-memory warning on this computer in that week, whatever caused them."msgstr "它還會加入 Windows 在過去一週內為 OpenKnowledge 記錄的當機與沒有回應記錄(不含檔案路徑),以及這台電腦在那一週內每次關機、重新啟動、斷電和記憶體不足警告的時間,無論原因為何。"diff --git a/packages/cli/src/commands/bug-report-bundle.ts b/packages/cli/src/commands/bug-report-bundle.tsindex 1e8ee1302..ae723828a 100644--- a/packages/cli/src/commands/bug-report-bundle.ts+++ b/packages/cli/src/commands/bug-report-bundle.ts@@ -608,13 +608,15 @@ export async function collectStandardBundle(: []),...((opts.osTerminationEvidence?.events.length ?? 0) > 0? [- 'Termination records: read from the operating system rather than written',- 'by OpenKnowledge, covering the last 7 days, to explain an exit the app',- 'could not record itself. On macOS: the memory-pressure (jetsam) reports',+ "Termination records: read from the operating system's own logs, covering",+ 'the last 7 days, to explain an exit the app could not record itself. On',+ 'macOS: the memory-pressure (jetsam) reports',"that list processes of this app, with each one's memory use and whether",'it was killed. On Linux: kernel and systemd-oomd out-of-memory kills of','this app, as structured fields with the machine name, cgroup paths and',- 'user id left out. On Windows: crash and hang records for this app with',+ "user id left out, plus display-connection errors this app's desktop",+ "process wrote to the user's own journal, with Chromium's message cut to",+ '200 characters. On Windows: crash and hang records for this app with','file paths left out, plus the time of every shutdown, restart, power','loss and low-memory warning on the machine, whatever caused it:',`- ${OS_TERMINATION_EVIDENCE_PATH}`,diff --git a/packages/cli/src/commands/diagnose-bundle.test.ts b/packages/cli/src/commands/diagnose-bundle.test.tsindex 5c5b6139a..c24a6354f 100644--- a/packages/cli/src/commands/diagnose-bundle.test.ts+++ b/packages/cli/src/commands/diagnose-bundle.test.ts@@ -131,12 +131,15 @@ describe('runDiagnoseBundle — macOS crash reports', () => {const { deps, captured } = makeRunnerDeps();deps.osTerminationEvidenceDeps = {platform: 'linux',- runCommand: async () => ({- status: 0,- stdout:- '2026-10-04T18:49:10.000000+00:00 host kernel: Out of memory: Killed process 12 (openknowledge) total-vm:1kB\n',- stderr: '',- }),+ runCommand: async (_command, args) =>+ args[0] === '--user'+ ? { status: 1, stdout: '-- No entries --\n', stderr: '' }+ : {+ status: 0,+ stdout:+ '2026-10-04T18:49:10.000000+00:00 host kernel: Out of memory: Killed process 12 (openknowledge) total-vm:1kB\n',+ stderr: '',+ },};const result = await runDiagnoseBundle({ contentDir, yes: true }, deps);@@ -146,7 +149,7 @@ describe('runDiagnoseBundle — macOS crash reports', () => {);expect(evidence).toMatchObject({ source: 'linux-journal', outcome: 'collected' });expect(captured.logs.find((l) => l.includes('OS termination log:'))).toContain(- 'collected from system journal (7d; 1 kept; 0 other-process record(s) ignored; 0 unparseable)',+ 'collected from system and user journals (7d; 1 kept; 0 other-process record(s) ignored; 0 unparseable)',);});diff --git a/packages/cli/src/diagnose/os-termination-evidence.test.ts b/packages/cli/src/diagnose/os-termination-evidence.test.tsindex ba623af86..578c66184 100644--- a/packages/cli/src/diagnose/os-termination-evidence.test.ts+++ b/packages/cli/src/diagnose/os-termination-evidence.test.ts@@ -8,6 +8,7 @@ import {createRunCommand,describeOsTerminationEvidence,findJetsamKillSync,+ LINUX_DISPLAY_FATAL_GREP,LINUX_JOURNAL_GREP,parseJetsamReport,renderOsTerminationEvidence,@@ -371,7 +372,11 @@ function runner(results: Record<string, CommandResult>) {maxInFlight = Math.max(maxInFlight, inFlight);await new Promise((r) => setTimeout(r, 5));inFlight -= 1;- const key = command.endsWith('wevtutil.exe') ? `wevtutil:${args[1]}` : command;+ const key = command.endsWith('wevtutil.exe')+ ? `wevtutil:${args[1]}`+ : args[0] === '--user'+ ? `${command} --user`+ : command;const result = results[key];if (result === undefined) throw new Error(`unexpected command ${key}`);return result;@@ -393,10 +398,10 @@ describe('Linux journal collection', () => {const FOREIGN ='2026-10-04T18:30:00.000000+00:00 host-a kernel: Out of memory: Killed process 99 (chrome) total-vm:1kB';- test('queries kernel and systemd-oomd lines for the last week with a pinned filter', async () => {- const { run, calls } = runner({- journalctl: { status: 1, stdout: '-- No entries --\n', stderr: '' },- });+ const NO_ENTRIES: CommandResult = { status: 1, stdout: '-- No entries --\n', stderr: '' };++ test('queries kernel, systemd-oomd and this user’s own display-loss lines for the last week', async () => {+ const { run, calls } = runner({ journalctl: NO_ENTRIES, 'journalctl --user': NO_ENTRIES });await collectOsTerminationEvidence({ platform: 'linux', runCommand: run });@@ -413,6 +418,16 @@ describe('Linux journal collection', () => {'_SYSTEMD_UNIT=systemd-oomd.service',],},+ {+ command: 'journalctl',+ args: [+ '--user',+ '--no-pager',+ '--output=short-iso-precise',+ '--since=-7d',+ '--grep=Fatal Wayland communication error|Wayland protocol error|X IO error|Missing X server',+ ],+ },]);});@@ -430,6 +445,7 @@ describe('Linux journal collection', () => {stdout: `-- Boot 44962998fa1849c29d4807eefb892418 --\n${FOREIGN}\n${OOMD_PRESSURE}\n${OOMD_SWAP}\n${KERNEL_INVOKED}\n${KERNEL_TASK}\n${KERNEL_KILLED}\n`,stderr: '',},+ 'journalctl --user': NO_ENTRIES,});const evidence = await collectOsTerminationEvidence({ platform: 'linux', runCommand: run });@@ -503,6 +519,7 @@ describe('Linux journal collection', () => {stderr:"Hint: You are currently not seeing messages from other users and the system.\n Users in groups 'adm', 'systemd-journal' can see all messages.\n",},+ 'journalctl --user': NO_ENTRIES,});const evidence = await collectOsTerminationEvidence({ platform: 'linux', runCommand: run });@@ -511,48 +528,260 @@ describe('Linux journal collection', () => {});test('counts an exit-1 window as empty only when journalctl printed its no-entries marker', async () => {- const empty = runner({- journalctl: {- status: 1,- stdout: '-- Boot 44962998fa1849c29d4807eefb892418 --\n-- No entries --\n',- stderr: '',- },+ const both = (result: CommandResult) =>+ runner({ journalctl: result, 'journalctl --user': result }).run;+ const empty = both({+ status: 1,+ stdout: '-- Boot 44962998fa1849c29d4807eefb892418 --\n-- No entries --\n',+ stderr: '',});- const rejected = runner({- journalctl: {- status: 1,- stdout: '',- stderr: "journalctl: unrecognized option '--grep=Out of memory'\n",- },+ const rejected = both({+ status: 1,+ stdout: '',+ stderr: "journalctl: unrecognized option '--grep=Out of memory'\n",});- const missing = runner({- journalctl: { status: null, stdout: '', stderr: '', errorCode: 'ENOENT' },+ const missing = both({ status: null, stdout: '', stderr: '', errorCode: 'ENOENT' });+ const corrupt = both({+ status: 1,+ stdout: '',+ stderr:+ 'Journal file /var/log/journal/0123456789abcdef0123456789abcdef/system.journal is truncated, ignoring file.\n',});expect(- (await collectOsTerminationEvidence({ platform: 'linux', runCommand: empty.run })).outcome,+ (await collectOsTerminationEvidence({ platform: 'linux', runCommand: empty })).outcome,).toBe('none-in-window');expect(- await collectOsTerminationEvidence({ platform: 'linux', runCommand: rejected.run }),+ await collectOsTerminationEvidence({ platform: 'linux', runCommand: rejected }),).toMatchObject({outcome: 'unavailable',- unavailableReason: "exit 1: journalctl: unrecognized option '--grep=Out of memory'",+ unavailableReason:+ "system journal: exit 1: journalctl: unrecognized option '--grep=Out of memory'; user journal: exit 1: journalctl: unrecognized option '--grep=Out of memory'",});expect(- await collectOsTerminationEvidence({ platform: 'linux', runCommand: missing.run }),- ).toMatchObject({ outcome: 'unavailable', unavailableReason: 'ENOENT' });- const corrupt = runner({- journalctl: {- status: 1,- stdout: '',- stderr:- 'Journal file /var/log/journal/0123456789abcdef0123456789abcdef/system.journal is truncated, ignoring file.\n',- },+ await collectOsTerminationEvidence({ platform: 'linux', runCommand: missing }),+ ).toMatchObject({+ outcome: 'unavailable',+ unavailableReason: 'system journal: ENOENT; user journal: ENOENT',});expect(- await collectOsTerminationEvidence({ platform: 'linux', runCommand: corrupt.run }),+ await collectOsTerminationEvidence({ platform: 'linux', runCommand: corrupt }),).toMatchObject({- unavailableReason: 'exit 1: Journal file <journal path> is truncated, ignoring file.',+ unavailableReason:+ 'system journal: exit 1: Journal file <journal path> is truncated, ignoring file.; user journal: exit 1: Journal file <journal path> is truncated, ignoring file.',+ });+ });++ test('keeps what one journal holds when the other cannot be read', async () => {+ const { run } = runner({+ journalctl: { status: 0, stdout: `${KERNEL_KILLED}\n`, stderr: '' },+ 'journalctl --user': { status: 1, stdout: '', stderr: 'No journal files were found.\n' },+ });++ const evidence = await collectOsTerminationEvidence({ platform: 'linux', runCommand: run });++ expect(evidence).toMatchObject({+ outcome: 'partial',+ unavailableReason: 'user journal: exit 1: No journal files were found.',+ });+ expect(evidence.events).toHaveLength(1);+ });++ describe('display-server connection loss', () => {+ const OWNED_PID = 2544264;+ const OWNED_FATAL = `2026-10-04T23:46:38.123456+00:00 host-a Hyprland[1200]: [${OWNED_PID}:1004/234638.123456:ERROR:ui/events/platform/wayland/wayland_event_watcher.cc:78] Fatal Wayland communication error: Broken pipe.`;+ const OWNED_PROTOCOL = `2026-10-04T23:46:38.120000+00:00 host-a openknowledge[${OWNED_PID}]: [${OWNED_PID}:${OWNED_PID}:1004/234638.120000:ERROR:wayland_event_watcher.cc(42)] Wayland protocol error: zwp_text_input_v3@44: error 0: text input already enabled`;+ const OWNED_X11 = `2026-10-03T08:00:00.000000+00:00 host-a gnome-shell[900]: [${OWNED_PID}:1003/080000.000000:ERROR:x11_util.cc(85)] X IO error received (X server probably went away)`;+ const FOREIGN_CHROMIUM =+ '2026-10-04T22:00:00.000000+00:00 host-a Hyprland[1200]: [4242:1004/220000.000000:ERROR:wayland_event_watcher.cc(42)] Fatal Wayland communication error: Connection reset by peer.';+ const FOREIGN_GTK =+ '2026-10-04T22:00:01.000000+00:00 host-a firefox[50]: Gdk-Message: 22:00:01.000: Error 71 (Protocol error) dispatching to Wayland display.';+ const RETIRED_PID =+ '2026-09-25T10:00:00.000000+00:00 host-a Hyprland[1200]: [777:0925/100000.000000:ERROR:wayland_event_watcher.cc(42)] Fatal Wayland communication error: Broken pipe.';++ function desktopLogs(): string {+ const dir = makeTmpDir();+ writeAged(+ dir,+ 'desktop.2026-10-04.log',+ [+ `{"level":30,"pid":${OWNED_PID},"runtime":"desktop","event":"desktop.boot","msg":"desktop main process starting"}`,+ `{"level":30,"pid":4242,"runtime":"desktop","subsystem":"updater","msg":"checking-for-update"}`,+ ].join('\n'),+ 1,+ );+ writeAged(+ dir,+ 'desktop.2026-09-25.log',+ '{"level":30,"pid":777,"runtime":"desktop","event":"desktop.boot","msg":"desktop main process starting"}',+ 9,+ );+ writeAged(dir, 'server.2026-10-04.log', '{"level":30,"pid":4242,"event":"desktop.boot"}', 1);+ return dir;+ }++ test('the user-journal filter selects every fatal display wording Chromium prints', () => {+ const filter = new RegExp(LINUX_DISPLAY_FATAL_GREP);+ for (const line of [OWNED_FATAL, OWNED_PROTOCOL, OWNED_X11, FOREIGN_CHROMIUM]) {+ expect(filter.test(line)).toBe(true);+ }+ expect(filter.test(FOREIGN_GTK)).toBe(false);+ });++ test('keeps only lines a desktop main process of this app wrote, matched by its pid', async () => {+ const { run } = runner({+ journalctl: NO_ENTRIES,+ 'journalctl --user': {+ status: 0,+ stdout: `${RETIRED_PID}\n${OWNED_X11}\n${FOREIGN_CHROMIUM}\n${FOREIGN_GTK}\n${OWNED_PROTOCOL}\n${OWNED_FATAL}\n`,+ stderr: '',+ },+ });++ const evidence = await collectOsTerminationEvidence({+ platform: 'linux',+ now: () => NOW,+ desktopLogsDir: desktopLogs(),+ runCommand: run,+ });++ expect(evidence).toMatchObject({ outcome: 'collected', foreignIgnored: 3, unparseable: 0 });+ expect(evidence.events).toEqual([+ {+ kind: 'journal',+ at: '2026-10-03T08:00:00.000000+00:00',+ origin: 'chromium',+ action: 'display-connection-lost',+ pid: OWNED_PID,+ processName: null,+ unit: null,+ trigger: 'x11',+ detail: 'X IO error received (X server probably went away)',+ },+ {+ kind: 'journal',+ at: '2026-10-04T23:46:38.120000+00:00',+ origin: 'chromium',+ action: 'display-connection-lost',+ pid: OWNED_PID,+ processName: null,+ unit: null,+ trigger: 'wayland',+ detail:+ 'Wayland protocol error: zwp_text_input_v3@44: error 0: text input already enabled',+ },+ {+ kind: 'journal',+ at: '2026-10-04T23:46:38.123456+00:00',+ origin: 'chromium',+ action: 'display-connection-lost',+ pid: OWNED_PID,+ processName: null,+ unit: null,+ trigger: 'wayland',+ detail: 'Fatal Wayland communication error: Broken pipe.',+ },+ ]);+ expect(JSON.stringify(evidence.events)).not.toContain('host-a');+ });++ test('reports Chromium lines it could not attribute instead of calling them foreign', async () => {+ const { run } = runner({+ journalctl: NO_ENTRIES,+ 'journalctl --user': { status: 0, stdout: `${OWNED_FATAL}\n${FOREIGN_GTK}\n`, stderr: '' },+ });+ const noBootLine = makeTmpDir();+ writeAged(noBootLine, 'desktop.2026-10-04.log', '{"pid":1,"msg":"x"}', 1);++ const missing = await collectOsTerminationEvidence({+ platform: 'linux',+ now: () => NOW,+ desktopLogsDir: join(makeTmpDir(), 'missing'),+ runCommand: run,+ });+ const pruned = await collectOsTerminationEvidence({+ platform: 'linux',+ now: () => NOW,+ desktopLogsDir: noBootLine,+ runCommand: run,+ });++ expect(missing).toMatchObject({+ outcome: 'partial',+ unavailableReason:+ 'user journal: 1 Chromium display line(s) not attributed, desktop logs unreadable',+ foreignIgnored: 1,+ events: [],+ });+ expect(pruned).toMatchObject({+ outcome: 'partial',+ unavailableReason:+ 'user journal: 1 Chromium display line(s) not attributed, no desktop.boot pid in desktop logs',+ });+ });++ test.skipIf(process.platform === 'win32' || process.getuid?.() === 0)(+ 'keeps attributed lines but will not call the rest foreign when a desktop log was unreadable',+ async () => {+ const dir = desktopLogs();+ const unreadable = join(dir, 'desktop.2026-10-03.log');+ writeAged(dir, 'desktop.2026-10-03.log', '{"pid":4242,"event":"desktop.boot"}', 1);+ chmodSync(unreadable, 0o000);+ const { run } = runner({+ journalctl: NO_ENTRIES,+ 'journalctl --user': {+ status: 0,+ stdout: `${OWNED_FATAL}\n${FOREIGN_CHROMIUM}\n`,+ stderr: '',+ },+ });++ const evidence = await collectOsTerminationEvidence({+ platform: 'linux',+ now: () => NOW,+ desktopLogsDir: dir,+ runCommand: run,+ });+ chmodSync(unreadable, 0o644);++ expect(evidence).toMatchObject({+ outcome: 'partial',+ unavailableReason:+ 'user journal: 1 Chromium display line(s) not attributed, desktop logs unreadable',+ foreignIgnored: 0,+ });+ expect(evidence.events.map((e) => (e.kind === 'journal' ? e.pid : null))).toEqual([+ 2544264,+ ]);+ },+ );++ test('caps Chromium’s message and counts overflow from both journals', async () => {+ const long = `${OWNED_FATAL.replace('Broken pipe.', 'x'.repeat(400))}`;+ const { run } = runner({+ journalctl: {+ status: 0,+ stdout: `${Array.from({ length: 52 }, () => KERNEL_KILLED).join('\n')}\n`,+ stderr: '',+ },+ 'journalctl --user': {+ status: 0,+ stdout: `${Array.from({ length: 51 }, () => long).join('\n')}\n`,+ stderr: '',+ },+ });++ const evidence = await collectOsTerminationEvidence({+ platform: 'linux',+ now: () => NOW,+ desktopLogsDir: desktopLogs(),+ runCommand: run,+ });++ expect(evidence.events).toHaveLength(100);+ expect(evidence.droppedOverCap).toBe(3);+ const display = evidence.events.find((e) => e.kind === 'journal' && e.origin === 'chromium');+ expect(display?.kind === 'journal' ? display.detail : null).toHaveLength(200);});});});diff --git a/packages/cli/src/diagnose/os-termination-evidence.ts b/packages/cli/src/diagnose/os-termination-evidence.tsindex cea1fc541..efde22e1a 100644--- a/packages/cli/src/diagnose/os-termination-evidence.ts+++ b/packages/cli/src/diagnose/os-termination-evidence.ts@@ -3,6 +3,7 @@ import { readdirSync, readFileSync, statSync } from 'node:fs';import { readdir, readFile, stat } from 'node:fs/promises';import { join, win32 } from 'node:path';import { DESKTOP_PRODUCTS, desktopWindowsExecutableName } from '@inkeep/open-knowledge-core';+import { okUserHomeDir } from '@inkeep/open-knowledge-core/server';import {DIAGNOSTIC_REPORT_WINDOW_DAYS,isOwnedProcessName,@@ -45,12 +46,13 @@ interface JetsamEvidenceEvent {interface JournalEvidenceEvent {kind: 'journal';at: string;- origin: 'kernel' | 'systemd-oomd';- action: 'oom-invoked' | 'oom-kill' | 'oomd-kill';+ origin: 'kernel' | 'systemd-oomd' | 'chromium';+ action: 'oom-invoked' | 'oom-kill' | 'oomd-kill' | 'display-connection-lost';pid: number | null;processName: string | null;unit: string | null;- trigger: 'memory-pressure' | 'swap' | null;+ trigger: 'memory-pressure' | 'swap' | 'wayland' | 'x11' | null;+ detail?: string;}interface WindowsEvidenceEvent {@@ -102,6 +104,7 @@ export interface OsTerminationEvidenceDeps {now?: () => Date;macosReportsDir?: string;systemRoot?: string;+ desktopLogsDir?: string;runCommand?: RunCommand;}@@ -447,8 +450,56 @@ const LINUX_JOURNAL_ARGS: readonly string[] = ['_SYSTEMD_UNIT=systemd-oomd.service',];+export const LINUX_DISPLAY_FATAL_GREP =+ 'Fatal Wayland communication error|Wayland protocol error|X IO error|Missing X server';++const LINUX_USER_JOURNAL_ARGS: readonly string[] = [+ '--user',+ '--no-pager',+ '--output=short-iso-precise',+ '--since=-7d',+ `--grep=${LINUX_DISPLAY_FATAL_GREP}`,+];+const JOURNAL_LINE = /^(\S+) \S+ ([^:\s[]+)(?:\[\d+\])?: (.*)$/;+const CHROMIUM_LOG_LINE = /\[(\d+)(?::\d+)?:\d{4}\/\d{6}\.\d+:[A-Z0-9]+:[^\]]*\]\s*(.*)$/;++const MAX_DETAIL_LENGTH = 200;++const DESKTOP_LOG_FILE = /^desktop\.\d{4}-\d{2}-\d{2}\.log$/;++const DESKTOP_BOOT_LINE = '"event":"desktop.boot"';++async function readDesktopMainPids(+ logsDir: string,+ now: Date,+): Promise<{ pids: Set<number>; unreadable: boolean }> {+ const pids = new Set<number>();+ let names: string[];+ try {+ names = await readdir(logsDir);+ } catch {+ return { pids, unreadable: true };+ }+ let unreadable = false;+ for (const name of names) {+ if (!DESKTOP_LOG_FILE.test(name)) continue;+ const path = join(logsDir, name);+ try {+ if (now.getTime() - (await stat(path)).mtimeMs > WINDOW_MS) continue;+ for (const line of (await readFile(path, 'utf8')).split('\n')) {+ if (!line.includes(DESKTOP_BOOT_LINE)) continue;+ const pid = /"pid":(\d+)/.exec(line)?.[1];+ if (pid !== undefined) pids.add(Number(pid));+ }+ } catch {+ unreadable = true;+ }+ }+ return { pids, unreadable };+}+function parseJournalMessage(origin: string,message: string,@@ -537,18 +588,137 @@ function parseJournalOutput(stdout: string): {return { events, foreignIgnored, unparseable };}-async function collectLinuxJournal(run: RunCommand): Promise<OsTerminationEvidence> {- const evidence = base('linux', 'linux-journal', [`journalctl ${LINUX_JOURNAL_ARGS.join(' ')}`]);- const result = await run('journalctl', [...LINUX_JOURNAL_ARGS]);- const emptyWindow = result.status === 1 && /^-- No entries --$/m.test(result.stdout);- if (result.status !== 0 && !emptyWindow) return unavailable(evidence, describeFailure(result));- const parsed = parseJournalOutput(result.stdout);- evidence.droppedOverCap = Math.max(0, parsed.events.length - MAX_EVENTS);- evidence.events.push(...parsed.events.slice(-MAX_EVENTS));- evidence.foreignIgnored = parsed.foreignIgnored;- evidence.unparseable = parsed.unparseable;- if (/not seeing messages from other users/i.test(`${result.stdout}\n${result.stderr}`)) {- evidence.restrictedToCurrentUser = true;+interface DisplayFatalLine {+ at: string;+ pid: number;+ detail: string;+}++function parseDisplayFatalOutput(stdout: string): {+ lines: DisplayFatalLine[];+ foreignIgnored: number;+ unparseable: number;+} {+ const lines: DisplayFatalLine[] = [];+ let foreignIgnored = 0;+ let unparseable = 0;+ for (const line of stdout.split('\n')) {+ if (line.trim() === '' || line.startsWith('-- ')) continue;+ const match = JOURNAL_LINE.exec(line);+ if (match === null) {+ unparseable += 1;+ continue;+ }+ const [, at = '', , message = ''] = match;+ const chromium = CHROMIUM_LOG_LINE.exec(message);+ if (chromium === null) {+ foreignIgnored += 1;+ continue;+ }+ lines.push({+ at,+ pid: Number(chromium[1]),+ detail: (chromium[2] ?? '').slice(0, MAX_DETAIL_LENGTH),+ });+ }+ return { lines, foreignIgnored, unparseable };+}++async function attributeDisplayFatalLines(+ stdout: string,+ desktopLogsDir: string,+ now: Date,+): Promise<{+ events: JournalEvidenceEvent[];+ foreignIgnored: number;+ unparseable: number;+ unattributed: string | null;+}> {+ const parsed = parseDisplayFatalOutput(stdout);+ if (parsed.lines.length === 0) return { ...parsed, events: [], unattributed: null };+ const owned = await readDesktopMainPids(desktopLogsDir, now);+ const events: JournalEvidenceEvent[] = [];+ let unmatched = 0;+ for (const line of parsed.lines) {+ if (!owned.pids.has(line.pid)) {+ unmatched += 1;+ continue;+ }+ events.push({+ kind: 'journal',+ at: line.at,+ origin: 'chromium',+ action: 'display-connection-lost',+ pid: line.pid,+ processName: null,+ unit: null,+ trigger: /Wayland/.test(line.detail) ? 'wayland' : 'x11',+ detail: line.detail,+ });+ }+ const ownershipProvable = owned.pids.size > 0 && !owned.unreadable;+ if (unmatched > 0 && !ownershipProvable) {+ const why = owned.unreadable+ ? 'desktop logs unreadable'+ : 'no desktop.boot pid in desktop logs';+ return {+ events,+ foreignIgnored: parsed.foreignIgnored,+ unparseable: parsed.unparseable,+ unattributed: `${unmatched} Chromium display line(s) not attributed, ${why}`,+ };+ }+ return {+ events,+ foreignIgnored: parsed.foreignIgnored + unmatched,+ unparseable: parsed.unparseable,+ unattributed: null,+ };+}++function journalRead(result: CommandResult): boolean {+ return result.status === 0 || (result.status === 1 && /^-- No entries --$/m.test(result.stdout));+}++async function collectLinuxJournal(+ run: RunCommand,+ now: Date,+ desktopLogsDir: string,+): Promise<OsTerminationEvidence> {+ const evidence = base('linux', 'linux-journal', [+ `journalctl ${LINUX_JOURNAL_ARGS.join(' ')}`,+ `journalctl ${LINUX_USER_JOURNAL_ARGS.join(' ')}`,+ ]);+ const [system, user] = await Promise.all([+ run('journalctl', [...LINUX_JOURNAL_ARGS]),+ run('journalctl', [...LINUX_USER_JOURNAL_ARGS]),+ ]);+ const failures: string[] = [];+ if (journalRead(system)) {+ const parsed = parseJournalOutput(system.stdout);+ evidence.droppedOverCap += Math.max(0, parsed.events.length - MAX_EVENTS);+ evidence.events.push(...parsed.events.slice(-MAX_EVENTS));+ evidence.foreignIgnored += parsed.foreignIgnored;+ evidence.unparseable += parsed.unparseable;+ if (/not seeing messages from other users/i.test(`${system.stdout}\n${system.stderr}`)) {+ evidence.restrictedToCurrentUser = true;+ }+ } else {+ failures.push(`system journal: ${describeFailure(system)}`);+ }+ if (journalRead(user)) {+ const parsed = await attributeDisplayFatalLines(user.stdout, desktopLogsDir, now);+ evidence.droppedOverCap += Math.max(0, parsed.events.length - MAX_EVENTS);+ evidence.events.push(...parsed.events.slice(-MAX_EVENTS));+ evidence.foreignIgnored += parsed.foreignIgnored;+ evidence.unparseable += parsed.unparseable;+ if (parsed.unattributed !== null) failures.push(`user journal: ${parsed.unattributed}`);+ } else {+ failures.push(`user journal: ${describeFailure(user)}`);+ }+ if (failures.length === 2) return unavailable(evidence, failures.join('; '));+ if (failures.length === 1) {+ return { ...evidence, outcome: 'partial', unavailableReason: failures.join('; ') };}return settle(evidence);}@@ -691,7 +861,7 @@ export async function collectOsTerminationEvidence(case 'darwin':return collectMacosJetsam(deps.macosReportsDir ?? MACOS_SYSTEM_DIAGNOSTIC_REPORTS_DIR, now);case 'linux':- return collectLinuxJournal(run);+ return collectLinuxJournal(run, now, deps.desktopLogsDir ?? join(okUserHomeDir(), 'logs'));case 'win32':return collectWindowsEventLog(run, deps.systemRoot ?? process.env.SystemRoot);default:@@ -708,7 +878,7 @@ export function renderOsTerminationEvidence(evidence: OsTerminationEvidence | unconst SOURCE_NAMES: Record<OsTerminationSource, string> = {'macos-jetsam': 'macOS low-memory reports',- 'linux-journal': 'system journal',+ 'linux-journal': 'system and user journals','windows-event-log': 'Windows event logs',};diff --git a/packages/desktop/src/main/desktop-process-observability.test.ts b/packages/desktop/src/main/desktop-process-observability.test.tsindex ce10bf0b2..288e654a7 100644--- a/packages/desktop/src/main/desktop-process-observability.test.ts+++ b/packages/desktop/src/main/desktop-process-observability.test.ts@@ -9,7 +9,9 @@ import {} from './desktop-process-observability.ts';interface TestWindow extends ObservedBrowserWindow {- emit(event: 'closed' | 'show' | 'hide' | 'minimize' | 'restore'): void;+ emit(+ event: 'closed' | 'show' | 'hide' | 'minimize' | 'restore' | 'unresponsive' | 'responsive',+ ): void;setState(state: Partial<{destroyed: boolean;@@ -265,6 +267,35 @@ describe('desktop process observability', () => {expect(lifecycle.at(-1)).toMatchObject({ liveWindowCount: 0, state: 'destroyed' });});+ test('records a renderer hang and its recovery with the processes at the moment it hung', () => {+ const rig = harness();+ const window = rig.windows[0];+ if (!window) throw new Error('missing test window');++ rig.observability.observeWindow(window);+ window.emit('unresponsive');+ window.emit('responsive');++ const hung = rig.warn.find(+ (line) =>+ line.event === 'desktop-process-observability.window-lifecycle' &&+ line.action === 'unresponsive',+ );+ expect(hung).toMatchObject({ windowId: 7, contentsId: 11, rendererPid: 200, state: 'alive' });+ expect(rig.info).toContainEqual(+ expect.objectContaining({+ event: 'desktop-process-observability.sample',+ trigger: 'renderer-unresponsive',+ processes: expect.arrayContaining([expect.objectContaining({ pid: 200 })]),+ }),+ );+ expect(+ rig.info+ .filter((line) => line.event === 'desktop-process-observability.window-lifecycle')+ .map((line) => line.action),+ ).toEqual(['created', 'responsive']);+ });+test('keeps crash handling alive when Electron refuses a process sample', () => {const rig = harness();rig.observability.start();diff --git a/packages/desktop/src/main/desktop-process-observability.ts b/packages/desktop/src/main/desktop-process-observability.tsindex 9cb8cc0d2..67aaa7580 100644--- a/packages/desktop/src/main/desktop-process-observability.ts+++ b/packages/desktop/src/main/desktop-process-observability.ts@@ -30,7 +30,14 @@ interface ObservedWebContents {isLoading(): boolean;}-type WindowLifecycleEvent = 'closed' | 'show' | 'hide' | 'minimize' | 'restore';+type WindowLifecycleEvent =+ | 'closed'+ | 'show'+ | 'hide'+ | 'minimize'+ | 'restore'+ | 'unresponsive'+ | 'responsive';export interface ObservedBrowserWindow {readonly id: number;@@ -248,7 +255,9 @@ export function createDesktopProcessObservability<IntervalHandle>(}};- const sample = (trigger: 'startup' | 'interval' | 'renderer-ready'): void => {+ const sample = (+ trigger: 'startup' | 'interval' | 'renderer-ready' | 'renderer-unresponsive',+ ): void => {const captured = capture();if (captured === null) return;lastSample = captured;@@ -260,7 +269,15 @@ export function createDesktopProcessObservability<IntervalHandle>(const lifecycle = (window: ObservedBrowserWindow,- action: 'created' | 'shown' | 'hidden' | 'minimized' | 'restored' | 'closed',+ action:+ | 'created'+ | 'shown'+ | 'hidden'+ | 'minimized'+ | 'restored'+ | 'closed'+ | 'unresponsive'+ | 'responsive',identity: WindowIdentity,): void => {const details = inspectTrackedWindow(window, identity);@@ -276,7 +293,7 @@ export function createDesktopProcessObservability<IntervalHandle>('desktop live-window count failed',);}- deps.logger.info(+ deps.logger[action === 'unresponsive' ? 'warn' : 'info']({event: 'desktop-process-observability.window-lifecycle',action,@@ -309,6 +326,11 @@ export function createDesktopProcessObservability<IntervalHandle>(window.on('minimize', () => lifecycle(window, 'minimized', identity));window.on('restore', () => lifecycle(window, 'restored', identity));window.on('closed', () => lifecycle(window, 'closed', identity));+ window.on('unresponsive', () => {+ lifecycle(window, 'unresponsive', identity);+ sample('renderer-unresponsive');+ });+ window.on('responsive', () => lifecycle(window, 'responsive', identity));},snapshotForCrash(affectedRenderer) {const now = deps.now();diff --git a/packages/desktop/src/main/index.ts b/packages/desktop/src/main/index.tsindex 467b2fa2a..f466ff426 100644--- a/packages/desktop/src/main/index.ts+++ b/packages/desktop/src/main/index.ts@@ -348,6 +348,7 @@ import { logIpcError, withIpcErrorLogging } from './ipc-log.ts';import { createDesktopKeepaliveFactory, toKeepaliveLogger } from './keepalive.ts';import { decideAllWindowsClosed, decideRelaunchReveal } from './last-window-policy.ts';import { getBootAmbientCapsFacts, logAmbientCapsPosture } from './linux-ambient-caps.ts';+import { describeLinuxDisplaySession } from './linux-display-session.ts';import {detectGraphicalAuthCommand,runManualInstallFallbackDialog,@@ -6033,6 +6034,15 @@ applyDevShmPosture({getRootDesktopLogger()[level](facts, 'linux shared-memory posture for chromium'),});+const linuxDisplaySession = describeLinuxDisplaySession({+ platform: process.platform,+ env: process.env,+ getSwitchValue: (name) => app.commandLine.getSwitchValue(name),+});+if (linuxDisplaySession) {+ getRootDesktopLogger().info(linuxDisplaySession, 'linux display session');+}+const bootAmbientCapsFacts = getBootAmbientCapsFacts();if (bootAmbientCapsFacts) {logAmbientCapsPosture(bootAmbientCapsFacts, (level, facts) =>diff --git a/packages/desktop/src/main/linux-display-session.test.ts b/packages/desktop/src/main/linux-display-session.test.tsnew file mode 100644index 000000000..a59bd6494--- /dev/null+++ b/packages/desktop/src/main/linux-display-session.test.ts@@ -0,0 +1,58 @@+import { describe, expect, test } from 'vitest';+import { describeLinuxDisplaySession } from './linux-display-session.ts';++describe('describeLinuxDisplaySession', () => {+ test('names the compositor session and the display backend Chromium was steered to', () => {+ const switches: Record<string, string> = { 'ozone-platform-hint': 'auto' };++ expect(+ describeLinuxDisplaySession({+ platform: 'linux',+ env: {+ XDG_SESSION_TYPE: 'wayland',+ XDG_CURRENT_DESKTOP: 'Hyprland',+ WAYLAND_DISPLAY: 'wayland-1',+ DISPLAY: ':0',+ HOME: '/home/someone',+ },+ getSwitchValue: (name) => switches[name] ?? '',+ }),+ ).toEqual({+ event: 'desktop.linux-display-session',+ sessionType: 'wayland',+ currentDesktop: 'Hyprland',+ waylandDisplaySet: true,+ x11DisplaySet: true,+ ozonePlatform: null,+ ozonePlatformHint: 'auto',+ });+ });++ test('falls back to the Electron hint variable and reports an X11-only session', () => {+ expect(+ describeLinuxDisplaySession({+ platform: 'linux',+ env: { XDG_SESSION_TYPE: 'x11', DISPLAY: ':1', ELECTRON_OZONE_PLATFORM_HINT: 'x11' },+ getSwitchValue: () => '',+ }),+ ).toMatchObject({+ sessionType: 'x11',+ currentDesktop: null,+ waylandDisplaySet: false,+ x11DisplaySet: true,+ ozonePlatformHint: 'x11',+ });+ });++ test('bounds a desktop name and records nothing off Linux', () => {+ const session = describeLinuxDisplaySession({+ platform: 'linux',+ env: { XDG_CURRENT_DESKTOP: 'x'.repeat(500) },+ getSwitchValue: () => '',+ });+ expect(session?.currentDesktop).toHaveLength(64);+ expect(+ describeLinuxDisplaySession({ platform: 'darwin', env: {}, getSwitchValue: () => '' }),+ ).toBeNull();+ });+});diff --git a/packages/desktop/src/main/linux-display-session.ts b/packages/desktop/src/main/linux-display-session.tsnew file mode 100644index 000000000..24e930f82--- /dev/null+++ b/packages/desktop/src/main/linux-display-session.ts@@ -0,0 +1,39 @@+const MAX_DESKTOP_NAME_LENGTH = 64;++export interface LinuxDisplaySession {+ event: 'desktop.linux-display-session';+ sessionType: string | null;+ currentDesktop: string | null;+ waylandDisplaySet: boolean;+ x11DisplaySet: boolean;+ ozonePlatform: string | null;+ ozonePlatformHint: string | null;+}++export interface LinuxDisplaySessionDeps {+ platform: NodeJS.Platform;+ env: NodeJS.ProcessEnv;+ getSwitchValue: (name: string) => string;+}++function present(value: string | undefined): string | null {+ const trimmed = value?.trim() ?? '';+ return trimmed === '' ? null : trimmed.slice(0, MAX_DESKTOP_NAME_LENGTH);+}++export function describeLinuxDisplaySession(+ deps: LinuxDisplaySessionDeps,+): LinuxDisplaySession | null {+ if (deps.platform !== 'linux') return null;+ return {+ event: 'desktop.linux-display-session',+ sessionType: present(deps.env.XDG_SESSION_TYPE),+ currentDesktop: present(deps.env.XDG_CURRENT_DESKTOP),+ waylandDisplaySet: present(deps.env.WAYLAND_DISPLAY) !== null,+ x11DisplaySet: present(deps.env.DISPLAY) !== null,+ ozonePlatform: present(deps.getSwitchValue('ozone-platform')),+ ozonePlatformHint:+ present(deps.getSwitchValue('ozone-platform-hint')) ??+ present(deps.env.ELECTRON_OZONE_PLATFORM_HINT),+ };+}