feat: emit chat_title, llm_call, and message audit events - #2476
Open
lulululu-debug wants to merge 1 commit into
Open
feat: emit chat_title, llm_call, and message audit events#2476lulululu-debug wants to merge 1 commit into
lulululu-debug wants to merge 1 commit into
Conversation
An external reader of OpenAgent's audit log (aiguard's Sessions and Records pages) had no way to show a chat's title, no per-message record of an LLM call, or the actual question/answer text of a turn - generateMessageAnswer resolved a title into chat.DisplayName and answered every message without any of it reaching the log tool_call events already went to. A companion aiguard PR reads these. Three additions to audit.Event, each emitted once per turn from generateMessageAnswer: - "message" events (Role "user"/"assistant", Text the message itself) are the one deliberate exception to this log being metadata only - see the package doc - emitted for both the incoming question and the generated reply. - "llm_call" fills in a gap: message_answer.go answered every message without an audit event for the LLM call that produced it, unlike every tool_call already logged. - "chat_title" carries chat.DisplayName, the same short label OpenAgent's own chat list shows, right where NeedTitle is cleared - not the prompt or response text that produced it. Title, Role and Text are new Event fields; the tool_call/session fields already on Event cover llm_call's needs (Model, ContentLength, DurationMs, Outcome) without adding any.
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.
Summary
Emit chat_title, llm_call, and message audit events from generateMessageAnswer, so an external reader (aiguard) can show a chat's title, its conversation text, and the LLM call behind each reply.
Changes
Add message events (Role "user"/"assistant", Text the message itself) for both the incoming question and the generated reply - the one declared exception to this log otherwise being metadata only
Add an llm_call event per answered message, filling a gap where every tool_call was already logged but the LLM call producing the reply wasn't
Add a chat_title event carrying chat.DisplayName, the same short label OpenAgent's own chat list shows, emitted right where NeedTitle is cleared
Add Title, Role, and Text as new Event fields; llm_call reuses the existing Model/ContentLength/DurationMs/Outcome fields, no new ones needed