Ideas · Builder Notes

Atomic quota and anomaly counter admission

Kognita alpha now takes a write lock before reading quota, delegation budget and anomaly counters, so concurrent calls cannot exceed a limit.

Why did this need fixing?

Count then admit is a race. Concurrent agent calls could slip past a quota.

What did I do about it?

Limit rechecks, delegation budgets and anomaly observation take a write lock on the agent or parent run row, held through commit.

Limits now hold under concurrency, tested with threads.

Which detail mattered?

Anomaly counters no longer lose increments.

Where are the limits?

Locking adds contention under heavy concurrency.

If you're building something similar?

Test limits concurrently. A sequential test proves nothing about a race.

Sources

Kognita is an open-source alpha. This note comes from Kognita PR #68 in the Kognita repository.

All ideasEmail Ahmed