Skip to content
Centriu
Centriu Synapse

AI Usage Billing Reconciliation Integrity Automation: The Function Every Reconciliation Called, That Never Existed

A core function in Centriu Synapse's billing path — called on every message with observed usage, and on every refund of a reservation left orphaned by an interrupted request — pointed at a database function that had never existed in production at all. Measured directly against the live database: zero matches in the system catalog. Every call failed, the service logged the failure, and processing continued as if nothing had happened, because nobody was watching for an error that produces no user-facing symptom. Two silent consequences followed from the same missing function: settlement never happened, so an estimated cost and the later real cost were both added together instead of the estimate being replaced — pushing an organization's usage toward its monthly cap faster than its actual spending justified — and a refund never happened, so credit reserved for a request that died mid-flight stayed charged forever, with no path back. The fix adds the missing function along with the schema it depends on, proven first against a copy of production's OWN actual, currently-running state, not merely the repository's assumption of it.
Reservations recoverable again
Proven against real production schema
Person working on a laptop with notifications on screen
The function every reconciliation called, that never existed.

A function call that fails without a symptom anyone would notice

A background reconciliation step that fails loudly gets fixed quickly, because something visible breaks. A background reconciliation step that fails by returning an error the calling code already knows how to catch and log — and then simply continues — can fail silently for as long as nobody goes looking specifically for that log line, because from every user-facing vantage point, nothing appears wrong: messages still get answered, requests still complete. The absence is in a number nobody is staring at in real time: whether a specific database function, called constantly, actually exists.

How the underlying problem shows up before you fix it

Application code calls a specific database function by name on a critical path, and the function does not exist in the actual running database — a mismatch that only ever surfaces as a caught, logged error, never a crash a person would notice.

A billing calculation adds an estimated cost and a later, more accurate real cost together, instead of replacing the estimate with the real number once it becomes known — silently double-counting the same unit of usage.

Credit reserved against a request that dies mid-flight has no path back to the tenant's available balance if the one function responsible for returning it never actually runs.

Two closely related but genuinely different failure states — a request that returned an observed failure, and a request that simply stopped producing any observable outcome at all — are tracked as the same status, erasing exactly the distinction needed to know a reservation is stuck rather than resolved.

A repository's own migration file describes a database schema state that no longer matches what is actually running in production, because production had already been patched out-of-band at some point in its history.

How the missing function was found, and why the fix reconciles with real production instead of the repository

The finding began with a single, specific line of code: the function responsible for recording a request's actual, final cost calls a named database function on every message with observed usage, and again on every refund of a reservation left orphaned by a request that died before finishing. Measuring the live database's own function catalog directly showed zero matches for that name — the function had never existed in production. Every call to it returned an error, which the calling service caught, logged as a generic failure, and moved past, silently, on every single occurrence since the code first shipped.

Two distinct consequences followed from that one missing function, both silent. First, because the reconciliation step that was supposed to replace an estimated cost with the real, observed cost never ran, the estimate and the real number were both left standing — summed together rather than reconciled — meaning a tenant's tracked spend grew faster than their actual usage justified, and a monthly cap could be reached before it honestly should have been. Second, because the same missing function was also responsible for returning reserved credit when a request died before completing, that credit simply stayed reserved and charged, permanently, for every request interrupted mid-flight — the exact mirror problem of the first.

Writing the fix required resolving a genuine complication: the repository's own earlier migration had been written assuming production's billing-scope tables had no organization column at all, when in fact production already had one, added independently at some point, with a stricter uniqueness guarantee than the assumption the repository was working from. Applying the older migration as written would have relaxed a real, currently-enforced guarantee in production purely to satisfy a description of a database that no longer existed. The fix was proven with a dedicated test harness that deliberately builds its starting point from production's OWN measured, current schema rather than the repository's assumption — the only one of several related harnesses built this way specifically because this was the one gap where the two genuinely diverged.

The actual fix that shipped adds several pieces together: the missing reconciliation function itself; a tenant-validation function and accompanying triggers, since the same investigation found it had been possible to write a row claiming one tenant while an organization-level filter silently pointed at a different tenant's data; a minimal ledger table that deliberately distinguishes a request that returned an observed FAILURE from a request that was simply INTERRUPTED with no observed end at all — collapsing those two into a single status would erase exactly the case where a reservation is left stuck with nobody aware it happened; and a function that converts an interrupted request into a resolved state and returns its reserved credit, without ever auto-refunding on its own — because deciding to reverse a charge automatically would be inventing an accounting decision that a person, with the actual number in hand, needs to make instead.

What is actually built today

The database function Synapse's own billing-reconciliation code calls on every message and every orphaned-reservation refund now actually exists in production, verified against the live function catalog.

A request's estimated cost is genuinely replaced by its real, observed cost once known, rather than the two being silently added together.

Credit reserved against a request that dies mid-flight is returned through a dedicated function once the request is recognized as interrupted — closing a path that previously left that credit charged permanently.

A minimal ledger distinguishes a request that returned an observed FAILURE from one that was simply INTERRUPTED with no observed end — the specific distinction needed to know a stuck reservation exists at all.

Recognizing an interrupted request converts its status and returns its reservation, but never auto-refunds a charge on its own — a person makes that decision with the actual number in hand.

A trace identifier now threads from the recorded cost back to the specific request that generated it, propagated through every relevant data partition, closing a gap where cost and the request that caused it could not previously be connected.

A refund that was supposed to happen, and never once did (illustrative framing of the actual measured finding)

A request begins, reserves credit against the tenant's balance for its expected cost, and is interrupted before it finishes — a network hiccup, a restart, any ordinary cause. The code responsible for recognizing that interruption and returning the reserved credit calls the reconciliation function that does not exist; the call fails, is logged, and nothing more happens. The reservation stays charged, permanently, as if the request had completed successfully and consumed exactly that much. After the fix, the identical interruption is recognized, the reservation is explicitly released through the now-existing function, and the tenant's available balance reflects reality again — with the release itself recorded, not silent.

What changes operationally

Every message's real cost now genuinely reconciles against its earlier estimate instead of adding to it, and every request interrupted mid-flight has its reserved credit returned through a function proven to exist and proven against production's own real schema — closing a gap where a single missing function had been silently failing on every call since it first shipped.

When this is not the right fit

This automation governs the accuracy of cost tracking and reservation release for AI usage inside Synapse — it does not automatically refund or credit a tenant's account on its own; recognizing and releasing a stuck reservation is automatic, but any resulting balance adjustment remains a decision made by a person with the number in hand.

Trusting a migration file vs. measuring what actually runs

It is a reasonable default to trust that a repository's migration history accurately describes the database currently running in production — right up until the two have quietly diverged, at which point applying a fix written against the assumed state can do real, unintended harm to a guarantee the live database already enforces. Centriu's fix was built and proven specifically against production's own measured, current schema, not the version described in an older file, precisely because this was the one place in the investigation where the two genuinely disagreed.

Related systems

Main system: Centriu Synapse.

What it does NOT do

  • Does not automatically refund or credit a tenant's account balance — recognizing and releasing a stuck reservation is automatic, but any resulting balance decision remains with a person holding the actual figures.
  • Does not retroactively recalculate or correct billing for requests processed before this fix shipped — the reconciliation function now exists going forward from the fix.
  • Does not touch or alter any tenant's token-usage history, key configuration, or knowledge-base content — the fix is additive schema and one missing function, with zero rows of existing data modified.
  • Does not apply a monthly cap retroactively based on corrected figures — the cap enforcement itself is a separate mechanism from the reconciliation fix described here.
  • Does not eliminate every possible cause of an interrupted request — it ensures that whatever the cause, the reservation left behind can now actually be recognized and released.
  • Does not claim every billing-adjacent gap in Synapse has been found — this fix closes the specific, measured missing-function defect found in this audit.

Security and governance

The reconciliation function and its supporting schema resolve and act within the calling request's own organization and tenant scope; a validation function and its triggers reject any row that attempts to associate one tenant's data with a different organization's filter. Any usage or billing data referenced remains subject to Brazil's LGPD (Law No. 13,709/2018). Full detail on access control lives at /governanca and /iso.

Pricing and contracting

Available by monthly subscription, with tiered plans. Values and terms come from the official pricing table at /precos (Centriu's central source — never restated here).

Frequently asked questions

How long had the missing function been failing before this was found?

Since the calling code first shipped — every call to the missing function failed, was caught, logged, and the surrounding process continued, with no user-facing symptom that would have prompted someone to look.

What were the two consequences of the missing function?

An estimated cost was never replaced by the real cost once observed (both were summed, inflating tracked spend), and reserved credit for an interrupted request was never returned, staying charged permanently.

Why did the fix need to measure production directly instead of just applying the older migration?

The repository's earlier migration assumed production's tables lacked an organization column that, in reality, already existed with a stricter guarantee — applying the older file as written would have relaxed a real, currently-enforced protection.

Does the system now refund a stuck reservation automatically?

It recognizes the interruption and releases the reservation automatically, but does not auto-refund any resulting charge — that decision is left to a person with the actual number in hand.

Was any existing data changed by this fix?

No — the fix is purely additive schema plus the missing function itself; a direct measurement before and after confirmed zero rows of existing usage, key, or knowledge-base data were touched.

What does Centriu Synapse cost?

It is sold by subscription with a published starting price — exact current values are on the central pricing page.

See how Centriu Synapse keeps AI usage billing reconciled and reservations recoverable

Reach our commercial team directly, or leave your details below — we'll follow up with guidance for your case.

Sources

  1. Centriu Synapse — public product page — Centriu, 2026-07-20 · link(primária)
  2. Centriu Synapse — public factsheet (API, JSON) — Centriu, 2026-07-21 · link
  3. Law No. 13,709/2018 — Brazil’s General Data Protection Law (LGPD) — Presidência da República (Brazil), 2018-08-14 · link

Last material update on .

By · AI-assisted production, with human review