Repository navigation
Count the reads of the resources and the skills by the assistants - #193
Merged
Merged
Conversation
A request may declare the client it comes through with X-OpenSVC-Origin: assistant for the AI assistant, through the MCP of the collector and its agent, mcp for another client of that MCP. Once the request authenticated, OriginMiddleware marks its context with the origin and its X-Request-ID, and cdb.Log writes them on every audit entry of the request, as it does the impersonator: log_origin and log_request_id, added by the migration 0034_log_origin and exposed by GET /logs. An origin other than these two is ignored, a malformed request ID too. The client declares the origin: it tells how an action was made, never who made it, which the authentication decides. The request ID is the one the agent and the MCP write on their audit lines, which ties an entry to the question asked.
The tables of the MariaDB tests of the AI content held a log without the columns of the origin, which cdb.Log now writes: every write of these tests failed to log, unseen where OC3_TEST_MYSQL_DSN is not set. They have them, and a write through OriginMiddleware is checked to log its origin and its request ID, a write declaring none to log neither.
A GET of the text of a resource or of a skill naming a backend, as the MCP servers make for the agent, counts in its reads for that backend, with the date of the last one: the migrations 0035 and 0036 add ai_resources_reads and ai_skills_reads. The reads of the admin views, which name no backend, do not count, nor do the lists. A failure to count is logged, the read answered all the same. The metadata give the reads to an AIManager only, as the publications: an AIManager sees which texts the assistants read, and which they never do, a description the model does not follow. A deletion takes the reads with the object.
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.
A GET of the text of a resource or a skill naming a backend, as the MCP servers make for the agent, counts in its reads for that backend, with the date of the last one. The reads of the admin views (no backend) and the lists do not count. The metadata give the reads (
reads) to an AIManager only, as the publications, so they see which texts the assistants never read. A deletion takes the reads with the object.Depends on #192
Built on #192, whose commits this branch holds: merge #192 first, then review the last commit only. The migrations follow its
0034:0035_ai_resources_readsand0036_ai_skills_readscreate two small tables.