Client or integration
Codex App
Area
Dashboard / Storage / Log Guard
Summary
The first Storage / Log Guard inspection runs four unbounded SQLite aggregates synchronously on the OpenCodex proxy thread.
On a large Codex logs_2.sqlite, opening or refreshing Storage can therefore block routing and health responses until the aggregates finish. The current memoization removes repeated scans only while the database and WAL identity stay unchanged. It does not bound the cold scan, and an active Codex process changes the WAL and invalidates the cache.
Expected: Storage inspection must not block the proxy thread. Expensive metrics should run off-thread, be explicitly bounded, or degrade to file/schema-only metrics above a safe threshold.
Actual: readMetrics performs count(*), two GROUP BY queries and sum(estimated_bytes) synchronously. Both /api/storage and /api/storage/codex-logs call the inspection inline.
Current dev documents the same remaining gap in src/codex/log-guard/inspect.ts: memoization "bounds the repeat cost, not the first one" and the cold scan still blocks.
Reproduction
- Use a Codex
logs_2.sqlite with hundreds of thousands of rows.
- Start an unmodified OpenCodex build.
- Open the Storage page or request
GET /api/storage after the inspection cache is cold or after the WAL changes.
- In parallel, request
/healthz or send a routed model request.
- Observe that the synchronous SQLite aggregates occupy the proxy thread until inspection completes.
Historic live reproduction on OpenCodex 2.26.0:
- database: approximately 1 GB
- rows: approximately 495,000
GROUP BY level: approximately 17,289 ms
- GUI resource deadline: 30 seconds
- filesystem scan itself: under one second across approximately 11,943 files
A local mitigation skipped expensive aggregates when the database exceeded 64 MiB while retaining file size, schema and capability inspection. After that change:
GET /api/storage: 628 ms, then 466 ms
GET /api/storage/codex-logs: 9 ms
GET /healthz: 200
I also ran the unmodified official 2.32.0 inspector in a separate read-only process against the current database:
- database: 1,468,923,904 bytes
- rows: 681,808
- first isolated inspection: 816 ms
- same-process memoized repeat: 0.448 ms
- schema: compatible
The current host file cache was already warm, so 816 ms is not presented as a worst case. The earlier 17.3-second live result and the 49-second large-database measurement documented in the current source show the cold/fragmented case.
Version
2.26.0 for the historic live reproduction. The synchronous cold-scan path remains in the official 2.32.0 package and current dev source (file SHA d2c17192365cad0dae2b678456588a03ae407a61 at the time of filing).
Operating system
Windows 11 Home 25H2, OS build 26200.9168, x64.
Provider and model
Not provider-specific. The defect is in local Storage / SQLite inspection.
Logs or error output
Historic unmodified path:
logs_2.sqlite: ~1 GB
rows: ~495,000
GROUP BY level: ~17,289 ms
/api/storage GUI budget: 30,000 ms
Local bounded mitigation:
large database threshold: 67,108,864 bytes
/api/storage: 628 ms, then 466 ms
/api/storage/codex-logs: 9 ms
/healthz: 200
Official 2.32.0 inspector, separate read-only process:
databaseBytes=1468923904
totalRows=681808
firstElapsedMs=816
memoizedRepeatMs=0.448
schema=compatible
Screenshots and supporting files
No screenshot is needed. The current source comment and query implementation are visible in inspect.ts.
Redacted configuration
{
"storageInspection": "default",
"database": "Codex logs_2.sqlite",
"providers": "<not relevant>"
}
Checks
Client or integration
Codex App
Area
Dashboard / Storage / Log Guard
Summary
The first Storage / Log Guard inspection runs four unbounded SQLite aggregates synchronously on the OpenCodex proxy thread.
On a large Codex
logs_2.sqlite, opening or refreshing Storage can therefore block routing and health responses until the aggregates finish. The current memoization removes repeated scans only while the database and WAL identity stay unchanged. It does not bound the cold scan, and an active Codex process changes the WAL and invalidates the cache.Expected: Storage inspection must not block the proxy thread. Expensive metrics should run off-thread, be explicitly bounded, or degrade to file/schema-only metrics above a safe threshold.
Actual:
readMetricsperformscount(*), twoGROUP BYqueries andsum(estimated_bytes)synchronously. Both/api/storageand/api/storage/codex-logscall the inspection inline.Current
devdocuments the same remaining gap insrc/codex/log-guard/inspect.ts: memoization "bounds the repeat cost, not the first one" and the cold scan still blocks.Reproduction
logs_2.sqlitewith hundreds of thousands of rows.GET /api/storageafter the inspection cache is cold or after the WAL changes./healthzor send a routed model request.Historic live reproduction on OpenCodex 2.26.0:
GROUP BY level: approximately 17,289 msA local mitigation skipped expensive aggregates when the database exceeded 64 MiB while retaining file size, schema and capability inspection. After that change:
GET /api/storage: 628 ms, then 466 msGET /api/storage/codex-logs: 9 msGET /healthz: 200I also ran the unmodified official 2.32.0 inspector in a separate read-only process against the current database:
The current host file cache was already warm, so 816 ms is not presented as a worst case. The earlier 17.3-second live result and the 49-second large-database measurement documented in the current source show the cold/fragmented case.
Version
2.26.0 for the historic live reproduction. The synchronous cold-scan path remains in the official 2.32.0 package and current
devsource (file SHAd2c17192365cad0dae2b678456588a03ae407a61at the time of filing).Operating system
Windows 11 Home 25H2, OS build 26200.9168, x64.
Provider and model
Not provider-specific. The defect is in local Storage / SQLite inspection.
Logs or error output
Screenshots and supporting files
No screenshot is needed. The current source comment and query implementation are visible in
inspect.ts.Redacted configuration
{ "storageInspection": "default", "database": "Codex logs_2.sqlite", "providers": "<not relevant>" }Checks