You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit f4fd25e
Browse filesBrowse the repository at this point in the historyBrowse files
fix(billing): answer an in-flight retry at once, and tell Chat what provenance withheld (#9094)
* fix(billing): answer an in-flight retry at once, and tell Chat what provenance withheld
A cost callback retried while an earlier attempt of the same request was
still committing (a commit can wait on a synchronous standby while holding
the request's ledger lock) waited out lock_timeout on a pooled connection and
failed with a 500. The ledger lock is now taken without waiting: a held lock
answers 503 BILLING_REQUEST_IN_FLIGHT (Retry-After) at once, and the caller
resends later; the monotonic top-up applies the higher cumulative once.
Provenance refusals are policy, not faults: each gate admission now reports
its refusals as one warning with counts and a bounded sample instead of one
error per item, and the table envelope's unknown-row line is a warning.
Chat's CLI result now notes how many items of each kind a gate withheld, on
stderr, so the model can tell a withheld item from an absent one. Callers
outside Chat never classify content and see no change.
Also corrects two comments: the worker's callback timeout is 15 s, and no
transaction setting bounds a commit waiting on a standby.
* test(billing): model the ledger try-lock in the unit tx mock; pass the route context
The usage-log unit mock answered every statement with undefined, which the
try-lock cannot read; it now answers whether the lock was taken, with a test
that a held lock refuses before any read or write. The new route test passes
the route context like the typed handler expects, and the refusal reason type
stays module-private.
* fix(mothership): word the withheld note for every refusal, and describe the rows that read as unknown
A gate refuses either the item (unknown provenance) or only the requested
view (an excerpt or raw bytes redaction cannot cover), so the note no longer
says another read cannot return it. Untracked legacy rows read as exact-empty;
only tracked rows with a stale, missing or malformed sidecar read as unknown.
* fix(provenance): keep refused ids paired with their cause, name sandbox files by hash, and tell Chat why each item was withheld
Refusal reports are grouped by surface, cause and owning record (document,
table or chat), each line with top-level surface, cause and refusedCount and
the refused ids (up to 200, flagged when truncated), so per-cause queries and
id-to-cause pairing survive aggregation. A sandbox file is attributed by a
chat-scoped hash of its path rather than the path, which carries the user's
file name. A streamed sandbox image declares its view opaque, so its refusal
reads as opaque content rather than a missing registry; the use case now
requires every caller to declare the view.
Gate verdicts carry the refusal reason, and Chat's CLI note says per reason
what a read can do next: unknown provenance will not return on a retry,
recorded secrets can be read as text for a redacted copy, and provenance that
could not be verified may be readable later. Chunk write refusals name their
document as the parent.
* fix(billing): an in-flight refusal is not a slow ledger transaction
The usage ledger's slow-transaction warning fired for every in-flight
refusal (stage lock, not succeeded), although nothing waited and the route
already logs the refusal once at INFO. It now skips refusals. The span keeps
the existing internal_error outcome, since the closed outcome set is
generated from the legacy contracts; the response code and the INFO line tell
it apart.
* fix(provenance): keep this change to the refusal logs and note it introduced
Drops the sandbox attribution id, the streamed-image view and the owning-record
ids from this change; they belong to the provenance owner's work and fix
behavior that predates it. Refusal lines stay one per surface and cause with
top-level surface, cause and refusedCount and every refused id as each line
names it today, and the note keeps its per-reason wording.
* fix(provenance): give every refusal line a refusedCount, and say what tells an in-flight 503 apart
A single refusal now carries refusedCount 1 like a grouped one, so summing
refusedCount by cause covers both. The route comment now says the span is the
same as the retryable settlement 503's and that the body code and the INFO
line distinguish them.
0 commit comments