Codex usage collector rereads GB of history and saturates CPU
System details
Intel Core Ultra 7 165U (14 logical CPUs), Intel Meteor Lake-P graphics, Omarchy 4.0.4-1, Linux 7.2.5-3-omarchy.
What's wrong?
omarchy-agent-usage-codex can saturate one CPU core for several minutes and make the desktop lag when Codex/Pi session history is large. The stock agents widget starts a normal collection immediately (triggeredOnStart: true) and repeats it on every refresh. A normal collection only reuses the local scan cache for 20 seconds, so each 15-minute refresh can walk the session history again.
Observed session data sizes:
~/.pi/agent/sessions: 409 MB~/.omp/agent/sessions: 1.1 GB~/.codex/sessions: 4.7 GB
Observed during one stock collector run:
omarchy-agent-usage-codex: 98-99% CPU for more than 3 minutes- process I/O counters: about 5.9 GB
rcharand 546k read syscalls - system load: 13-17; desktop visibly laggy
- memory pressure: zero; CPU temperature: 56 C
After terminating the collector, the machine returned to 98% idle. The configured widget is a user clone of omarchy.agents, but its Main.qml is byte-for-byte identical to the packaged stock plugin, and the heavy process is the packaged /usr/share/omarchy/bin/omarchy-agent-usage-codex collector.
Steps to reproduce:
- Accumulate several GB of Codex/Pi/OMP JSONL session history.
- Enable the stock
omarchy.agentswidget, or runomarchy-agent-usage-codexdirectly after its 20-second cache window expires. - Observe the collector consuming one core while recursively scanning/parsing session files for minutes.
- Wait for the widget's normal refresh interval; the full scan happens again.
Relevant implementation details in 4.0.4-1:
SCAN_REUSE_SECONDS = 20scan_pi_sessions()runsrgacross all Pi and OMP session roots without a date cutoff.scan_native_codex_sessions()opens and parses every JSONL file modified in the last 30 days.- The normal widget timer calls
runUpdate("normal"), including at startup.
Expected: periodic usage refresh should not rescan gigabytes of unchanged history or degrade desktop responsiveness. Possible approaches: incremental per-file caching keyed by mtime/size, a longer-lived aggregate cache with only changed files rescanned, or running scheduled refreshes at low CPU/I/O priority while keeping an explicit force refresh.
#14049 has merged into quattro and caches totals for unchanged native Codex rollout files, covering that part of the repeated full-history scan. Pi/OMP history still goes through an rg scan on each collection, and changed native files are still read in full. This broader performance report therefore stays open for the remaining cost; #12336 separately proposes append-only native scanning.
Closure scope checked by GPT-6 in Codex and Codex Medium against the reports and landed source. The second opinion agreed; independence is not guaranteed. No runtime tests were rerun for this reconciliation.
Measured what is left of this on current quattro (defbf90e), on a credential-free Omarchy worker with synthetic history in a temporary home: 491 MB of pi sessions and 383 MB of native Codex rollouts.
- A refresh with nothing changed still takes 2.45 s of CPU, and 2.33 s of that is
scan_pi_sessions()(bin/omarchy-agent-usage-codex:255). It runsrgover every pi and omp session root with no date cutoff and no per-file reuse, then decodes each match twice in Python. Its cost grows with the size of the pi/omp history, so the 1.5 GB in this report still gets rescanned on every 15-minute refresh. - Native rollouts are no longer the problem. Unchanged files replay the totals cached by #14049, and re-reading a changed 100 MB rollout in full took 0.19 s.
- #12336, at its current head f295191f, resumes a growing rollout from where the last read stopped. It does not touch
scan_pi_sessions(), and on the same data the unchanged refresh took the same time (2.46 s, of which 2.41 s was the pi scan). It covers part of this issue, not all of it, so I have not linked it as fixing this one. - The OpenCode database query (
:395) also runs over all history on each refresh. I did not measure it here.
I have not opened a fix. Pi sessions are left out of the per-file cache on purpose (:589): a forked session repeats its parent's messages, and messages are deduplicated, and sessions assigned to an owner, across the whole tree at once (:294, :337). Per-file totals therefore cannot simply be added up. Making that scan incremental means deciding what to cache per file and rebuilding the deduplication from it. That is a design decision for the maintainer.
These timings come from synthetic data with no forks and half of all pi lines matching. They show which part of the collector scales with history, not how many minutes a real machine spends. Codex Medium reviewed the source and the measurements as a second opinion and reached the same conclusions; independence is not guaranteed. This waits on the maintainer: whether #12336 should land, and how the pi/omp scan should become incremental.
Additional installed-release evidence from Omarchy 4.0.6-1 (2026-10-23):
- Intel i9-12900HX, 16 GiB RAM, Intel UHD + RTX 4060 laptop, Linux 7.2.11-arch1-1; Hyprland 0.56.2-4.1 and Quickshell 0.3.2.r7.g2b4501a-1.
- The stock
omarchy.agentswidget is enabled. Its default refresh interval is 900 seconds. - The packaged
/usr/bin/python3 /usr/share/omarchy/bin/omarchy-agent-usage-codexprocess was still running about nine minutes after launch, withpsreporting roughly 90–92% CPU. These are process lifetime observations, not a controlled benchmark. - A later
/proc/PID/ioread showedrchar=21362640903,read_bytes=16835837952, andsyscr=2361044: about 21.36 GB passed through reads and 16.84 GB charged as storage reads. These counters do not establish how much unique session data exists. - The process subsequently exited on its own. No collector termination or priority change succeeded; an attempted priority adjustment found it had already exited.
The installed collector still uses SCAN_REUSE_SECONDS = 20. Its native-session scan recursively selects JSONL files modified in the last 30 days, then opens each selected file and calls json.loads on every line. The installed collector SHA256 is 821f627f1be5ac691f70885060d0b2b65a14972162f82962e7a5575badaf39dd.
I read the notes above about #14049 on current quattro; this observation concerns the installed 4.0.6-1 artifact and is not a claim that the newer caching patch regressed. It supports getting the applicable caching improvements into the installed release and bounding background collection cost on large histories.
Both external-mouse and touchpad stutter were reported during this session, but the laptop was later found to be on battery at 8%. No controlled A/B test isolated the collector from battery/power or graphics behavior. Please treat the CPU/read-volume evidence as confirmed and the pointer-lag relationship as unproven. No private transcripts or raw diagnostic logs are included.
The 4.0.6-1 observation above is from a collector without #14049's cache. The SHA256 quoted matches bin/omarchy-agent-usage-codex at the v4.0.6 tag exactly, and #14049's merge commit (75250d37) is not an ancestor of v4.0.6. It first ships in v4.5.0-rc1. So on 4.0.6 every refresh still reopens and parses every native Codex rollout from the last 30 days, which matches the read volume reported.
What is left on quattro after #14049 is the pi/omp rg scan and the OpenCode query, both of which read all history on every refresh. Open #15906 makes both incremental: unchanged pi/omp sessions are not reopened, grown ones resume from a stored offset, and OpenCode rows are reparsed only when time_updated moves. Fork deduplication still runs over the whole tree, from per-message entries kept in the index rather than per-file totals. It is already linked to close this issue. Once both are in, the remaining full read is a native rollout that changed since the last refresh. #12336 proposes resuming those from an offset. My earlier measurement put a changed 100 MB rollout at 0.19 s.
Checked: the release tags against the reported hash and #14049, open pull requests touching the collector, and #15906's diff against the scans this issue describes. Nothing was run for this update. Codex Medium reviewed the same as a second opinion and agreed. It added the point about changed native rollouts. Independence is not guaranteed. This waits on the maintainer: merging #15906, and whether #12336 should land.
More numbers from current quattro. Since #14040 the pi/omp scan runs once per collector, so its cost grows with the number of collectors.
The installed agents plugin and every omarchy-agent-usage-* script are byte-identical to quattro at 4601078a. The machine is a 20-core aarch64 laptop with home on btrfs (zstd) on a USB SSD. ~/.omp/agent/sessions holds 25 GB in 86k files, 21 GB of it in the 39k .jsonl files the scan reads.
One periodic refresh of the stock widget takes 89 s and 634 CPU-seconds, measured as quickshell's cutime+cstime before and after. That is about 7 of the 20 cores for the whole run, every 15 minutes.
#14040 moved scan_pi_sessions() into shell/plugins/agents/collectors.py. 17 collectors call it now, and each runs its own rg over the pi/omp session roots. With SCAN_REUSE_SECONDS = 20, every periodic refresh pays all 17 passes. Even a collector with no usage pays the full pass: omarchy-agent-usage-deepseek alone takes 5.8 s and 20 CPU-seconds here (8 s user, 12 s sys). Turning off the five providers I never used (deepseek, devin, kimchi, minimax, vibe) brings the refresh down to 529 CPU-seconds and 82 s.
The same 17 collectors share scan_opencode() too. I have no OpenCode database, so none of these numbers include it.
#15906 makes the Claude and Codex pi/omp scans incremental. It was written when scan_pi_sessions() still lived in the Codex collector, though, and it now conflicts with quattro. If the per-file index lands in the shared scan_pi_sessions() when it's rebased, all 17 collectors get it.
Confirmed severe periodic desktop/game slowdowns on the packaged Omarchy 4.5.0rc2-1 build. This is not just a long-running collector on an older release.
Reproduced after removing the custom widget and enabling stock: the first two recorded bursts below used a user clone, igorw.agents, calling the packaged collectors. To rule that out, we deleted the clone and enabled omarchy.agents with a configuration containing only {"id":"omarchy.agents"}. The same slowdown and collector/search/reclaim pattern recurred at 21:31 UTC. The custom clone was absent and the first-party stock widget was verified enabled.
Environment: x86_64 desktop, 16 logical CPUs, 32 GiB RAM, AMD Radeon RX 9070-series GPU. pacman -Qo attributes bin/omarchy-agent-usage-update, shell/plugins/agents/collectors.py and shell/plugins/agents/Main.qml to that package. pacman -Qkk omarchy reports 2,307 files and 0 altered files.
We recorded per-process CPU deltas from /proc/PID/stat approximately once per second while investigating intermittent slowdowns. Two matching search bursts occurred on 2026-10-30 at 20:55:25 UTC and 21:10:26 UTC, about 15 minutes apart. The user reported another major slowdown during the second burst while playing a Proton game. Similar slowdowns had also occurred outside the game before recording began.
At 21:10:28 UTC:
| Process group | CPU, where 100% is one logical CPU |
|---|---|
rg processes combined |
762.6% |
omarchy-agent-u processes combined, Linux's truncated comm name |
74.1% |
kswapd0 |
91.3% |
Game process (GameThread) |
368.0% |
The earlier 20:55 burst reached about 750% combined rg CPU. During the later burst, kswapd0 reached about 95%, and the one-minute load average reached 21.74. Memory reclaim activity is observed; these samples do not establish how much swapping or storage I/O occurred.
After switching to the clean stock widget, the user reported the slowdown again. At 21:31:03 UTC, combined rg CPU was 332.9%, omarchy-agent-u was 74.2%, and kswapd0 was 93.9%, alongside the game at 424.3%. The one-minute load average subsequently reached 20.98. This establishes that the custom clone is not necessary to reproduce the behaviour. The widget has now been disabled again, and recording continues to check whether further slowdowns occur without its periodic refresh.
The installed implementation matches the timing and process pattern:
Main.qmldefaultsrefreshIntervalSecto 900 and runs the repeating timer regardless of whether the panel is open.omarchy-agent-usage-updatebackgrounds all selected provider collectors together, then waits for them.SCAN_REUSE_SECONDS = 20, so a normal 15-minute refresh cannot reuse that scan cache.- Shared
scan_pi_sessions()launchesrg --no-ignore --hiddenwithout an explicit thread limit. It performs provider-specific searches over session roots and further passes for matching events and fork relationships.
This adds installed-release evidence for the multi-collector amplification described above, including a reproduction with the clean stock widget: periodic usage collection coincides with multi-core search bursts and memory reclaim alongside a running game. The timing and source inspection strongly implicate the refresh. We did not capture the exited search processes' full argv or parent chains, and the disabled-widget observation is still in progress.
Expected: automatic usage-stat collection should have bounded background resource cost and should not periodically stall unrelated desktop work or games. No private session contents or raw diagnostic logs are attached.
Additional 4.5.0rc2 evidence: periodic Deadlock hitches, with a disable-only comparison
Reporting another affected installed-release machine, with permission from its owner. This report was prepared with an AI assistant from live telemetry and installed source; no private transcripts, account data, IP addresses, or raw system-debug logs are included.
Environment
omarchy 4.5.0rc2-1, RC package repositories.- AMD Ryzen 7 9800X3D (8 cores / 16 logical CPUs), 64 GiB installed RAM (about 60.5 GiB usable), Radeon RX 9070 XT.
- Kernel
7.2.8-9-omarchy; Hyprland0.56.2-4; Mesa / RADV26.2.5. - Deadlock through Proton Experimental, fullscreen 1920x1080, without Gamescope during this recording.
- Stock first-party
omarchy.agentsenabled initially. The separate third-partyakitaonrails.ai-usagebarwas also enabled and was left enabled throughout the comparison.
Observed periodic events
A read-only background sampler recorded /proc/stat, CPU/I/O/memory PSI totals, game/thread CPU deltas, GPU sysfs metrics, and gateway/internet ping results about once per second. The player reported a smaller hitch near the first event and a large hitch near the third; the middle event was found in telemetry. All times below are 2026-10-31, UTC-04:00.
| Sample time | Overall CPU busy | CPU PSI some delta, ms |
Game CPU, % of one logical CPU | GPU busy |
|---|---|---|---|---|
| 18:40:36.233, widget enabled | 69% | 466 | 272% | 21% |
| 18:55:36.289, widget enabled | 76% | 463 | 305% | 17% |
| 19:10:35.307, immediately before third event | 35% | 7 | 539% | 85% |
| 19:10:36.314, third event | 77% | 502 | 323% | 23% |
| 19:25:36.200, widget disabled | 38% | 10 | 555% | 85% |
| 19:40:36.197, widget disabled | 40% | 9 | 533% | 83% |
The first three bursts are 900 seconds apart to the sampler's precision. The PSI values are deltas of the system-wide cumulative some total counter over approximately one second: they are not measurements of individual frame or freeze duration.
At the third event, agent usage JSON files had modification times at 19:10:36-37. For example, codex.json was written at 19:10:37.052639398 and openrouter.json at 19:10:37.133674017. The other provider records were also written in that interval.
Gateway/internet probes remained steady at that event, with no recorded packet loss. No GPU reset, timeout, OOM, or hardware-error entry appeared in the bounded kernel-log check around it. kswapd0 activity accompanied the earlier event; reclaim was much smaller at the third, so this is not presented as proof of RAM exhaustion. Unrelated Steam bus-lock warnings occur outside the bursts too and were not used to attribute this issue.
Disable-only comparison, without interrupting the game
At approximately 19:14, ran:
omarchy plugin disable omarchy.agents
Runtime plugin listing then showed omarchy.agents disabled and the third-party usage bar still enabled. Neither Deadlock nor Quickshell was restarted; their PIDs remained unchanged, and recording continued against the same game PID.
Both subsequent expected burst windows, 19:25:36 and 19:40:36, had ordinary CPU pressure and GPU utilization instead of the earlier spike pattern, including the surrounding seconds. Game CPU activity at those windows was comparable to the pre-hitch active-game baseline. The last checked agent-record writes were around 19:14:19, with no further writes at those expected refresh windows.
This supports the stock widget's periodic collection as the trigger for the measured recurring stalls. It does not identify a particular provider collector as the sole cause or establish that every possible game hitch has been eliminated. No re-enable/force-refresh test was run because the player was in live matches.
Installed implementation
Both files are owned by omarchy 4.5.0rc2-1:
shell/plugins/agents/Main.qml:125,148-153: defaultrefreshIntervalSecis 900; the repeating timer callsrunUpdate("normal")when not near a limit.bin/omarchy-agent-usage-update:66-78: launches every selected provider collector using background jobs, then waits for them.
Installed SHA256s:
5811977c29f2068f7941fc722441823eceef9f8995b3448da5d7bcb763749c32 shell/plugins/agents/Main.qml
1bdca3e3797c80ca2cbd2601fe457bb10a134dd12b126a2fcface30f07f34e1e bin/omarchy-agent-usage-update
The one-second process sampler did not retain short-lived collectors' complete argv/parent chains or frame-time traces. The timings, matching record writes, installed scheduling code, and two missing bursts after disabling only the built-in widget are the evidence here. This corroborates the multi-collector gaming-impact report above; it is not a claim that any particular upstream patch has been tested.
Expected: automatic usage-stat refresh should have bounded CPU/I/O concurrency and should not periodically disrupt unrelated real-time workloads. The current local workaround is disabling the built-in Agents plugin while gaming.
The three reports since my last comment hold up against current quattro (175e63b6). That comment said this was waiting on #15906 to merge. That is no longer true.
Since #14040, pi/omp and OpenCode scanning live in shared helpers in shell/plugins/agents/collectors.py, scan_pi_sessions() and scan_opencode(). 17 collectors call both. The scan cache is keyed by collector (scan_cache_paths()), and a normal refresh may reuse it for only 20 s (SCAN_REUSE_SECONDS). Every collector therefore searches the pi/omp session trees again on each refresh, including collectors with no usage. bin/omarchy-agent-usage-update starts every enabled collector at once, and the stock widget enables all 23 providers unless one is switched off. Nothing limits rg's threads or lowers the refresh's CPU or I/O priority. The bursts of several cores of rg every 900 s in the 4.5.0rc2 reports above match this, and v4.5.0-rc2 contains both #14049 and #14040. One correction: "17 passes" is shorthand. Each scan runs more than one search and can stop early in a file, so it is not exactly 17 full reads.
Native Codex rollouts are no longer the problem on quattro. Since #14040 all collectors share one rollout cache under a lock, and a rollout that grew is read from where its record stopped. That covers what #12336 proposed and corrects my earlier point that a changed rollout is read in full.
#15906 is still the open fix linked to this issue, but it no longer merges. It changes the old per-collector functions that #14040 removed, and as I said there on 2026-11-01, it needs to be rebuilt as an index inside the shared helpers so all 17 collectors use it. #16163 is separate. It stops a multi-monitor bar from starting one refresh per monitor, but each refresh still does the work described here.
What was checked: the new comments, and the cache, scan, update script and widget defaults on quattro, by reading only. Nothing was run this time. Codex Medium reviewed the same as a second opinion and agreed. It also found the shared rollout cache and the qualification on "17 passes". Independence is not guaranteed.
This waits on the author of #15906 to port it into the shared helpers. It also waits on the maintainer to decide whether background refreshes should also run fewer collectors at once or at lower priority, since only an index would stop each collector repeating the search.
OpenCode-specific measurements on 4.5.0rc3-1
Adding the OpenCode half of the shared scan, which the comment above says was not measured. This is the same root cause as the pi/omp reports, not a separate bug.
Environment: Omarchy 4.5.0rc3-1, 4 logical CPUs, 16 GB RAM, stock omarchy.agents with all 23 providers enabled, default refreshIntervalSec 900, opencode 2.2.5, ~/.local/share/opencode/opencode.db 742 MB.
Observed at login:
- 100% CPU for about 3.5 minutes, load average 18.69 on 4 cores.
- 23
omarchy-agent-usage-*collectors running, 121 processes total. - 5 overlapping
omarchy-agent-usage-updateruns (4 orphaned tosystemd --user, 1 direct child of quickshell). TheProcess.runningguard inMain.qmldid not prevent re-entry. - One collector's
/proc/PID/io:rchar 18,956,543,148andsyscr 4,616,971— about 19 GB read and 4.6M read syscalls per collector.
Why the OpenCode scan is expensive
shell/plugins/agents/collectors.py in the installed 4.5.0rc3-1:
scan_opencode()at:1191.patterns = [f'%"providerID"%:%"{provider}%' ...]at:1213.gate = " OR ".join("m.data LIKE ?" ...)at:1308and:1330, plus therole/parentIDLIKEpredicates at:1335,:1340,:1358,:1402.
The leading % makes every index unusable, so each collector scans session_message in full (320 MB / 20,270 rows here; event 63 MB, part 25 MB). SCAN_REUSE_SECONDS = 20 (:56) against a 900 s refresh means every periodic refresh pays it again.
Suggested fixes, in order of impact for this path
- Persist
providerID/modelID/rolein indexed columns (SQLite generated columns + indexes) instead ofLIKE '%…%'over the JSON blob. - Run
scan_opencode()once per update and share the rows across collectors (keyed by DB mtime/WAL size), instead of once per collector. - Reuse the scan across periodic refreshes (
max_age = refreshIntervalSec); token totals do not need a 20 s cache. - Cap collector concurrency in
omarchy-agent-usage-update(e.g. 2–4) and add aflockso runs cannot overlap. - Enable only providers that are actually configured by default.
I can test a patch on this machine (742 MB DB, 4 cores) if useful.
Confirming this is still present on 4.5.0 final (omarchy-settings 4.5.0-1), with the pi/omp half of the shared scan.
~/.pi/agent/sessions: ~1,090.jsonlfiles, 3.2 GB (3.1 GB older than 7 days).- On 4.5.0rc2, the codex collector alone took 45–72 s per refresh (~47 s user CPU). A cProfile run put 67 of 72 s in
scan_pi_sessions(); every other collector cost 4–5 s of CPU repeating the same search. collectors.pychanged in 4.5.0 only for #16385 (compressed Codex rollouts);SCAN_REUSE_SECONDSis still 20 andscan_pi_sessions()has no index, so the cost is unchanged.
Workaround in the meantime: omarchy plugin disable omarchy.agents.
Confirming on Omarchy 4.5.0-3. I found another way to trigger this: changing the display layout starts a usage-collector burst immediately, without waiting for the normal refresh interval. I initially suspected the dock or GPU because the desktop became noticeably laggy when moving my monitor to a Dell WD19.
This is a System76 Adder WS with an Intel i7-10875H (16 logical CPUs), Intel UHD graphics and an NVIDIA RTX 2070 Super. The external monitor is 1920×1080 at 60 Hz, connected either directly over HDMI or through the WD19. Versions are Hyprland 0.56.2, Quickshell 0.3.2.r7.g2b4501a-1, NVIDIA 615.78.08, and kernel 7.2.15-1-omarchy.
A five-minute /proc recording sampled CPU usage, process ancestry and DRM connector state every 0.5 seconds. Before changing displays, median whole-machine CPU usage was 3.3%. Two layout changes were followed by CPU saturation:
- At 21:54:39.395, direct HDMI disappeared while I moved the cable to the dock. CPU exceeded 80% at 21:54:40.548, before the dock output became enabled at 21:54:48.610.
- At 21:55:57.916, I disabled the built-in panel while the dock output remained enabled. CPU exceeded 80% at 21:55:58.993 and reached 100% again.
At 21:56:16.629, 17 rg processes collectively used 1418.3% of one logical CPU, approximately 14.2 cores out of 16. Hyprland used only 14.7% of one logical CPU in that sample. Recorded parent chains lead from rg through the usage collectors and omarchy-agent-usage-update to Quickshell. Live command-line inspection identified the Codex and OpenCode collectors searching Pi session JSONL files. After the scans finished, whole-machine CPU usage returned to around 4–5% with the dock display still active and the built-in panel disabled.
For a control, I ran omarchy plugin disable omarchy.agents, then moved the monitor from the dock back to direct HDMI and disabled the built-in panel again. During the approximately 80-second control recording, median CPU usage was 3.0%, the brief peak was 30.1%, and no usage collectors or rg processes appeared. I did not yet repeat the full move back to the dock with the widget disabled, so that part of the control is still untested.
The installed shell/plugins/agents/Main.qml starts a normal collection from a timer with triggeredOnStart: true. Display changes recreating a widget instance would fit these measurements, but I have not verified that lifecycle mechanism. The per-monitor refresh work in #16163 and #17955 looks relevant; I have not tested either PR.
I hope the display-change reproduction and process measurements help narrow this down. The CPU spikes here are usage-accounting work, not heavy rendering by Hyprland.
Same class of problem from the Devin collector on Omarchy 4.5.0-3 (kernel 7.2.15-1-omarchy, AMD Ryzen 7 3750H).
Environment: stock omarchy.agents widget enabled; Devin CLI in use, ~/.local/share/devin/cli/sessions.db is 3.6 GB (5.1 GB total under ~/.local/share/devin/cli/).
Observed: omarchy-agent-usage-devin runs at ~80% CPU for ~40 s per collection, spawned by the agents widget refresh. Process I/O confirms it is reading the full database each time.
Why the Devin collector is hit twice: run_local_scans() in bin/omarchy-agent-usage-devin calls the shared scan_pi_sessions() + scan_opencode() (the pi/omp cost already reported here) and scan_devin_database() → scan_message_nodes(), which runs:
SELECT session_id, created_at, chat_message FROM message_nodes
WHERE chat_message LIKE '%\"metrics\"%'
over the entire message_nodes table, then json.loads on every match. The LIKE is a full scan of a multi-GB table — there is no index or incremental watermark, so every 15-minute refresh reparses everything. The 20 s SCAN_REUSE_SECONDS cache does not help across refreshes.
This makes the Devin collector likely the most expensive of the per-provider collectors on a machine with a large Devin history: it pays the shared pi/omp + OpenCode scan plus its own unbounded sqlite scan.
Possible fixes for this path specifically:
- Incremental scan keyed by
rowid/created_atwatermark persisted in the scan cache. - An FTS5 index or generated column on
chat_messageso the"metrics"prefilter isn't a table scan. - Or skip
chat_message LIKEentirely and scan only rows newer than the cached watermark.
Happy to test a patch if useful.
The new reports identify two database costs that a pi/omp index will leave in place. On quattro at 419a5a709, scan_opencode() still evaluates JSON LIKE filters on every rescan. Devin also calls the shared scans, then separately queries its own message_nodes table for chat_message LIKE '%"metrics"%' and parses every matching row, then reads all of prompt_history (bin/omarchy-agent-usage-devin:137 and :162). Its normal scan cache expires after 20 seconds, so it does not carry an unchanged database across the default 900-second refresh. The reported Devin timings have not been reproduced here.
#18938 now ports pi/omp indexing to the shared helper used by the collectors, and also proposes limiting simultaneous collectors to three per update process; separate update processes can still overlap. It does not change either database scan. #15906 remains linked to this issue, but still conflicts with quattro; its OpenCode indexing would need a port to the current shared helper. Neither PR covers Devin's native database. I have not opened a competing fix: the existing pi/omp work is already in a PR, and the database work needs a cache design that remains correct when records change or disappear, including the session/fork metadata OpenCode uses to assign usage.
For the display-change report, the startup timer and Process.running guard belong to each widget instance; the guard does not coordinate independent instances. That supports investigating #16163 and #17955, but does not establish the exact widget lifecycle during the reported layout changes. Those changes also leave the cost of each individual scan in place.
Checked the four new reports, current source, and the open fix diffs by reading only; no worker tests were run in this update. GPT-6 High in Codex performed this review; Opus 5.5 High and muse-wonder via pi, thinking high checked the source and diffs as second opinions. Both agreed on the uncovered scans and the need to preserve edits, deletions and prompt ownership in a cache. Their independence is not guaranteed.
This waits on the maintainer's review of the open pi/omp and refresh changes, and on a design for the remaining OpenCode and Devin database scans. This issue still has uncovered database work if only pi/omp indexing lands.