Repository navigation
Commit f398d0c
feat(dgw): run AI analysis as a provisioner task
Gateway can now describe what the user did in a recorded session with
an AI provider, and add the result to the session as a new log. The
analysis itself is the AI crate's `analyze_recording`; Gateway gives it
the session manifest once the recording is finished, then adds the log
it returns to the session through the recording manager.
Provisioner tasks run through a ProvisionerTaskRunner, the one place
that keeps a task's record in gateway.db and the job running it on the
job queue in step. Each kind of work is a ProvisionerTask: what one
attempt does, and what to drop once its record ends. The runner records the Task and queues its
job, starts each attempt, cancels and awaits an attempt past its
timeout, retries transient failures until the job queue's attempts are
used up, and records how the Task ends. The Task is the source of
truth and its job only wakes it up: each Task names the one job
allowed to run it, so a stale or duplicate job stops without running
anything. At startup, before the job runner claims anything, every
unfinished Task is handed to a new job, which also covers a Task
recorded just before a crash, before its job was queued.
AI analysis (`recording-ai-analysis`) is the first kind. A repeated
request with the same Task ID gets its Task back, even while the
session records again. A new request is refused while the session is
recording, or when it has no recording.
The API key and the base URL stay in memory only, encrypted, as the
Task's secret in the provisioning store, until the Task ends or reaches
its deadline. After a restart the attempt finds no key and
fails its Task. Neither the key nor the URL appears in errors, logs or
stored results: the AI client (#2043) leaves the URL out of its
transport errors.
Analyses of one session run one at a time, so two attempts never
share the working files the AI crate keeps next to the manifest. Those
files are removed when the Task ends.
Starting an AI analysis is an internal function for now; the HTTP
endpoint comes next.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>1 parent d0bab56 commit f398d0c
12 files changed
Lines changed: 2581 additions & 15 deletions
File tree
- devolutions-gateway
- src
- provisioner_tasks
- recording_ai_analysis
- runner
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
93 | 94 | | |
94 | 95 | | |
95 | 96 | | |
| 97 | + | |
96 | 98 | | |
97 | 99 | | |
98 | 100 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
| |||
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
| 46 | + | |
44 | 47 | | |
45 | 48 | | |
46 | 49 | | |
| |||
86 | 89 | | |
87 | 90 | | |
88 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
89 | 100 | | |
90 | 101 | | |
91 | 102 | | |
| |||
201 | 212 | | |
202 | 213 | | |
203 | 214 | | |
204 | | - | |
| 215 | + | |
205 | 216 | | |
206 | 217 | | |
207 | 218 | | |
208 | 219 | | |
| 220 | + | |
209 | 221 | | |
210 | 222 | | |
211 | 223 | | |
| |||
229 | 241 | | |
230 | 242 | | |
231 | 243 | | |
| 244 | + | |
232 | 245 | | |
233 | 246 | | |
234 | | - | |
| 247 | + | |
235 | 248 | | |
236 | 249 | | |
237 | 250 | | |
| |||
283 | 296 | | |
284 | 297 | | |
285 | 298 | | |
286 | | - | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
287 | 302 | | |
288 | 303 | | |
289 | | - | |
| 304 | + | |
290 | 305 | | |
291 | 306 | | |
292 | 307 | | |
| |||
300 | 315 | | |
301 | 316 | | |
302 | 317 | | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
303 | 322 | | |
304 | 323 | | |
305 | 324 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| |||
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
72 | | - | |
| 73 | + | |
73 | 74 | | |
74 | 75 | | |
75 | 76 | | |
| |||
97 | 98 | | |
98 | 99 | | |
99 | 100 | | |
100 | | - | |
101 | | - | |
102 | | - | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
103 | 110 | | |
104 | 111 | | |
105 | 112 | | |
| |||
0 commit comments