nvx/apertureAll write-ups
No. 04ENGINEERING · 3 min

54 AI calls, zero answers, one bad prompt

NVX Ancile is the AI desktop app I'm building, where answers cite their sources and a second model fact-checks them. The fact-check once burned 54 model calls in 5 minutes and never answered. Plus a 'flaky' test that was hiding lost writes.

By Cyber security, Monash University

One fact-check in NVX Ancile made 54 model calls in 5 minutes and never returned a verdict. Ancile is a desktop app for working with AI models for hours at a time. It is all local, open source (GPL-3.0) and Windows first, and the first release is in the works.

What Ancile doesHow
Model swappingSwap models mid-chat without losing context
CitationsAnswers cite the exact passage they came from
Fact-checkingA second model from a different family checks the claims
MemoryWhatever the AI remembers about you is plain markdown in git, which you can read and edit

The fact-check that never finished

Model calls
54
For a 5-claim answer
5 min
Verdicts
0
How a fact-check is supposed to go4 stages
  1. 01

    Split the answer into claims

  2. 02

    Check each claim

    Against your sources, then the web

  3. 03

    Fallback model if one fails

    This is where it looped

  4. 04

    Verdict per claim

My first guess was that the models were bad. The trace said otherwise.

One claim, the whole fallback chain5 steps
  1. 01chk to mdl: Prompt. The prompt ends with Return JSON matching ClaimVerdict and never names a field.
  2. 02mdl to sch: Plausible JSON. Each model sends back 200 to 260 characters of plausible JSON, and each one guessed a different shape. Models: 200-260 chars each.
  3. 03The schema rejects every one. Each rejection counts as "model failed". Fact-check loop: model failed; Schema: rejected.
  4. 04chk to mdl: Next model. So the loop walks the whole fallback chain, then goes round again, and again. Models: 4 of 4 rejected.
  5. 05That makes 54 calls in 5 minutes for a 5-claim answer, and no verdict. Fact-check loop: 54 calls, 0 verdicts.
The prompt

Names every field with its type and an example, asks the provider for JSON mode with the schema, and reads replies tolerantly ("85%" is fine for 0.85).

LimitValue
Calls per claim3
Calls per answer20
Time6 minutes
Money$0.50
When a claim hits oneIt says "not checked" and why, and the rest carry on
Model calls for one answercalls
0204060The run that neve…54callsNew cap: 20 per answer
I added a hard budget after this. Anything with LLM fallbacks should have one, because a loop of plausible-but-wrong replies costs money on every pass.
Model calls for one answer
LabelCalls
The run that never finished54calls
Same week, from live runs (paraphrased), all four fixed4 lines
"grass is green."        unverified  (evidence: a passage about invoices)1
same answer, run twice   4 claims, then 62
web check                3 results, 0 quotes, so nothing to judge3
"everest is 8,849 m"    blocked: the permission gate wanted to ask first4
  1. 1L1Fix: drop weak passages
  2. 2L2Fix: cache claims by answer hash
  3. 3L3Fix: require a quoted snippet
  4. 4L4Fix: let fact-check lookups skip the ask

The flaky test that was eating writes

Two tests about approving suggested memories failed now and then.

Runs where both suggestions got the same millisecondof 12 runs
  • 92%Same millisecond
  • 8%Different
How approving the newest memory went wrong4 steps
  1. 01cor to old: Two suggestions. Ancile's memory is its own git repo of markdown files. One correction creates two suggestions back to back.
  2. 02Both get the same millisecond. The ids are ULIDs, which break same-millisecond ties at random. Newer suggestion: same ms; Older suggestion: same ms.
  3. 03About 1 time in 4, the older one sorts as newest. Newer suggestion: sorts as older; Older suggestion: sorts as newest.
  4. 04apr to old: Approved. "Approve newest" approves the wrong one. The edit lands in the wrong file while the API says success. Approve newest: API: success.
What chasing it turned up
WhereWhat it didNow
Same-millisecond idsThe older suggestion could sort as newestMonotonic ULIDs fixed the order
Two writers to one fileA write could be lostEverything goes through one write queue
A write git refusedIts text stayed on disk, and the next writer could commit it by accidentEverything goes through one write queue
Reading text before versionA save could silently undo someone else's commitEverything goes through one write queue

The regression test hammers the queue with simultaneous approvals and hand edits against a git repo on disk. Every check fails on the old code.

Emoji broke every citation highlight after them

Counting the same string
PythonJavaScript
Where it livesThe part that chops sources into passages, and stores character offsetsThe app
CountsCode pointsUTF-16 units
An emoji is12

So every highlight after an emoji landed a little early. I fixed it at the API boundary with a UTF-16 map per source version. If you pass string offsets between Python and JS, check this today.

Retrieval recall

Retrieval, recall@10 on the eval set
0.000.250.500.751.00Vectors onlyHybrid + rerank0.880.99
Retrieval, recall@10 on the eval set
Labelrecall@10
Vectors only0.88
Hybrid + rerank0.99

The local API answered every program

Who the app's local API answers

It only answers you. A browser is paired once. An approval is bound to a hash of the exact arguments you saw, so "delete this file" can't stretch into "delete this folder".

Free and Pro

FreePro
CoversThe whole product: notebooks, cited answers, branching, the second-model check, memory in git, flows, one GPU node of your own, every admin viewWork that outgrows one person or one machine: teams, sync, a GPU fleet
Lives inThe free buildA separate private module

Because Pro lives in a separate module, there is no hidden trial in the free build. No pop-ups, no countdowns. Pro isn't on sale yet.

No comments yet

Comments are read before they appear.