[codex] add artifact contract CI pipeline - #4
Conversation
|
Warning Review limit reached
More reviews will be available in 50 minutes and 26 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more credits in the billing tab to continue. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses rolling per-developer review limits. Reviews become available again as older review attempts age out of the rolling limit window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (40)
📝 WalkthroughWalkthroughAdds a Rust ChangesRust CLI Crate
GitHub Solution Research Feature
Project Discovery Utility
CI/CD, Documentation Corpus, and Config
Sequence Diagram(s)sequenceDiagram
participant Agent
participant invoke_code_intel as invoke-code-intel.ps1
participant run_code_intel as run-code-intel.ps1
participant Invoke_GHResearch as Invoke-GitHubSolutionResearch.ps1
participant gh as gh CLI
participant HospitalReport as New-CodeIntelHospitalReport
Agent->>invoke_code_intel: -RepoPath ./repo -SkipGitHubResearch
invoke_code_intel->>run_code_intel: -SkipGitHubResearch
run_code_intel->>run_code_intel: classify failures → githubResearch decision
alt research required and not skipped
run_code_intel->>Invoke_GHResearch: -FailedSteps -FailureClassifications
Invoke_GHResearch->>gh: gh search issues/prs/repos/code
gh-->>Invoke_GHResearch: JSON candidates
Invoke_GHResearch-->>run_code_intel: {status, path, markdown, required}
else skipped or gh missing
run_code_intel->>run_code_intel: set manual_required githubResearch
end
run_code_intel->>HospitalReport: GitHubResearch object
HospitalReport->>HospitalReport: Get-HospitalNextProtocol → github_solution_research
HospitalReport-->>run_code_intel: hospital-report.json + .md
run_code_intel-->>Agent: report.json, summary.md, understanding.md
Estimated code review effort🎯 5 (Critical) | ⏱️ ~120 minutes Poem
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request introduces a new Rust CLI tool code-intel to resume, classify, and diagnose artifact runs, along with a defined artifact data contract and a PowerShell helper Invoke-GitHubSolutionResearch.ps1 to research pipeline blockers on GitHub. Feedback on these changes highlights a critical bug in run-code-intel.ps1 where an undefined $root variable will cause a strict-mode crash, as well as opportunities to improve the Rust CLI's robustness by gracefully handling missing directories, unreadable entries, and invalid JSON files. Additionally, unit tests in the CLI should be updated to clean up their temporary directories on disk.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
|
||
| $githubResearch = New-GitHubSolutionResearchNotApplicable | ||
| if (Test-GitHubSolutionResearchRequired $failureCounts) { | ||
| $githubResearchScript = Join-Path $root "Invoke-GitHubSolutionResearch.ps1" |
There was a problem hiding this comment.
The variable $root is not defined anywhere in run-code-intel.ps1. Since Set-StrictMode -Version Latest is enabled, referencing this undefined variable will throw a runtime exception and crash the script when GitHub solution research is triggered. It should be replaced with $PSScriptRoot to correctly reference the script's directory.
$githubResearchScript = Join-Path $PSScriptRoot "Invoke-GitHubSolutionResearch.ps1"
| fn latest_run_dir(repo_artifacts: &Path) -> Result<PathBuf> { | ||
| let mut dirs = Vec::new(); | ||
| for entry in fs::read_dir(repo_artifacts)? { | ||
| let entry = entry?; | ||
| if entry.file_type()?.is_dir() { | ||
| dirs.push(entry.path()); | ||
| } | ||
| } |
There was a problem hiding this comment.
If the repo_artifacts directory does not exist, fs::read_dir will return an error and crash the CLI. Additionally, if any single entry within the directory is unreadable (e.g., due to permission issues), entry? or entry.file_type()? will fail and abort the entire scan. It is more robust to handle the missing directory with a helpful error message and skip unreadable entries gracefully.
fn latest_run_dir(repo_artifacts: &Path) -> Result<PathBuf> {
let mut dirs = Vec::new();
let entries = fs::read_dir(repo_artifacts).map_err(|e| {
format!(
"failed to read artifact directory '{}': {e}. Has the scanner run at least once?",
repo_artifacts.display()
)
})?;
for entry in entries {
if let Ok(entry) = entry {
if let Ok(ft) = entry.file_type() {
if ft.is_dir() {
dirs.push(entry.path());
}
}
}
}| fn read_json(path: &Path) -> Result<Value> { | ||
| let text = fs::read_to_string(path)?; | ||
| Ok(serde_json::from_str(text.trim_start_matches('\u{feff}'))?) | ||
| } |
There was a problem hiding this comment.
If the JSON file is empty or contains invalid JSON, serde_json::from_str will fail. Attaching context to the error helps the user identify which file failed to parse.
fn read_json(path: &Path) -> Result<Value> {
let text = fs::read_to_string(path).map_err(|e| {
format!("failed to read file '{}': {e}", path.display())
})?;
serde_json::from_str(text.trim_start_matches('\u{feff}')).map_err(|e| {
format!("failed to parse JSON in '{}': {e}", path.display()).into()
})
}| assert!(!summary.research_required); | ||
| assert_eq!(next_read(&summary), dir.join("understanding.md")); | ||
| } |
There was a problem hiding this comment.
The test creates a temporary directory on disk but does not clean it up, leading to accumulation of leftover directories in the system's temp folder. Consider cleaning up the directory at the end of the test.
| assert!(!summary.research_required); | |
| assert_eq!(next_read(&summary), dir.join("understanding.md")); | |
| } | |
| assert!(!summary.research_required); | |
| assert_eq!(next_read(&summary), dir.join("understanding.md")); | |
| let _ = fs::remove_dir_all(&dir); | |
| } |
| assert_eq!(summary.hospital_next_protocol, "github_solution_research"); | ||
| assert_eq!(next_read(&summary), research_markdown); | ||
| } |
There was a problem hiding this comment.
The test creates a temporary directory on disk but does not clean it up, leading to accumulation of leftover directories in the system's temp folder. Consider cleaning up the directory at the end of the test.
| assert_eq!(summary.hospital_next_protocol, "github_solution_research"); | |
| assert_eq!(next_read(&summary), research_markdown); | |
| } | |
| assert_eq!(summary.hospital_next_protocol, "github_solution_research"); | |
| assert_eq!(next_read(&summary), research_markdown); | |
| let _ = fs::remove_dir_all(&dir); | |
| } |
c1669ba to
66821a6
Compare
66821a6 to
0bf0d3b
Compare
Summary
Validation