Skip to content

Count the reads of the resources and the skills by the assistants - #193

Merged
sghf merged 3 commits into
opensvc:mainfrom
hugobrenet:feat/ai-content-reads
Nov 13, 2026
Merged

sghf merged 3 commits into
opensvc:mainfrom
hugobrenet:feat/ai-content-reads

Conversation

@hugobrenet

@hugobrenet hugobrenet commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

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_reads and 0036_ai_skills_reads create two small tables.

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.
@sghf
sghf merged commit 4031e8d into opensvc:main Nov 13, 2026
2 checks passed
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.

2 participants