aft icon indicating copy to clipboard operation
aft copied to clipboard

Control over aft and indexing

Open stdweird opened this issue 1 week ago • 8 comments

Description

Need tools to report status of aft in more detail; and in the indexing state of individual projects.

  • control: status and possibly restart aft process
  • project indexing report
  • some progress bar based on something real (eg index documents?), so instead of "building" one can actually see progress
  • where the indices are being build, something to inspect them
  • restart indexing of a project forcefully

Use case

After installing aft, opencode was started. indexing was absent, and after running the doctor --fix, onnxruntime download failed with current issues upstream. Added the so files (this is linux) from sourceforge tarball, and now doctor sees onnxruntime (the logfiles also report this).

As opencode was started, the aft process was running in background. Index status was in state "building", but without any cpu usage. Also lsof does not report the onnxruntime so files as loaded by the process, so unclear if this is being picked up or not.

stdweird avatar Nov 23 '26 09:11 stdweird

Thanks for the detailed report, @stdweird.

The failed ONNX Runtime download was Microsoft's GitHub repository for it being unavailable. The next release, 0.67.0, downloads the same 1.24.4 build from Microsoft's official NuGet package instead. After upgrading, run npx @cortexkit/aft doctor --fix and then restart OpenCode.

Why a hand-placed library may not load: AFT only loads an ONNX Runtime library in its own cache folder when the file's bytes match the 1.24.4 build it pins. A library from another tarball can pass doctor's check, because doctor checks only the file name and version, and still be refused by AFT before it's ever loaded. That fits what lsof showed. If you'd rather keep your own copy, put it outside AFT's cache folder and point ORT_DYLIB_PATH at it before starting OpenCode. Separately, we'll make doctor apply the same check as AFT, so it can't report a runtime as compatible when AFT will refuse it.

To tell which state you hit, could you share:

  • the /aft-status lines for "Search index" and "Semantic index", including any stage or error shown;
  • the log lines containing meaning fill failed from the AFT log (~/.local/share/cortexkit/aft/logs/aft-<pid>.log, unless AFT_STORAGE_DIR is set).

On the wider request for more control: /aft-status already shows per-project text and semantic progress (files seen, entries done of total). Indexes for all checkouts of a repository live under ~/.local/share/cortexkit/aft/data/<repository-id>/. A restart command, a progress report covering every project, an index inspector and a forced rebuild of one project don't exist today. We've noted them as a feature request.

aft-alfonso[bot] avatar Nov 23 '26 09:11 aft-alfonso[bot]

  • aft-status does not show any errors, status is building (and then also that the bacend fastembed is and also the name of the embedding model). if the binary so files are not even accepted, not sure what code path could even lead to status building
  • the aft log file does not anywehre even suggest there is an issue with the onnxruntime binaries.
  • before a new release is out, how can i get the 1.24.4 so files from somewhere? any chance the download instructions for the new release are already available?

stdweird avatar Nov 23 '26 10:11 stdweird

@alfonso-aft i managed to extract the 1.24.4 so from a nuget download, and added them. now aft still reports "building", but logs have not-so-useful errors

only warn is

WARN data layer build failed for /project (trying again in 10 s): Index storage is paused: 3.7 GiB is free on this disk and AFT keeps 4.0 GiB free. Unused index data is being cleaned up; retry later.

does this mean aft needs 4GB at least? is this the cause that nothing isgoing on?

stdweird avatar Nov 23 '26 10:11 stdweird

making sure that there is enough space seems to do the trick. a clearer warning message would have been nice.

stdweird avatar Nov 23 '26 11:11 stdweird

Thanks for tracking it down, and you're right: the message should have been clear.

AFT keeps part of the disk free so its indexes can never fill it: 5% of the disk, at least 4 GiB and at most 32 GiB. Below that, it pauses writing index data and retries every few seconds. That pause is what you hit. Showing it only as a log warning while the status still said "building" is our bug. An upcoming release makes /aft-status, the sidebar and the search tool show paused (low disk space) together with the free-space numbers.

Extracting the library from the NuGet package was the right call: AFT 0.67 downloads ONNX Runtime 1.24.4 from that same NuGet package, so doctor --fix works again without the manual step.

The rest of your request (a restart control, progress for every project, an index inspector and a forced rebuild of one project) stays open as a feature request.

aft-alfonso[bot] avatar Nov 23 '26 12:11 aft-alfonso[bot]

0.68.0 is out with the fixes from this thread:

  • When the disk is nearly full, search and status show paused (low disk space) with the free space, instead of building.
  • Status says when meaning search is waiting for the ONNX Runtime download.
  • doctor --fix replaces a cached ONNX Runtime that doesn't match the build AFT pins.
  • The status dialog shows the index store's size, instead of disk sizes that always read 0.

The rest of your request (a restart control, real progress for every project, an index inspector and a forced rebuild of one project) stays open here as a feature request.

aft-alfonso[bot] avatar Nov 26 '26 01:11 aft-alfonso[bot]

@alfonso-aft I don't get why would we have 5% disk space constraint, at least 4 GiB and at most 32 GiB. Technically, I can assign a small and dedicate disk partition to the AFT_STORAGE_DIR. If you wished to have at least 4 GiB free, please make this constraint to be configurable. I currently have 8GiB disk dedicated for AFT_STORAGE_DIR, but aft pauses the index storage and says it want to keep 16GiB free. It's totally unreasonable. AFT only uses 300MiB of the disk in my case. (My use case is set AFT_STORAGE_DIR to only available local disk, i.e., /dev/shm, on the server, it only has 8 GiB size)

henry-hsieh avatar Nov 30 '26 16:11 henry-hsieh

Thanks, you're right, and we're changing it.

AFT keeps 5% of the whole filesystem free, at least 4 GiB and at most 32 GiB. It measures the filesystem's total size, not the space you've set aside for AFT. 16 GiB is 5% of about 320 GiB. On Linux, /dev/shm is a tmpfs whose size defaults to half the machine's memory, so on a large server AFT sees a ~320 GiB filesystem and pauses even though it uses only 300 MiB.

We added that floor to protect our own machines, and it isn't AFT's job to decide how full your disk may get. An upcoming release removes it. AFT will use the space it needs. If a write really fails because the disk is full, AFT cleans up the partial write, reports the index as paused, and resumes once space is free, without damaging what it has already built.

Until that release, you can confirm the numbers AFT sees with:

df -B1 /dev/shm

Size is what the 5% is taken from, and Avail is what AFT compares against it.

aft-alfonso[bot] avatar Nov 30 '26 17:11 aft-alfonso[bot]