Operations & Data Layout
Graceful shutdown
SIGTERM / SIGINT trigger a drain, not an immediate exit:
- Stop accepting new connections (up to 1 s);
- Wait for in-progress agent runs to finish — they're writing reports; cutting them leaves half-finished state;
- Wait for request handlers to finish writing responses (clients get results, not a reset connection);
- Only
abortwhat's still unfinished, and log it; - Close databases, delete
host.json.
The total budget is controlled by IFG_SHUTDOWN_GRACE_MS (default 8000). With systemd / launchd, set TimeoutStopSec a bit larger.
Data layout
~/.interviewforge/
├── system.db # global: profiles / providers / capability_routes / mcp_servers / models / job_runs / audit …
├── shared.db # shared KB: collections / documents / chunks / versions / ACL / audit
├── keys/
│ ├── master.key # 0600, AES-256-GCM master key (encrypts provider keys)
│ └── report-signing.key # 0600, HMAC report signing
├── profiles/<id>/
│ ├── app.db # business: sessions / events / runs / checkpoints / kb_* / resumes / memory_* …
│ └── lineage.db # provenance: calls / claims / nodes / edges / payloads
├── models/<modelId>/ # model files (resumable downloads)
├── exports/ # background-exported CSV
├── inbox/ # per-profile inbox (configurable elsewhere)
├── shared-inbox/ # shared inbox
└── host.json # port/token handshake, 0600- Isolation: per-profile directory & DBs; the API binds by profile token, and neither tools nor CLI can read across profiles.
- Encryption: provider keys are
v1.<iv>.<tag>.<ciphertext>(AES-256-GCM); the API returns onlyhasKey. - Integrity: report versions store SHA-256 and HMAC;
ifg verifyorGET /versions/:v/verifychecks them. - Retention: default payload/debug 90 days, recordings 30 days, exports 30 days, snapshots permanent; a daily job cleans up.
View usage: GET /system/storage (UI: Settings → Data & Backup, or the dashboard "disk usage").
Connecting a real provider
#/providers→ provider card → update → paste key → save (encrypted at rest);- Click "test":
ok · xxx ms · samplemeans the key and network work; - In "capability routes", point
chat.fast/chat.strongat that provider; - Back to
#/dashboard, create a session to verify: the report should show real scores,#/lineagereal calls.
When a key is set but the route still points at mock, the UI says so explicitly; click "switch to real provider" to change all three tiers at once. Adding a key without changing the route still yields mock-quality questions.
Provider permissions: private (admin key) is invisible and unusable to members; shared is available to all profiles. 429/5xx go through fetchWithRetry with exponential backoff respecting Retry-After (IFG_PROVIDER_RETRIES default 3).
Budget (two layers, both active)
| Layer | Field | Behavior |
|---|---|---|
| Per session | sessionBudgetUsd | Kernel policy.assertBudget hard-stops by session costUsd |
| Profile | budget.usd (defaults to system costBudgetUsd) | Once cumulative spend ≥ limit, start/answer/hint/rescore/coach/end all return 402 budget_exceeded |
GET /usage returns budget{limit,spent,remaining,usedPct,exceeded,source}; a new interview hitting 402 jumps straight to settings. There's also IFG_MAX_CONCURRENT_SESSIONS limiting cross-session concurrency.
Security & identity
- PIN brute-force protection: 5 consecutive failures lock a profile, with exponentially growing lockout (15 s → 5 min cap); during lockout even a correct PIN returns
429 pin_locked; a correct unlock resets the count, failures are audited. - Request ID: every response carries
x-request-id(clients may pass their own via the same header); error bodies includerequestIdtoo — grep the logs to locate the whole request. - Per-request logging: off by default;
IFG_LOG_REQUESTS=1prints one line per request[req] <id> <method> <path> <status> <ms>; 4xx one line, 5xx with stack.
Backup / restore
ifg export packages the current profile; ifg import verifies then atomically replaces the whole directory. The package intentionally excludes keys/master.key, provider keys, and shared.db / system.db — to avoid "backup equals credential leak". After moving machines the Host auto-generates a new token-signing key and old device tokens expire (data unaffected; unlock with the PIN). See CLI Reference.
Performance baseline
pnpm perf (scripts/perf-report.mjs) opens a clean browser context per route, reads navigation and first-contentful-paint, and counts actual transferred bytes. Watch the trend, not a single absolute value (the same route can vary 200 ms between runs).
Server gzip compresses API JSON ~9.5× (/lineage/graph 2.1 MB → 224 KB per call); the graph endpoint returns at most 800 nodes by default (?limit= adjustable, cap 5000), with total and truncated so the page can label rather than silently truncate.
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
| Questions all alike | No key, or route still mock | Set key + switch route |
| First question takes long | Planner call ~30 s | Specifying topics skips the planner; otherwise bounded by IFG_PLAN_DEADLINE_MS (default 12 s), falling back to a deterministic plan on timeout |
| Resume skills/projects empty after import | PDF has no Markdown headings | Model structuring at import (merged, not overwritten); on failure check log [resume] structuring failed |
| Retrieval always hits the same few | Default hash vectors + lexical fallback | Install a vector model and reindex; read the retrieval pipeline measurements first |
| Report conclusions have no citations | Model gave no sources, or citation verification off | Enable "entailment verification" at setup, or click "verify citations" on the report page |
| Some charts/tables empty | API shows empty state when there's no data | Produce real sessions/documents first (no demo data filled in) |
| Tests finish but process won't exit | Background question/session generation still running | Confirm Runtime.close() was called (engine.dispose() + timers unref()); if needed, ps to check background run status |
| Normal file size but empty reads | Disk bad block (inode size remains) | pnpm fs:health; restore per prompt git cat-file -p HEAD:<path> > <path> |