Feature UI#7
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the agent's tool verification process by requiring GitHub repository validation before returning tool candidates, and improves the repository information tool with better URL handling and error reporting.
Key changes:
- Agent must now call
repo_info(url)to verify each tool candidate's GitHub repository before returning it in the final output - The
repo_infotool is rewritten to validate GitHub URLs, fetch comprehensive repository summaries via the GitHub REST API, and return structured errors for invalid inputs - Tool call limits increased from 6 to 10 per run to accommodate the stricter verification workflow
Reviewed Changes
Copilot reviewed 7 out of 37 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
tests/test_repo_summary.py |
New test script for the rewritten repo_info tool |
src/ai_agent/utils/previews.py |
Enhanced RGB/color image detection to prevent treating color TIFFs as 3D stacks |
src/ai_agent/ui/app.py |
Added interactive radio selection handler for tool choices with live detail updates |
src/ai_agent/generator/prompts.py |
Updated agent instructions to mandate repo_info verification before returning candidates |
src/ai_agent/agent/tools/repo_info_tool.py |
Complete rewrite: validates GitHub URLs, fetches repo snapshots via GitHub API, builds structured Markdown summaries |
src/ai_agent/agent/agent.py |
Updated to use new tool_repo_summary function with URL validation and increased call limits |
.env.dist |
Added GITHUB_TOKEN for authenticated GitHub API access |
| continue | ||
| for m in INSTALL_PAT.finditer(f.content): | ||
| out.append((m.group(0).strip(), f.path)) | ||
| return _dedupe_pairs(out)[:3] # <-- changed |
There was a problem hiding this comment.
The inline comment # <-- changed appears to be a development artifact and should be removed before merging.
| for m in CLI_LINE_RE.finditer(f.content): | ||
| cmd = re.sub(r"^\s*(\$|>)\s*", "", m.group(0)).strip() | ||
| out.append((cmd, f.path)) | ||
| return _dedupe_pairs(out)[:5] # <-- changed |
There was a problem hiding this comment.
The inline comment # <-- changed appears to be a development artifact and should be removed before merging.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.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.
This pull request updates the agent's pipeline to enforce stricter repository verification for tool candidates and improves error handling and usage limits. The main changes include requiring GitHub repository verification before returning tool candidates, updating the
repo_infotool to validate and handle only GitHub URLs, increasing tool call limits, and clarifying the agent's prompt instructions.Repository verification and tool selection process:
repo_info(url)call using a valid GitHub repository URL orowner/repo. Candidates lacking such a URL are dropped. Only verified candidates are returned, and demo links are resolved after verification.repo_infotool improvements:repo_infotool now validates input URLs, accepting only GitHub URLs orowner/repostrings. If an invalid URL is provided, it returns a structured error and skips the call. Error handling is improved for fetch failures, and the call cap is increased from 2 to 3 per run.agent.pyis updated to usetool_repo_summary,RepoSummaryInput, andcoerce_github_url_or_nonefor the new validation logic.Agent execution and configuration:
GITHUB_TOKENenvironment variable is added to.env.distfor authenticated GitHub API access.