alvis 288cb6b36a adolf-llm /usage: CLI-only token refresh (kb#87) + last-good cache fallback
Two related changes to the /usage quota route, committed together because they
are entangled in the same code path.

1. Stop refreshing the Kimi OAuth token from this route (kb#87). Was already
   present as uncommitted working-tree WIP, not authored in this commit's
   session. Kimi rotates the refresh_token on every refresh (single-use), so an
   independent refresh here invalidated the copy the CLI's creds file holds ->
   the CLI's next refresh failed invalid_grant and wiped the whole login (the
   recurring Adolf logout, incl. the 2026-07-17 06:15 wipe / task #86). Removes
   KIMI_OAUTH_HOST, KIMI_CLIENT_ID, refreshKimiToken() and the kimiMemToken
   cache; the CLI is now the sole refresher and this route only ever READS.

2. Serve the last good reading when the token is stale, instead of erroring.
   Measured 2026-07-22: the access token's expires_in is 900s, so it is only
   valid for 15 minutes after the CLI last refreshed it -- i.e. only within 15
   minutes of an actual Adolf turn. Adolf is idle most of the day, so bare
   reads failed far more often than they succeeded and quota gating was
   effectively blind. /usage now caches every success and, on a stale token,
   returns that payload with stale/as_of/age_s/stale_reason so callers can
   judge whether it is fresh enough. Cache is mirrored to the workspace volume
   so it survives restarts, and writes are best-effort so an unwritable volume
   cannot break the route. Auth behaviour is unchanged by this half.

Payload shape is additive only -- existing kimi-usage -q filters keep working.

Verified live after rebuild: fresh read returns weekly 16% / 5h 5% with
stale:false; cache file written to /workspace/.adolf-llm/usage-cache.json;
kimi-usage -q '.window_5h.pct' returns 5.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-22 11:37:55 +00:00
2026-03-05 11:22:34 +00:00
2026-03-05 11:22:34 +00:00
2026-03-17 03:06:18 +00:00
2026-03-05 11:22:34 +00:00

Agap Home Server

Docker Compose configurations for the Agap self-hosted home server infrastructure.

Services

  • Immich (immich-app/) — Photo management and backup (port 2283)
  • Gitea (gitea/) — Self-hosted Git server with web UI (port 3000, SSH 222)
  • Open WebUI (openai/) — AI chat interface with Ollama, GPU-accelerated (port 3125)

Quick Start

Start Immich (main service)

docker compose up -d

Start Gitea (from gitea/ directory)

cd gitea
docker compose up -d

Start Open WebUI (from openai/ directory)

cd openai
docker compose up -d

Configuration

Environment variables are in the root .env file for Immich:

  • UPLOAD_LOCATION — where photo originals are stored
  • THUMB_LOCATION — thumbnail cache directory
  • ENCODED_VIDEO_LOCATION — transcoded video cache
  • DB_DATA_LOCATION — Postgres database directory
  • DB_PASSWORD — Postgres password

Storage

Media is stored on:

  • /mnt/media/upload — Immich originals
  • /mnt/ssd1/media/ — Immich thumbnails, encoded video, and Postgres database
  • /mnt/misc/gitea — Gitea repositories and data

GPU Support

For GPU acceleration (Open WebUI/Ollama, Immich ML):

  1. Install NVIDIA Docker runtime: sudo ./nvidia-docker-install.sh
  2. Install CUDA toolkit: ./install-cuda.sh

Documentation

See CLAUDE.md for detailed developer instructions and Gitea wiki integration guidelines.

See the Gitea wiki for infrastructure documentation (storage, network, services setup).

Description
No description provided
Readme 8.1 MiB
Languages
JavaScript 49%
Python 39.8%
Shell 6.9%
Dockerfile 1.8%
HTML 1.5%
Other 1%