Watch
1
0
Fork
You've already forked SouveraineOS
0

qs-aichat-oom: shell OOM diagnosis, fix scoped for later

This commit is contained in:
Fimeg 2026-07-16 16:23:02 -04:00
commit ac24c17304

47
docs/qs-aichat-oom.md Normal file
View file

@ -0,0 +1,47 @@
# QS AiChat OOM — diagnosed, unfixed (2026-07-16)
The phone's empty-screen state (16:xx, after `souveraine chat` use): quickshell
pid 1121 was OOM-killed at 14:35:11 (anon-rss 952MB on a 3.5GB phone, zram at
limit — 10 swap write-errors). Hyprland survived; the shell died. Not the same
event as the 14:11 hard reset (see provisioning-gaps.md §5).
## The errant path (upstream ii, borrowed by our surface)
Both files are whole-dir/file symlinks into the pristine ii tree — NOT
souveraine overrides yet:
- `services/LatexRenderer.qml:54-80` — splices raw message text into QML
source and `Qt.createQmlObject()`s it per detected "LaTeX expression".
Any brace/quote/backslash in an agent reply = QML syntax error (the
`MicroTeXProcess_<hash>` storm in the shell log, dozens/sec at 14:34:24).
Each success spawns a bash+MicroTeX process. `/opt/MicroTeX` does not
exist on the phone at all.
- `modules/ii/sidebarLeft/aiChat/MessageTextBlock.qml:84-90` — re-runs the
LaTeX regex over the whole accumulated segment on EVERY streaming chunk;
`(\$([^\$]+?)\$)` matches any two dollar signs (shell vars, prices), and
partial matches shift as tokens land, minting new hashes → new
createQmlObject + process spawn each time. Also `property var
messageData: {}` is undefined → the `Cannot read property 'done' of
undefined` / `Unable to assign [undefined] to QObject*` warnings.
## The fix, when this thread opens (~small)
Repo overrides per the deploy.sh compose model (AiChat.qml already is one):
1. `services/LatexRenderer.qml` override: no-op unless the MicroTeX binary
exists; replace string-interpolated createQmlObject with a `Component` +
properties (content never enters QML source); pass the expression as a
bash argument (`"$1"`), not spliced into the command string.
2. `modules/ii/sidebarLeft/aiChat/MessageTextBlock.qml` override: skip
`renderLatex()` while streaming (`!done`) — the existing `onDoneChanged`
renderTimer already covers the final render; `messageData: null` +
optional-chaining guards.
3. Add both to the deploy.sh MANIFEST; `deploy.sh && deploy.sh --phone`.
Cannot fully attribute the 950MB RSS without a repro, but the createQmlObject
storm + per-chunk re-split/TextArea churn during a long streamed reply is the
only visible pathology in the log before death.
Restarted by hand meanwhile (`qs -c souveraine` with session env over SSH) —
which is provisioning-gaps §4 again: the shell has no supervisor; an OOM kill
leaves the phone on an empty screen until someone SSHes in.