refactor(advisors): preload deterministic context as tool results#5386
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (9)
📝 WalkthroughWalkthroughThis PR refactors advisor session infrastructure to decouple deterministic context metadata from prompt text through synthetic tool results. The core session plumbing defines synthetic tool result types and injection logic; E2E advisor, scenario advisor, and PR review advisor are updated to build prompt turns with tool-attached metadata/diff/schema; retired E2E migration ledger governance is removed from PR review; tests are updated to validate the new flow. ChangesAdvisor prompt refactoring to synthetic tool results
Sequence DiagramssequenceDiagram
participant runReadOnlyAdvisor
participant injectSyntheticToolResults
participant session.agent.state.messages
participant sessionManager
runReadOnlyAdvisor->>injectSyntheticToolResults: pass turn + syntheticToolResults
injectSyntheticToolResults->>injectSyntheticToolResults: sanitizeToolName, uniqueToolCallId
injectSyntheticToolResults->>session.agent.state.messages: append assistant toolCall + toolResult
injectSyntheticToolResults->>sessionManager: appendMessage (persist synthetic entries)
runReadOnlyAdvisor->>session.agent.state.messages: append user prompt turn
Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Code Coverage OverviewLanguages: TypeScript TypeScript / code-coverage/pluginThe overall coverage in the branch is 96%. Coverage data for the branch is not yet available. Show a code coverage summary of the most covered files.
TypeScript / code-coverage/cliThe overall coverage in the branch is 44%. Coverage data for the branch is not yet available. Show a code coverage summary of the most covered files.
Updated |
E2E Advisor RecommendationRequired E2E: None Full advisor summaryE2E Recommendation AdvisorBase: Required E2E
Optional E2E
New E2E recommendations
|
Vitest E2E Scenario RecommendationRequired Vitest E2E scenarios: None Full Vitest E2E advisor summaryVitest E2E Scenario AdvisorBase: Required Vitest E2E scenarios
Optional Vitest E2E scenarios
Relevant changed files
|
PR Review AdvisorFindings: 1 needs attention, 2 worth checking, 0 nice ideas Review findings🛠️ Needs attention
🔎 Worth checking
🌱 Nice ideas
Consider writing more tests for
This is an automated advisory review. A human maintainer must make the final merge decision. |
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
tools/advisors/session.mtsand persist those messages into advisor session exports.retiredE2eMigrationLedgerChangesand its special-case blocker finding from the PR review advisor.Type of Change
Verification
Targeted checks passed:
npm run typecheck:clinpx vitest run test/pr-review-advisor.test.ts test/e2e-scenario-advisor.test.tsAttempted
npx prek run --all-filesandnpm 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-filespassesnpm testpassesnpm run docsbuilds without warnings (doc changes only)Signed-off-by: Carlos Villela cvillela@nvidia.com
Summary by CodeRabbit
Release Notes
Tests
Documentation
Refactor