Error log, retry notice, a waiting counter that keeps counting
CI / test (push) Successful in 1m8s
CI / build (push) Successful in 5m13s
CI / deploy (push) Skipped

- generation_errors: every failed attempt (model, attempt, outcome, duration); admin
  Hibanapló page and GET /v1/admin/errors; kept 90 days
- The waiting page counts from when the text was asked for (requested_at), not from
  the page load, so a reload no longer restarts it
- It says when an attempt failed and is retried, and when a failed text's unit was
  given back; admins see the error

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
feco
2026-11-18 21:47:37 +00:00
co-authored by Claude Opus 5.5
parent cf2fb9d454
commit 02e4e225f0
22 changed files with 569 additions and 25 deletions
@@ -0,0 +1,26 @@
-- Every failed attempt of an analysis, an answer or a prompt test run, for the
-- admin error log. No foreign keys: the log outlives deleted items. Kept for
-- 90 days (worker cleanup).
CREATE TABLE generation_errors (
id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
created_at timestamptz NOT NULL DEFAULT now(),
source text NOT NULL CHECK (source IN ('analysis', 'question', 'preview')),
item_id uuid NOT NULL,
kind text NOT NULL,
model text NOT NULL,
attempt integer NOT NULL,
-- What happened next: tried again, the default model took over, or gave up.
outcome text NOT NULL CHECK (outcome IN ('retry', 'fallback', 'failed')),
error text NOT NULL,
seconds integer
);
CREATE INDEX generation_errors_created_idx ON generation_errors (created_at DESC);
CREATE INDEX generation_errors_item_idx ON generation_errors (item_id);
-- When the current text was asked for (a regeneration or an admin restart
-- sets it again): the waiting page counts from here.
ALTER TABLE analyses ADD COLUMN requested_at timestamptz NOT NULL DEFAULT now();
UPDATE analyses SET requested_at = created_at;
ALTER TABLE questions ADD COLUMN requested_at timestamptz NOT NULL DEFAULT now();
UPDATE questions SET requested_at = created_at;