Go to file
Lucio Lelii e71ba9c290 Stop a second LLM assessment from erasing the one still running
Two assessments of the same report, started minutes apart, left only one:
observed in a real run as two REPORT_JUDGE jobs both COMPLETED (14:33-14:37
and 14:36-14:37) against a report that ended up holding a single judgement -
the one that finished last.

judgeReport was one @Transactional method that read the report, spent minutes
in one model call per compared pair, then wrote. The second assessment read
the report while the first was still calling models, saw no history, and
saved its own judgement as the only one there. Nothing warned, because from
each writer's side the write succeeded.

The model calls now happen outside any transaction - holding one open across
minutes also pins a connection for no reason - and the write moved to
BiasJudgementStore, a bean of its own so the transaction starts there and a
retry re-enters through the proxy rather than inside the transaction that just
failed. It re-reads the report as it is at that moment, puts the new verdicts
on those pairs and the summary on that history, and the report entity carries
a @Version so a writer working from a stale read is refused instead of
overwriting: the next attempt reads the assessment that landed meanwhile and
appends after it.

Optimistic rather than SELECT ... FOR UPDATE because the tests said so:
Hibernate renders PESSIMISTIC_WRITE as "for no key update", which H2 - what
the suite runs on - cannot parse. A fix that only holds on one dialect is not
one.

The regression test runs the two assessments on two threads, with a stub
provider that blocks inside the model call until both have reached it, and
asserts the report keeps both. Reinstating the old shape fails it.

This prevents further losses; it does not recover an assessment already lost.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-08 15:14:55 +02:00
.mvn/wrapper upgrade to springboot 4 2026-05-05 19:22:53 +02:00
src Stop a second LLM assessment from erasing the one still running 2026-09-08 15:14:55 +02:00
.gitattributes first commit 2025-03-27 11:38:06 +01:00
.gitignore Improve assistant model routing and diagnostics 2026-05-20 12:27:09 +02:00
Dockerfile Update Dockerfile for Java 25 2026-04-17 14:11:02 +02:00
mvnw first commit 2025-03-27 11:38:06 +01:00
mvnw.cmd first commit 2025-03-27 11:38:06 +01:00
ollama-preloaded-docker image for test with ollama added 2025-09-29 17:00:57 +02:00
pom.xml fix(concurrency): harden static holders populated by Spring constructors 2026-09-02 09:53:13 +02:00
run_service.sh feat: support provider selection for flow assistant 2026-09-01 15:34:41 +02:00