Commit 158f575
authored
refactor(advisors): preload deterministic context as tool results (#5386)
## Summary
Refactors the PR review and E2E advisors to preload deterministic
repository/PR context into the Pi SDK session as synthetic
tool-call/tool-result pairs. This keeps advisor prompts focused on
instructions, makes context boundaries clearer in transcripts, and
removes a one-off retired E2E migration ledger rule from the PR review
advisor.
## Changes
- Added synthetic tool-result preloading support to
`tools/advisors/session.mts` and persist those messages into advisor
session exports.
- Moved PR review advisor drift, diff, security, validation, metadata,
and schema context out of interpolated prompt strings and into specific
synthetic tool results.
- Moved general E2E and Vitest scenario advisor metadata, changed files,
diff, and schema context into explicit synthetic tool results.
- Removed `retiredE2eMigrationLedgerChanges` and its special-case
blocker finding from the PR review advisor.
- Updated advisor tests and tool README artifact descriptions for the
new synthetic context layout.
## Type of Change
- [ ] Code change (feature, bug fix, or refactor)
- [x] Code change with doc updates
- [ ] Doc only (prose changes, no code sample modifications)
- [ ] Doc only (includes code sample changes)
## Verification
<!-- Check each item you ran and confirmed. Leave unchecked items you
skipped. Doc-only changes do not require npm test unless you ran it. -->
Targeted checks passed:
- `npm run typecheck:cli`
- `npx vitest run test/pr-review-advisor.test.ts
test/e2e-scenario-advisor.test.ts`
- Biome check on changed advisor files
Attempted `npx prek run --all-files` and `npm test`; both currently fail
in unrelated runtime recovery/secret-boundary tests outside this change
set, so their boxes are left unchecked.
- [ ] `npx prek run --all-files` passes
- [ ] `npm test` passes
- [x] Tests added or updated for new or changed behavior
- [x] No secrets, API keys, or credentials committed
- [ ] Docs updated for user-facing behavior changes
- [ ] `npm run docs` builds without warnings (doc changes only)
- [ ] Doc pages follow the [style
guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md)
(doc changes only)
- [ ] New doc pages include SPDX header and frontmatter (new pages only)
---
<!-- DCO sign-off required by CI. Run: git config user.name && git
config user.email -->
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
## Release Notes
* **Tests**
* Updated test coverage for E2E and PR review advisors to verify new
prompt construction and synthetic context handling.
* **Documentation**
* Updated advisor documentation to clarify how deterministic synthetic
tool results are injected into advisor sessions.
* **Refactor**
* Refactored advisors to use deterministic synthetic tool results for
context injection instead of embedding metadata directly in prompts.
* Removed legacy retired E2E migration ledger detection from PR review
advisor.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->1 parent 39fd60a commit 158f575
9 files changed
Lines changed: 458 additions & 214 deletions
File tree
- test
- tools
- advisors
- e2e-advisor
- pr-review-advisor
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
38 | | - | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
50 | 72 | | |
51 | 73 | | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
57 | 78 | | |
58 | 79 | | |
59 | | - | |
| 80 | + | |
| 81 | + | |
60 | 82 | | |
61 | 83 | | |
62 | 84 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | 21 | | |
23 | 22 | | |
24 | 23 | | |
| |||
45 | 44 | | |
46 | 45 | | |
47 | 46 | | |
48 | | - | |
49 | 47 | | |
50 | 48 | | |
51 | 49 | | |
| |||
261 | 259 | | |
262 | 260 | | |
263 | 261 | | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | 262 | | |
269 | 263 | | |
270 | 264 | | |
| |||
300 | 294 | | |
301 | 295 | | |
302 | 296 | | |
303 | | - | |
| 297 | + | |
304 | 298 | | |
305 | | - | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
306 | 303 | | |
307 | | - | |
308 | | - | |
| 304 | + | |
309 | 305 | | |
| 306 | + | |
| 307 | + | |
310 | 308 | | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
311 | 313 | | |
312 | 314 | | |
313 | | - | |
| 315 | + | |
314 | 316 | | |
315 | 317 | | |
316 | 318 | | |
317 | 319 | | |
318 | 320 | | |
319 | 321 | | |
320 | | - | |
321 | | - | |
322 | | - | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
323 | 327 | | |
324 | 328 | | |
325 | 329 | | |
| |||
344 | 348 | | |
345 | 349 | | |
346 | 350 | | |
| 351 | + | |
347 | 352 | | |
| 353 | + | |
348 | 354 | | |
| 355 | + | |
349 | 356 | | |
| 357 | + | |
350 | 358 | | |
351 | 359 | | |
352 | 360 | | |
353 | 361 | | |
354 | 362 | | |
355 | 363 | | |
356 | 364 | | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
357 | 376 | | |
358 | 377 | | |
359 | 378 | | |
| |||
392 | 411 | | |
393 | 412 | | |
394 | 413 | | |
395 | | - | |
396 | | - | |
397 | | - | |
398 | | - | |
399 | | - | |
400 | | - | |
401 | | - | |
402 | | - | |
403 | | - | |
404 | | - | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
409 | | - | |
410 | | - | |
411 | | - | |
412 | | - | |
413 | | - | |
414 | | - | |
415 | | - | |
416 | | - | |
417 | | - | |
418 | | - | |
419 | | - | |
420 | | - | |
421 | | - | |
422 | | - | |
423 | | - | |
424 | | - | |
425 | | - | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
442 | | - | |
443 | | - | |
444 | 414 | | |
445 | 415 | | |
446 | 416 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
0 commit comments