Repository navigation
Description
Summary
CodeGraph 1.6.2, currently reported as the latest release, still intermittently times out in Codex Desktop on Windows 11 on an indexed Java project of only about 3,058 files / 88k nodes / 212k edges (430 MiB SQLite database).
This is a follow-up to #1227, whose closing comment asks for another report if it still occurs on 1.6.2. It also appears relevant to the unreleased fixes for #2571 / merged #2575 and #2620 / #2804. I am not claiming to have reproduced this on current main.
Could you confirm the supported workaround or prerelease containing those fixes, and include the fixes in the next release? A stable release would be preferable to maintaining installation patches.
Environment
- CodeGraph standalone Windows bundle: 1.6.2;
codegraph upgrade --checksays latest is 1.6.2 on 2026-11-13. - Windows 11 x64, build 26100; PowerShell 7.6.9.
- Bundled Node v24.16.0, SQLite 3.53.0; native
node:sqlite, WAL. - 12 logical CPUs, about 24 GiB RAM.
- MCP:
codegraph serve --mcp, shared per-project daemon, default query-pool cap logged as 11. - Primarily Java; private source/index cannot be published. No database or project source is attached.
Observations and reproduction pattern
- Keep an indexed Java repository open in several Codex chats during normal editing / watcher synchronization.
- Use
codegraph_explorewith a few class names and the defaultmaxFiles(not just one file). - Intermittently the request spends more than the 45-second soft deadline without returning source. Retries can also time out. Narrow queries often work, and the same query can be fast later.
The input used for a current diagnostic was three exact Java class names, roughly 100 characters total. The private identifiers are withheld. This is not a multi-kilobyte prompt-hook input. A generic query such as schedule runtime task transport execution was also tested as a control.
Measurements from this machine (not a controlled public benchmark):
- Before any local patches, a six-request MCP wave with
maxFiles: 1returned one result in ~9.5 s; the other five returned busy guidance after ~116 s. The busy message said 109 s, longer than the configured 45 s, suggesting the timer/main loop also suffered delays. - After the local patches described below, six-request waves temporarily succeeded (5.6-13.9 s; a wave during a one-file watcher sync took 19.3-20.7 s), but the failure recurred.
- Today a three-class query with default
maxFilesagain reached its deadline (~47.2 s end-to-end). - Running that query directly through
ToolHandler.executeReadTool, without the pool deadline, completed in 117.6 s. It produced about 20k characters / 4 source files, so the answer itself was not huge. - A later control loading the saved original, unmodified v1.6.2 ToolHandler, with a normal writable
CodeGraph.openSyncand no query pool, completed the same three-class query in 1.9 s; the generic five-word query took 15.2 s. Thus this is intermittent / affected by database and system state. That original-code control did not reproduce the slow case, and I do not want to present it as doing so.
Per-statement timing of the 117.6-second diagnostic
The diagnostic wrapped SQLite statement get / all / run calls; 476 calls accounted for ~116.5 s. Largest statements:
| Statement | Wall time |
|---|---|
FTS search for the prefix schedule, joining nodes_fts.id = nodes.id and ordering by weighted bm25 |
38.4 s |
getDominantFile: edges joined to nodes twice, same-file filter, GROUP BY file, top 20 |
29.9 s |
Edges with source and target IN json_each ID sets and a kind filter |
10.5 s |
| Edge counts grouped by kind | 8.2 s |
| Node/edge/file COUNT subqueries | 6.7 s |
| LIKE fallback for one term | 5.9 s |
This is consistent with a slow SQL path rather than only waiting in the pool, but I have not established a single root cause. The machine was also doing development work, so these are wall times, not isolated CPU benchmarks.
sqlite_stat1 still contained older estimates (e.g. ~73k nodes / ~168k edges vs actual ~88k / ~212k). I have not yet isolated whether sampled statistics, concurrent sync/index rebuilding, cache state, or storage contention is the decisive trigger.
Sanitized daemon log excerpts
[2026-11-13T01:52:37.025Z] [CodeGraph] Main thread unresponsive for ~60s ...
[2026-11-13T01:58:26.744Z] [CodeGraph MCP] Query pool: up to 11 worker thread(s) for concurrent reads.
[2026-11-13T02:18:07.587Z] [CodeGraph MCP] Auto-synced 9 file(s) in 69045ms
[2026-11-13T04:30:17.991Z] [CodeGraph MCP] Auto-synced 22 file(s) in 64188ms
At the latest check daemon.pid and writer.pid agreed on a live daemon with ready:true. This is different from the never-ready writer state in #2918. The daemon log did not contain per-query timings, hence the separate SQL instrumentation.
Disclosure: local troubleshooting patches
The original busy behavior occurred before these patches. The 47.2-second recurrence and 117.6-second SQL trace were collected after applying them; please do not treat those as a clean upstream-only reproduction:
- Retire an executing query worker after its deadline rather than only replying busy while it continues occupying capacity; remove expired queued jobs. This introduces a local explicit execution-deadline error instead of upstream's success-shaped busy text.
- Open query-worker default and cross-project connections with
readOnly: true. The installed worker callsopenSync(root)without that flag, despite its read-only design comment; writable opens can enter migrations/repair/maintenance.
Neither patch changes FTS SQL, dominant-file SQL, search ranking, or result limits. Both have backups and focused recovery/connection tests. They improved recovery but did not solve the recurring latency.
Questions
- Do merged fix(explore): pin the dominant-file aggregation to an edges-first plan (#2571) #2575 / fix(explore): a long query, like a pasted log, answers in seconds on a large index #2804 cover this released-1.6.2 failure pattern, and is there a supported containing prerelease?
- Should query workers always open read-only, including cross-project opens?
- Can the daemon expose queue wait, worker startup/execution time, and sync overlap separately, so the busy message does not imply a healthy queue when execution is slow?
- Can a timed-out executing worker be safely cancelled/recycled, so retries do not accumulate behind the same long-running work?
Happy to retest a targeted upstream change. Please let me know which additional sanitized measurements would be most useful.
Additional local experiment (same day)
I also tried a minimal partial backport, not a full main build:
- the two dominant-file joins changed to edges-first
CROSS JOINas in merged fix(explore): pin the dominant-file aggregation to an edges-first plan (#2571) #2575; - only the FTS rowid join from the broader fix(explore): a long query, like a pasted log, answers in seconds on a large index #2804 changes.
The adversarial-statistics regression check now selects edges as the outer loop and returns the expected file ranking; comparisons of old/new public searchNodes on the real index preserve results and scores for kind/language filters and offset. The complete #2804 memory-search changes were not backported.
After restarting the daemon to load those changes, the cold three-symbol MCP request still hit the deadline at 45.7 s. A separately instrumented worker also timed out; in that trace the edges-between-ID-sets SQL alone took about 32.1 s, while the dominant-file step was about 0.75 s. Therefore I am not claiming the partial backport fixes the incident, or that full current main has the same failure. The remaining issue needs a containing upstream build / a more controlled reproduction of sync and query overlap.
Retest of the complete official main build (2026-11-13)
I have now switched to a clean checkout of official main at f72c9d2, with no local source patches carried over. Full TypeScript/viewer/assets build and a native Windows kernel build succeeded. Runtime is Node v24.22.1, as pinned by main's bundle script. The previous installation and a consistent index backup were retained.
I also rebuilt the index using this build (schema 16, extraction version 28): 3,067 files / 96,719 nodes / 242,142 edges. Therefore this retest changes the engine, Node runtime, and index together; it does not isolate one of those as the root cause.
Results:
- Seven relevant upstream test files: 95 passed, 1 skipped (query pool, dominant-file plan, long explore, SQLite backend, lazy loading, native kernel contract and node IDs).
- A fresh MCP connection, three concurrent full/default-range queries per wave, three waves: 9/9 succeeded, 173-2203 ms.
- Three more waves of six concurrent full/default-range MCP queries while one writer repeatedly changed 20 temporary Java files: 18/18 succeeded, 1583-5015 ms. The daemon log confirms those 20-file syncs took around 10-12 s, so queries did not have to wait for the whole sync.
- A later probe query returned the latest edit; the temporary files were then removed and their removal was synchronized.
- The already-open Codex chat also returned a normal answer after reconnecting. There was one transient internal-function error during the installation/daemon transition; its retry succeeded in 729 ms. The fresh-connection checks above had no errors.
The 45-second execution timeout has not recurred in these controlled checks of full main. This is encouraging, but short-term testing is not proof of long-term stability, and the currently published release remains 1.6.2. I am leaving this issue open for maintainer guidance / a containing release rather than claiming released 1.6.2 is fixed.
Activity
shenyiheyi commentedon Nov 16, 2026
Follow-up: the intermittent 45s busy timeouts recurred on Windows on Nov 16 with the unmodified main build
f72c9d2efb14454ff4f9fd7b8460abd82f19a287. The earlier short warm-cache tests therefore did not establish a lasting resolution.Additional live evidence before restarting:
Local mitigation: moved this project's index to NVMe through a Windows directory junction, retained the complete HDD directory for rollback, and left upstream code/configuration unchanged. SQLite quick_check passed. After restarting the daemon, the first MCP call completed in 15.6s; 18 subsequent full/default-scope calls in waves of six all passed in 0.26–3.81s. Previously failing inputs also succeeded during watcher sync. One-file sync took 33.8s initially and 10.0s on the next edit, so indexing remains relatively expensive.
Please keep this issue open: this is a storage/cache mitigation with bounded verification, not a demonstrated upstream fix. The generic busy response can mask slow SQL execution; distinguishing time spent queued, executing SQL, starting a worker, and waiting for freshness would make this failure much easier to diagnose.
colbymchenry commentedon Nov 17, 2026
Thanks for the very thorough diagnostics. 1.6.3 is out as of today (2026-11-17). It contains everything up to the main commit you tested (f72c9d2), so it includes #2575 and #2804, which you asked about.
Here, on an SSD with a 72k-node Java index (an 1,857-file elasticsearch subset), a cold explore of three class names takes about 1.6 s on 1.6.3 and 3.0 s on 1.6.2. Since your timeouts went away once the index moved from the HDD to NVMe, could you tell us whether they come back on 1.6.3 with the index on the SSD? If they do, the daemon.log lines around a timeout and the free RAM at that moment would help most. To upgrade:
codegraph upgrade(ornpm install -g @colbymchenry/codegraph@latest), thencodegraph indexin the project.shenyiheyi commentedon Nov 18, 2026
Thanks. Retested on Nov 18 with the official 1.6.3 Windows x64 release bundle, verified against the release SHA256SUMS, with no source patches. Bundled Node is v24.22.1. The index remains on NVMe via the same directory junction.
I ran
codegraph indexas requested: it rebuilt 3,167 files / 100,873 nodes / 252,753 edges in 2m13s.codegraph status --strictexits 0 and says the index is up to date. The running daemon reports 1.6.3, and its ready writer lock names the same PID.Results:
quick_checkisok; the original index and installation are retained for rollback. Approximately 3–3.6 GiB RAM was available at the sampled points during these checks.The 45s timeout has not recurred in these bounded checks of 1.6.3 on SSD. I am not claiming long-term resolution from another short test. If it recurs during ordinary use, I will attach the nearby sanitized daemon log lines and available RAM as requested. Keeping the issue open for that observation period would be helpful.
colbymchenry commentedon Nov 30, 2026
Thanks for the careful retests. Closing this as fixed.
Please upgrade to 1.6.6:
codegraph upgrade, thencodegraph indexin the project. Since you are on PowerShell 7, run this one upgrade from Windows PowerShell orcmd. The fix that makescodegraph upgradework from PowerShell 7 is in the version you are upgrading to.If a timeout comes back on 1.6.6, please reopen this with the
daemon.loglines around it and the free RAM at that moment.Update on the other three things you asked about. Two of them are merged in #3548 and will be in the next release:
projectPath. You were right about the writable open: a worker that started while the writer was inside a bulk load rebuilt the search table itself.daemon.logalso gets a line for any call slower than ten seconds, with the time it waited and the time it ran, and one when a call finishes after its caller stopped waiting.The third, recycling a worker that is past its deadline, is left out on purpose. A worker thread that ends at the wrong moment can take the whole process down on Windows, a worker inside one long SQLite statement cannot be stopped until the statement returns, and a replacement started meanwhile adds load to the same slow disk. Queued calls whose caller was already answered are skipped, as before. If the new log lines show calls piling up behind slow ones, a worker that checks the clock between steps and stops itself would be the safer form.
One limit remains: an index on a hard disk with little free memory, where your slowest traces came from, is not something we have been able to test.
fix(mcp): query workers read without repairing, and a "busy" answer s…