Repository navigation
feat(ai): say "source":"ai" on every line of the AI log - #2130
Merged
irvingouj@Devolutions (irvingoujAtDevolution) merged 2 commits intoOct 22, 2026
Conversation
irvingouj@Devolutions (irvingoujAtDevolution)
added this pull request to stack #2131
October 20, 2026 18:23
irvingouj@Devolutions (irvingoujAtDevolution)
requested a review
from Benoît Cortier (CBenoit)
October 20, 2026 19:46
Benoît Cortier (CBenoit)
approved these changes
Oct 21, 2026
irvingouj@Devolutions (irvingoujAtDevolution)
force-pushed
the
feat/ai-log-source-every-line
branch
from
October 21, 2026 19:48
f682382 to
048a686
Compare
Copilot started reviewing on behalf of
irvingouj@Devolutions (irvingoujAtDevolution)
October 21, 2026 19:49
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The localized change matches its stated purpose, covers every event type, and has no unresolved findings.
No open issues 🎉
What changed in this PR
Makes every AI session-log line identifiable when logs are mixed or filtered.
Changes:
- Sets
"source":"ai"in the shared entry constructor and updates regression tests. - Documents per-line attribution and existing session-start metadata in the crate intent.
| File | Description |
|---|---|
crates/devolutions-gateway-ai/src/recording_analysis/slog.rs |
Adds AI attribution to every entry; tests logs with and without actions. |
crates/devolutions-gateway-ai/INTENT.md |
Documents the log format and attribution requirement. |
Review effort: Balanced
irvingouj@Devolutions (irvingoujAtDevolution)
force-pushed
the
feat/ai-log-source-every-line
branch
from
October 22, 2026 14:19
048a686 to
a8fb09a
Compare
Only `session.start` said where the log comes from. A caller that shows the AI log next to other logs, or keeps only some of its lines, could no longer tell those lines apart. Every line now carries it. The crate intent states it, with the model and prompt versions already on `session.start`. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
irvingouj@Devolutions (irvingoujAtDevolution)
force-pushed
the
feat/ai-log-source-every-line
branch
from
October 22, 2026 15:28
a8fb09a to
cbf9235
Compare
The Gateway is the standard for what an AI `.slog` holds, since a Gateway release is far harder to ship than a log player. A flat entry let any line carry any optional field. Each event is now its own variant with exactly its fields, and the source is a type whose only value is `ai`. The test compares JSON values instead of exact text, since key order is free, and cites the crate intent and the player's sample log. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
irvingouj@Devolutions (irvingoujAtDevolution)
force-pushed
the
feat/ai-log-source-every-line
branch
from
October 22, 2026 16:18
a2cfb20 to
584b751
Compare
irvingouj@Devolutions (irvingoujAtDevolution)
merged commit Oct 22, 2026
64ea2d3
into
master
48 checks passed
irvingouj@Devolutions (irvingoujAtDevolution)
deleted the
feat/ai-log-source-every-line
branch
October 22, 2026 17:48
irvingouj@Devolutions (irvingoujAtDevolution)
added a commit
that referenced
this pull request
Oct 22, 2026
…mary (#2118) The AI analysis now writes in the language the caller asks for and ends with a summary. AI crate only. - New `Language` type: any text of 1 to 10 characters, like `fr-CA`, `zh-Hant-TW` or `français`. `Language::new` refuses anything else, so a bad value never reaches a prompt, and the short limit leaves little room to slip in instructions. It reads and writes itself as a JSON string, so a caller can store it. Without one, the prompts ask for English. `AnalyzeRecording`, the two action purposes and the summary all take it. - New purpose `session_summary` (`AiClient::summarize_session`): one extra request after the actions, only when there are actions. Its tokens count in the usage. The summary goes in `summary` on the AI log's `session.end`. - A summary that fails for good fails the analysis, like any other step: no log without it. A transient failure is retried, and the retry resumes from the described chunks. - `session.start` names the model, the prompt versions and the language. - A retry with another language starts over instead of reusing the working files. ## Why a hashed prompt version Each `PROMPT_VERSION` is the purpose name plus the FNV-1a hash of its prompt and language rule, computed at compile time, like `session-actions-3f9a1c2b7e4d0a51`. A hand-bumped number drifts as soon as someone edits a prompt and forgets it; a hash can't. The language stays out of the hash and goes on `session.start` instead, so one prompt keeps one version in every language. The analysis reports `<actions>+<summary>`. The crate intent states all of this. The intent wording is mine. ## Where to look hardest `prompt_version!` and `fnv1a` in `client.rs`, and the summary step at the end of `recording_analysis/mod.rs`. Known limit: the summary sends all actions in one request, so a very long session could go over the model's context window. Stacked on #2130 (`source` on every line). #2117 is closed: the language no longer comes from the producer's events log. Tests: `cargo test -p devolutions-gateway-ai` passes (113 unit, 28 provider tests); clippy is clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 (1M context) <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.
Only
session.startof the AI log said"source":"ai". Now every line does, so a caller that shows the AI lines next to other logs, or keeps only some of them, can still tell where each line came from.The crate intent states it, along with the model and prompt versions that
session.startalready carries. The intent wording is mine.Split out of #2118 so that one stays about the language and the summary. It sits on #2058 only for the stack order; there's no code dependency.
Tests:
cargo test -p devolutions-gateway-aipasses (99 unit, 28 provider tests); clippy is clean.🤖 Generated with Claude Code