Skip to content

fix(doctor): avoid slow filepath.Walk on Docker bind mounts#3299

Merged
steveyegge merged 3 commits intogastownhall:mainfrom
JustinThirkell:fix/stale-dolt-port-walk
Mar 27, 2026
Merged

fix(doctor): avoid slow filepath.Walk on Docker bind mounts#3299
steveyegge merged 3 commits intogastownhall:mainfrom
JustinThirkell:fix/stale-dolt-port-walk

Conversation

@JustinThirkell
Copy link
Copy Markdown
Contributor

@JustinThirkell JustinThirkell commented Mar 26, 2026

Summary

I've found that gt doctor hangs for minutes on Docker bind mounts (macOS VirtioFS) because three code paths use filepath.Walk over the entire town root. This PR replaces all three with targeted lookups.

Note: I'm fairly new to Gas Town - the Claude-based reasoning on why it's reasonable to filter the paths walked seems plausible but is the point of least certainty for me.

I fully appreciate this might not be the correct fix, but Gas Town running in docker compose is obviously new-ish (to this repo at least) and this fix really does improve things a lot.

Details

Symptom: gt doctor takes 2+ minutes on Docker containers using macOS VirtioFS bind mounts where the town root contains 180k+ files across nested git repos. This has the appearance of having frozen but it turns out does eventually complete, after a lot of really slow IO!

Root cause: Three filepath.Walk calls traverse the full directory tree. The git directories I could observe contained ~180k+ objects — VirtioFS stat() calls are orders of magnitude slower than native filesystem, so walking these trees dominates runtime.

  1. findPortFiles in stale_dolt_port_check.go — walks the entire town root to find dolt-server.port files. Replaced with known-path enumeration using rigs.json, matching the existing findMetadataFiles pattern.

  2. FindAllLocks in lock.go — walks the full tree to find agent.lock files. Added filepath.SkipDir for .dolt-data, .dolt-backup, and .git directories which never contain agent locks.

  3. StaleSQLServerInfoCheck.Run in stale_sql_server_info_check.go — walks the entire town root to find sql-server.info files inside .dolt directories. Replaced with known-path enumeration using rigs.json + top-level directory scan fallback.

Verification

gt doctor is now completing in seconds instead of minutes inside Docker containers with VirtioFS bind mounts.

…lt-port check

filepath.Walk over the entire town root takes 2+ minutes on Docker bind
mounts (macOS VirtioFS) due to per-entry host roundtrips. Port files
only exist in predictable .beads directories, so enumerate those
directly using the same rig discovery pattern as findMetadataFiles.

Co-Authored-By: Claude
filepath.Walk over the entire town root takes 2+ minutes on Docker bind
mounts (macOS VirtioFS) due to 180k+ files in Dolt storage and git
objects. Skip these directories since they never contain agent locks.

Co-Authored-By: Claude
…l-server-info check

Same fix pattern as stale-dolt-port: enumerate known .beads/dolt/.dolt/
locations via rigs.json + top-level directory scan instead of walking
the entire town root. Eliminates ~40s of IO on Docker bind mounts
(macOS VirtioFS) with 180k+ files.

Co-Authored-By: Claude
@github-actions github-actions bot added the status/needs-triage Inbox — we haven't looked at it yet label Mar 26, 2026
@steveyegge steveyegge merged commit e27a6a8 into gastownhall:main Mar 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status/needs-triage Inbox — we haven't looked at it yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants