feat: enhance research functionality with query building and refinement tracking - #37
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The follow-up research path is bypassed, and query context can grow recursively.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Enhances research follow-ups with contextual query construction, refinement tracking, output formatting changes, and tests.
Changes:
- Tracks refinements and prior findings in research queries.
- Uses constructed queries in
ResearcherAgent. - Adjusts result metadata output and adds query-building tests.
File summaries
| File | Summary | Findings |
|---|---|---|
ResearchState.cs |
Tracks refinements and builds contextual queries. | Moderate (1 vote): Query context can grow recursively, including failed queries. Nit (3 votes): The active subtask may be duplicated in refinement history. |
ResearcherAgent.cs |
Sends constructed queries to the research agent. | Critical (2 votes): Follow-up flow bypasses the refinement query and research stage. |
Program.cs |
Reorders result metadata output. | Nit (3 votes): Duplicate and misplaced result separators remain. |
BlogWriter.Tests/ResearchStateTests.cs |
Tests query composition. | No findings. |
Review details
Suppressed comments (1)
ResearchState.cs:69
- Passing every prior finding through the next query makes the request grow on every refinement. If the hosted agent rejects an oversized query,
InvokeAsyncfalls back with a string containing the entire query, and this code stores that string as another finding, so later queries can recursively balloon and repeatedly fail. Bound or summarize the prior context and avoid persisting the failed query as a finding.
string context = string.Join("\n\n", ResearchFindings
.Where(f => !string.IsNullOrWhiteSpace(f))
.Select(f => f.Trim()));
- Files reviewed: 4/4 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| { | ||
| string subTask = !string.IsNullOrEmpty(state.CurrentSubTask) ? state.CurrentSubTask : state.MainTask; | ||
| _logger.LogInformation("Researching: {SubTask}", subTask); | ||
| string query = state.BuildResearchQuery(); |
Comment on lines
211
to
+214
| Console.WriteLine("============================="); | ||
| Console.WriteLine($"\n\nRevision Number: {result.RevisionNumber}"); | ||
| Console.WriteLine($"\nSession: {session.Id}\n"); | ||
| Console.WriteLine("============================="); |
Comment on lines
+55
to
+57
| string uniqueRefinements = string.Join(" | ", SearchRefinements | ||
| .Where(r => !string.IsNullOrWhiteSpace(r)) | ||
| .Distinct(StringComparer.OrdinalIgnoreCase)); |
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.
No description provided.