4 Commits
Author SHA1 Message Date
CatoandClaude Opus 5.5 4e5a5725a0 fix(ops): an OOM kill no longer takes down the ubuntu user manager (#1606)
* fix(rag): the embed server drops work nobody is waiting for, so one slow page cannot fail the reindex

The 2026-11-07 03:30 loki-reindex ran 15 minutes of "[embeddings] failed: The
operation was aborted due to timeout" and was killed by TimeoutStartSec. The
first user got 384/637 chunks, the second 0/632, with 3.9s of client CPU.

#1594 serialized inference behind one lock. The client aborts a page after
30s, but the server kept computing the abandoned page under the lock, so the
next page queued behind dead work, timed out too and left its own behind.
After the first slow page every page failed.

- embed-server.py checks whether the caller is still connected when it takes
  the lock and between batches, drops the work if not, and logs the drop.
- embeddings.ts pages at 16, the server's own batch, instead of 48: a third
  of the time per request against the same 30s timeout, and a third of the
  wait for a live caller queued behind the reindex.
- scripts/test/embed-server-drops-abandoned.ts runs the real server.py on a
  slow stub model. Against the old server the next caller waited 1761ms
  behind abandoned work; now it does not.

Every deploy syncs server.py and restarts loki-embed when it changed (#1595).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(ops): an OOM kill no longer takes down the ubuntu user manager

user@1000.service (the ubuntu account's systemd manager on bitbaum) failed
with "The kernel OOM killer killed some processes in this unit" followed by
"Failed with result 'signal'", and paged as a failed unit. It is the same
failure #1601 fixed for the openclaw manager (user@1001): systemd's default
OOMPolicy=stop stops the whole manager when the kernel kills any one process
inside it.

The deploy step from #1601 now installs the same OOMPolicy=continue drop-in
for both the openclaw and the ubuntu managers. It still writes only the
drop-in and runs daemon-reload (only when a file changed), restarts nothing,
skips users that do not exist, and warns without failing the deploy. The conf
and its guard test drop the openclaw- prefix, since they now cover both; the
test fails if ubuntu leaves the list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 06:20:43 +00:00
CatoandClaude Opus 5.5 66e1d48fd2 fix(rag): bound the embed server's memory so a reindex cannot starve the box (#1594)
* fix(rag): bound the embed server's memory so a reindex cannot starve the box

The 03:30 loki-reindex drove loki-embed (ThreadingHTTPServer, one onnxruntime
run per concurrent request, arena never returned) to 2GB, filled swap, and
pushed load to 53. Postgres connects timed out, so six other apps' crons
failed — sbb-fundbuero purge among them — until the OOM killer took the
embed process at 03:33:05.

Serialize inference behind a lock with a small batch size, and give the unit
MemoryHigh/MemoryMax so the kernel reclaims or kills this process alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(test): box-register-follow fixture no longer commits into the real repo

Under the husky pre-push hook the inherited GIT_DIR turned the suite's
`git init` into the pushing checkout: commits "one"/"two" landed on the
branch (emptying its tree) and core.bare=true reached the shared .git/config,
breaking the main checkout. Source git-fixture-env.sh like its siblings, and
add test-git-fixtures-isolated.sh to test:ops so a new fixture suite that
skips it fails instead of becoming the fourth incident.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 05:25:21 +01:00
CatoandClaude Fable 5.1 95c40a9cd8 refactor: rename the product from FleetCrown to Loki (#695)
The product, its assistant, the repo, the host and every unit on the box now
share one name. 638 files, ~3,000 mentions: UI copy, config, env keys
(FLEETCROWN_* -> LOKI_*), systemd units (fleetcrown-* -> loki-*), docs,
articles, the deploy workflow other repos reuse, and nine file names.

- Three article slugs carried the old name and had been shared; permanent
  redirects keep those links alive (next.config.ts).
- test-no-retired-name.sh now also forbids the old product name across the
  whole repo, so the rename cannot creep back through templates and examples.
- ASSISTANT_STACK collapses the product and the assistant into one entry,
  because they are now the same name.

Infra was cut over ahead of this merge: /opt/loki, loki-* units, the `loki`
database and role, loki.orangecat.ch (old host 308s to it; /api, /widget,
/embed keep proxying), GitHub repos bitbaum/loki and bitbaum/loki-releases.
The Resend sending domain stays fleetcrown.orangecat.ch until the new domain
is verified in DNS.


Claude-Session: https://claude.ai/code/session_016YJVAanfj8keVSXyZnTemh

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-13 16:13:10 -07:00
Mao Nakamoto 9690eb7021 feat(rag): fleet-knowledge pgvector index + cross-project context injection
Captain-layer RAG — index what only FleetCrown sees across the fleet, never repo
code (the runtime retrieves that itself). Context injection becomes relevance-
ranked instead of profile-dump.

- Local embeddings: scripts/embed-server.py — fastembed BAAI/bge-small-en-v1.5
  (384-dim) behind an OpenAI-compatible /v1/embeddings, on the box (no cloud key).
  systemd fleetcrown-embed.service.
- src/lib/rag/embeddings.ts — provider-agnostic client (ported from OrangeCat's
  convention; EMBEDDINGS_BASE_URL/MODEL/DIM, graceful-off when unset → local dev).
- knowledge_embeddings table (pgvector, vector(384), user_id-scoped) — Drizzle
  schema + raw-SQL ingest/cosine-retrieve in db/queries/knowledge-embeddings.ts.
- scripts/reindex-knowledge.ts — backfill project profiles + dev-logs (P0).
- inject-core: dispatches now get a "Relevant context from your other projects"
  block retrieved against the task, excluding the project it's for. The engine
  under cross-project reference's suggested-references, and the first real fix
  for the "memory is the weakest strut" gap.
- docs/architecture/{cross-project-reference,fleet-knowledge-rag}.md — specs.

Verified live on the box: retrieval is semantically accurate (bitcoin→orangecat,
refugee housing→aoz-housing). 24 chunks indexed across 21 projects. tsc=0, eslint=0.
2026-06-25 16:57:11 +02:00