Skip to content

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
acn-ericlaw merged 1 commit into
mainfrom
feat/llm-chat-single-call-audit
Nov 24, 2026
Merged

acn-ericlaw merged 1 commit into
mainfrom
feat/llm-chat-single-call-audit

Conversation

@acn-ericlaw

Copy link
Copy Markdown
Collaborator

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 without tools on llm.chat or llm.stream is 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.audit is 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.
  • The rows. turns 1 and tools null, which a loop's row never has, so tools IS NULL selects the single calls with no change to the schema. status is the model's outcome (done, refusal, cap; any other stop reason is done), model the 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.
  • At start, the switch without llm.transcript.store stops the application by name.
  • Tests. A new shared file, 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.
  • README ("The audit of a single call"), 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.stream recorded under the same switch; the answering model recorded; a stop reason outside the loop's table as done; the reply not waiting for the save.

Checked: pytest -q 807 passed, 76 skipped; ruff check . clean; basedpyright 0 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

…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>
@acn-ericlaw
acn-ericlaw merged commit 5a4a0be into main Nov 24, 2026
5 checks passed
@acn-ericlaw
acn-ericlaw deleted the feat/llm-chat-single-call-audit branch November 24, 2026 06:10
acn-ericlaw added a commit that referenced this pull request Nov 24, 2026
…ts on main

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant