Repository navigation
feat(llm-helper): the audit of a single call - llm.transcript.audit.single records a call without tools as a conversation of one turn (RFC-0015, step 1) - #81
Merged
Conversation
…ingle records a call without tools as a conversation of one turn (RFC-0015, step 1) A call without tools kept no working record, so the transcript audit store held an agent loop's turns only. With the switch on, a call on llm.chat or llm.stream saves a closed one-turn version 2 record with the audit's grace once the model has answered, and sends the check event: transcript.audit is unchanged, the sweep repairs a failed write, the reply never waits for the save and no content crosses the bus. The row's tools is null, which a loop's never is. Off by default. The new shared file tests/vectors/llm-audit-vectors.json (25 cases) and six tests pin it; sixteen mutations of the code and the file were each caught by a test. Part of #77. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
RFC-0015 in mercury-composable (Accenture/mercury-composable#668), build plan step 1, Python first (the Node twin follows in lockstep). Part of #77.
llm.transcript.audit.single(off by default). With it and an audit store, a call withouttoolsonllm.chatorllm.streamis recorded as a conversation of one turn, carried the way a loop's turns are: once the model has answered, the helper saves a closed version 2 record under a new reference with the audit's grace as its time to live, and sends the one event a closed record needs, the check.transcript.auditis unchanged. The check writes the conversation row and the turn row from the record with the statements a loop's turns use and releases the record; a check that fails leaves the record for the sweep. No content crosses the bus, and the reply never waits for the save.turns1 andtoolsnull, which a loop's row never has, sotools IS NULLselects the single calls with no change to the schema.statusis the model's outcome (done,refusal,cap; any other stop reason isdone),modelthe model that answered. A refusal, a cut-off reply and a reply the helper judged unusable (its 422) are recorded with their cost; a call that failed before the model answered leaves no row.llm.transcript.storestops the application by name.tests/vectors/llm-audit-vectors.json(25 cases, written from the contract's statements, run through the save, the check event and the function behind its mailbox), and six tests: the reply does not wait for the save and the shutdown drains it, a working store that fails never refuses the call, a failed write is repaired by the sweep, a loop turn is untouched by the switch. The two existing vector files are untouched, so the Node pack's pinned digests hold.resources/application.yml, CHANGELOG, the thread and the session log.Why
The audit store recorded an agent loop's turns only, so a graph whose model calls are bounded AI nodes had no audit of its model use. The request behind #77 carried the rows in the event to
transcript.audit; its review found that this departs from two of ADR-0035's decisions, leaves a failed write unrepaired and holds content in the function's mailbox during an outage. The record as the carrier keeps every decision of the ADR and makes a database outage a delay, not a gap.Defaults set without a ruling (each is an open question of RFC-0015): the switch off by default;
llm.streamrecorded under the same switch; the answering model recorded; a stop reason outside the loop's table asdone; the reply not waiting for the save.Checked:
pytest -q807 passed, 76 skipped;ruff check .clean;basedpyright0 errors. Sixteen mutations of the code and the vector file, applied one at a time, were each caught by a test. Not done: no live drive against a real PostgreSQL with the database stopped or stalled.🤖 Generated with Claude Code