Fixed
- read: overlay/FUSE stat() race —
read_file_lossynow opens the file first and usesfstat()on
the file descriptor instead of a separatestat()syscall. Fixes sporadic "No such file or directory"
errors in Docker overlay/FUSE filesystems (e.g. Codex sandboxes) wherestat()can return ENOENT
for files that exist. Adds a single retry with 50 ms backoff on NotFound before giving up.
Added
- Native Windows daemon support — IPC abstraction layer — New
ipc/module (mod.rs,process.rs,unix.rs,windows.rs) provides a platform-independent daemon transport layer. Unix uses UDS (unchanged behavior), Windows uses Named Pipes (\\.\pipe\lean-ctx-{hash}). All OS-specific code (libc::kill,PermissionsExt,UnixStream) is now isolated inipc/unix.rsandipc/windows.rs— no other module needs#[cfg(unix)]for daemon logic.windows-sys0.59 added as target dependency. Implements #209. - HTTP-based daemon shutdown — New
POST /v1/shutdownendpoint enables cross-platform graceful daemon shutdown.stop_daemon()now tries HTTP shutdown first, thenSIGTERM/TerminateProcessas fallback, then force kill as last resort. No more directlibc::kill(SIGTERM)indaemon.rs. build_app_router()extraction — Shared Axum router construction extracted fromserve()andserve_uds(), eliminating ~70 lines of code duplication. Both TCP (serve()) and IPC (serve_ipc()) use the same router builder.- Parallel call graph build with progress tracking —
CallGraph::build_parallel()uses rayon for concurrent file analysis. Newget_or_start_build()returns cached results immediately or starts a background build with live progress (BuildProgressstruct withfiles_total,files_done,edges_found). Dashboard polls via/api/call-graph/status. - Dashboard: call graph progress bar —
cockpit-graph.jsshows a live progress bar during call graph builds instead of a blank loading state. Auto-polls every 2s and renders the completed graph once ready. - Dashboard: project file browser in Compression Lab —
cockpit-compression.jsnow has two tabs: "Recent" (context ledger/events) and "Project" (all indexed files from/api/graph-files). Project tab includes search, file count, and token count per file. New/api/graph-filesAPI endpoint returns indexed files sorted by token count. - Dashboard: improved compression lab layout — Sidebar/main grid layout with responsive breakpoint at 900px. File list shows token counts, mode auto-switches when selecting recently read files, search input for project files.
Fixed
- 100% CPU after
lean-ctx setupon Ubuntu — Two root causes fixed: (1)env.shself-heal script could recursively spawnlean-ctx initviaBASH_ENVoutside containers. Now guarded with container detection (/.dockerenv), recursion guard (_LEAN_CTX_HEAL), andLEAN_CTX_ACTIVEpropagation. (2) Graph index scanning could scan entire$HOMEwhensetupwas run outside a project. Now guarded withis_safe_scan_root()check, cross-process lock (startup_guard), 50k entry limit, and 2-minute timeout.LEAN_CTX_NO_INDEXenv var skips indexing entirely. Fixes #210. daemon.rs/daemon_client.rsnow platform-independent — Removed all#[cfg(unix)]gates fromlib.rs,cli/dispatch.rs, andsetup.rsfor daemon modules.daemon_client.rsauto-start works on all platforms (previously returnedNoneon non-Unix).- Dashboard call graph timeout — Increased from 15s/30s to 60s to accommodate larger projects during initial build.
Changed
serve_uds()replaced byserve_ipc()— Takes aDaemonAddrenum instead of aPathBuf. Callers usedaemon::daemon_addr()instead ofdaemon::daemon_socket_path().daemon_socket_path()removed — Replaced bydaemon::daemon_addr()which returns aDaemonAddrenum. All call sites updated (setup.rs,dispatch.rs).- Security hardening test updated —
uds_socket_sets_permissionsnow checksipc/unix.rsinstead ofhttp_server/mod.rs(chmod 600 logic moved during IPC extraction).
Upgrade
lean-ctx update # recommended (auto-downloads + refreshes shell hooks)
cargo install lean-ctx # or
npm update -g lean-ctx-bin # or
brew upgrade lean-ctxNote: After upgrading via cargo/npm/brew, run
lean-ctx setupto refresh shell aliases.lean-ctx updatedoes this automatically.
Full Changelog: v3.5.22...v3.5.22