manage.py watch re-reads and regex-scans Codex's 2.5 MB extension.js every 5 s even when the result is 'unsupported' (about 5% CPU steady on every Linux workspace)
adom/codex 0.1.38 (runtime manage.py watch) · Codex extension openai.chatgpt 26.1111.21308 (linux-x64) · code-server 4.124.2 · Linux Hydrogen 1.0.756-4 workspaces (Ubuntu 24.04 nspawn), hl-ubuntu and m5-ubuntu
What I saw. manage.py watch uses CPU all the time on every Linux Hydrogen workspace, for nothing:
| Box | Elapsed | CPU time | Average |
|---|---|---|---|
| hl-ubuntu | 11 h 31 min | 28 min 33 s | about 4% |
| m5-ubuntu | 13 h 21 min | about 42 min | 5.3% (ps) |
On m5-ubuntu, top was also reported at about 90% at a glance. That's either a spike during a round or a newer spin, and it needs a 15 s sample to tell (see the end).
Why (measured on hl-ubuntu). Every 5 s, watch() runs reconcile() and Guard.check(). One reconcile() costs 0.31 s of CPU (resource.getrusage, run as adom inside the workspace), which works out to about 6% steady:
patch()reads the whole 2.5 MB minifiedout/extension.jsand runs the backreferencing regex(?P<w>[\w$]+)\.html=await this\.getWebviewContent\((?P=w)\),...over all of it.- It does this before checking
JS_BEGIN in text, and even when the answer can't change. On 26.1111.21308 the answer is alwaysstate: unsupported, "Renderer startup changed upstream; renderer left intact", and the tour hook is "unsupported" too. - It also globs and reads every
webview/assets/*.cssand writesstatus.jsoneach round.
Ask.
- Remember each extension folder's result by (path, mtime of
package.jsonand of the entry file). Only re-read and re-scan a folder when it changes. An unchanged Codex then costs astat()per round instead of 2.5 MB of regex. - Skip the regex entirely once a build is known
unsupported(same key), and writestatus.jsononly when the result changes. - Optionally, a longer round when nothing changed (30 to 60 s). Codex updates are rare, and the guard's own checks are already rate-limited by REFRESH_S and ENGINE_REFRESH_S.
To tell the m5-ubuntu 90% apart from the 5% average, one sample from the box is enough: top -b -d 5 -n 3 -p <watch pid>, plus the last 30 lines of ~/.local/state/adom/codex-integration/watch.log.