Count what the cache holds in the default cache_max_bytes (closes #184) #188

Merged
clawbot merged 4 commits from issue-184-default-cache-limit into next 2026-10-04 19:41:50 +02:00
4 Commits
Author SHA1 Message Date
clawbot 66b0ab17f3 Build the image cache's config from the config in newCacheConfig
check / check (push) Failing after 3s
initImageService built it inline, so the choice between the default
limit, an explicit limit and the disk cache off had no test of its own.
It is now one small function, which the previous commit tests.

Model: opus-5-5
2026-10-04 17:03:22 +00:00
clawbot adbf2f2f0d Test the cache config the handlers build from cache_max_bytes
With cache_max_bytes omitted the cache must work out the default
limit, with an explicit 0 the disk cache must be off, and an explicit
positive value must reach the cache unchanged. newCacheConfig does not
exist yet, so this commit does not compile; the next one adds it.

Model: opus-5-5
2026-10-04 17:03:22 +00:00
clawbot 55ed23d2be Count what the cache holds in the default cache_max_bytes (closes #184)
The default limit was 75% of the space free at startup. The cache's
own files are not free space, so a fuller cache got a smaller limit
after a restart and eviction then deleted most of it. The default is
now 75% of the sum of the free space and what the cache already holds
by its own size accounting, at least 500 MiB. The cache works it out
when it opens, after the database is open, so the computation and its
tests moved from internal/config to internal/imgcache; the config only
records whether cache_max_bytes was set, and the handlers turn the
disk cache off only for an explicit 0.

Model: opus-5-5
2026-10-04 17:03:22 +00:00
clawbot c13cd033a9 Test that the default cache_max_bytes counts what the cache holds
With a fake free-space probe, an empty cache with 4 GiB free gets a
3 GiB default, and the same cache once it holds those 3 GiB, with
1 GiB left free, must keep 3 GiB. The default is still 75% of the
free space alone, so the second check fails: this is the bug in
#184. computeDefaultMaxBytes
only calls the config's existing computation so the test compiles.

Model: opus-5-5
2026-10-04 17:03:22 +00:00