- 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
27 lines
1.3 KiB
SQL
27 lines
1.3 KiB
SQL
-- 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;
|