Add support for newer OpenAI models (GPT-5, O1, O3, O4)#11
Conversation
Recognize o1, o3, o4 and gpt-5 model prefixes used by Codex CLI, and update default fallback model to codex-mini-latest. https://claude.ai/code/session_01MyDdEXVauCTcrkk6zBfK5J
The test_batch_reader_valid_file test was failing because global git commit signing configuration caused commits in the temp test repo to fail. https://claude.ai/code/session_01MyDdEXVauCTcrkk6zBfK5J
|
Claude finished @cmungall's task —— View job Code Review Complete ✅I've thoroughly reviewed this PR that adds support for newer OpenAI models. Overall, this is a well-structured and safe enhancement that follows the project's coding standards. ✅ Summary of ChangesThe PR successfully adds support for:
Changes were made consistently in both ✅ Code Quality AssessmentExcellent Practices Observed:
Follows Repository Standards:
🔍 Detailed AnalysisSecurity: ✅ No Concerns
Performance: ✅ Excellent
Maintainability: ✅ Good
Test Coverage: ✅ Adequate
🎯 Specific Technical FeedbackModel Detection Logic (
|
There was a problem hiding this comment.
Pull request overview
This PR updates the Rust parsing/extraction logic to recognize newer OpenAI model naming schemes (GPT-5 + O-series) when detecting Codex/Copilot traces, and tweaks related defaults/test setup to reduce misclassification and CI flakiness.
Changes:
- Extend
is_codex_model()matching to includegpt-5*,o1*,o3*, ando4*(plus bareo1/o3/o4). - Update the Codex CLI session parser default model string to
codex-mini-latest. - In git-related tests, disable commit signing to avoid failures when GPG signing is enabled by default.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/parsers/common.rs |
Expands shared Codex/OpenAI model detection to include GPT-5 and O-series names. |
src/extractor.rs |
Expands extractor-side Codex/OpenAI model detection used for attribution/format inference. |
src/parsers/codex.rs |
Adjusts the default model string used when parsing Codex CLI sessions. |
src/git_batch.rs |
Updates test repo initialization to disable commit signing during tests. |
| || model.starts_with("gpt-5") | ||
| || model.starts_with("o1-") | ||
| || model.starts_with("o3-") | ||
| || model.starts_with("o4-") | ||
| || model == "o1" |
There was a problem hiding this comment.
New model-prefix support was added here (gpt-5*, o1*, o3*, o4*), but the existing tests only exercise gpt-4/codex-* model strings. Please add/extend tests (e.g., in tests/extractor_test.rs) to assert that these newer model names are recognized and correctly attributed as Codex/Copilot traces.
| // Disable commit signing for tests | ||
| Command::new("git") | ||
| .args(["config", "commit.gpgsign", "false"]) | ||
| .current_dir(&repo_path) | ||
| .output()?; |
There was a problem hiding this comment.
The new git config commit.gpgsign false call ignores the command result. Please check the exit status (and surface stderr) so test failures are easier to diagnose if git isn't available or the config write fails (same applies to the other git config/init calls in this helper).
| // Check for known OpenAI Codex and GPT model prefixes used by Codex CLI / GitHub Copilot | ||
| model.starts_with("codex-") | ||
| || model.starts_with("gpt-4") | ||
| || model.starts_with("gpt-3.5") | ||
| || model.starts_with("gpt-35") | ||
| || model.starts_with("gpt-5") | ||
| || model.starts_with("o1-") | ||
| || model.starts_with("o3-") | ||
| || model.starts_with("o4-") | ||
| || model == "o1" | ||
| || model == "o3" | ||
| || model == "o4" | ||
| } | ||
|
|
There was a problem hiding this comment.
is_codex_model is duplicated here and in src/parsers/common.rs. Since extractor.rs already depends on crate::parsers (e.g., ParserRegistry), consider calling crate::parsers::common::is_codex_model(model) instead and removing this local helper to avoid the two implementations drifting over time.
| // Check for known OpenAI Codex and GPT model prefixes used by Codex CLI / GitHub Copilot | |
| model.starts_with("codex-") | |
| || model.starts_with("gpt-4") | |
| || model.starts_with("gpt-3.5") | |
| || model.starts_with("gpt-35") | |
| || model.starts_with("gpt-5") | |
| || model.starts_with("o1-") | |
| || model.starts_with("o3-") | |
| || model.starts_with("o4-") | |
| || model == "o1" | |
| || model == "o3" | |
| || model == "o4" | |
| } | |
| // Delegate to the shared helper to avoid duplicated model-prefix logic. | |
| crate::parsers::common::is_codex_model(model) | |
| } |
Inspired by git-ai's /ask skill. Users can select code and type /ask to find the original AI conversation that produced it, with the agent answering in first person about its decisions and intent. https://claude.ai/code/session_01MyDdEXVauCTcrkk6zBfK5J
|
Claude finished @cmungall's task —— View job Comprehensive PR Review ✅I've thoroughly reviewed this PR that adds support for newer OpenAI models (GPT-5, O1, O3, O4) to the ai-blame codebase. Overall, this is a well-implemented enhancement with good attention to quality and consistency. Review Tasks Completed:
✅ Summary of ChangesThe PR successfully extends model detection to support:
Additional improvements:
🔍 Code Quality AssessmentStrengths:
Repository Standards Compliance:
🚨 Issues and RecommendationsCritical - Code Duplication (Addresses Copilot Review)Problem: Impact: The two implementations can drift apart over time, leading to inconsistent model detection Recommendation: Remove the duplicate in // In src/extractor.rs:68-81, replace the function with:
fn is_codex_model(model: &str) -> bool {
crate::parsers::common::is_codex_model(model)
}This follows the DRY principle and ensures a single source of truth for model detection logic. Important - Missing Test Coverage (Addresses Copilot Review)Problem: Existing tests only cover Recommendation: Add test cases in #[test]
fn test_new_model_detection() {
assert!(is_codex_model("gpt-5-turbo"));
assert!(is_codex_model("o1"));
assert!(is_codex_model("o1-preview"));
assert!(is_codex_model("o3-mini"));
assert!(is_codex_model("o4"));
}Minor - Git Command Error Handling (Addresses Copilot Review)Issue: In Current: Command::new("git")
.args(["config", "commit.gpgsign", "false"])
.current_dir(&repo_path)
.output()?; // Only checks if command runs, not if it succeedsRecommendation: Check command status to surface errors: let output = Command::new("git")
.args(["config", "commit.gpgsign", "false"])
.current_dir(&repo_path)
.output()?;
if !output.status.success() {
eprintln!("Warning: Failed to disable git signing: {}",
String::from_utf8_lossy(&output.stderr));
}🔒 Security Review✅ No Security Concerns:
🚀 Performance Analysis✅ Excellent Performance:
📋 Detailed Technical FeedbackModel Detection Logic (
|
Summary
This PR extends model detection to support newer OpenAI models including GPT-5, O1, O3, and O4 series, while also improving test reliability and fixing a default model reference.
Key Changes
is_codex_model()function in bothextractor.rsandparsers/common.rsto recognize:gpt-5-*)o1-*ando1)o3-*ando3)o4-*ando4)git_batch.rsto prevent test failures in environments with GPG signing enabledparsers/codex.rsfromgpt-5.2-codextocodex-mini-latestfor better accuracyImplementation Details
The model detection checks use both prefix matching (
starts_with()) for versioned models and exact matching for base model names (e.g.,o1,o3,o4) to handle both naming conventions used by OpenAI.https://claude.ai/code/session_01MyDdEXVauCTcrkk6zBfK5J