-
Notifications
You must be signed in to change notification settings - Fork 1
Add QC orchestrator with git2 integration and 200-line PR policy #58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: zapabob <[email protected]>
Co-authored-by: zapabob <[email protected]>
Co-authored-by: zapabob <[email protected]>
Co-authored-by: zapabob <[email protected]>
Co-authored-by: zapabob <[email protected]>
codex-rs/tui/Cargo.toml
Outdated
| [package] | ||
| name = "codex-tui" | ||
| version = "2.3.0" | ||
| edition = "2021" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2024
|
I have read the CLA Document and I hereby sign the CLA 0 out of 2 committers have signed the CLA. |
|
I have read the CLA Document and I hereby sign the CLA |
Summary
Implements production QC orchestrator invoked via
codex qcCLI. Analyzes git diffs, executes test profiles, scores risk, enforces 200-line policy, writes structured logs to_docs/logs/.Motivation
Need automated quality gates before merge. Manual review insufficient for risk assessment at scale. 200-line policy required formal enforcement.
Changes
Core Module (
codex-rs/core/src/qc_orchestrator.rs, 767 lines)TestProfile,QcConfig,QcInput,DiffStats,CommandStatus,TestResult,Recommendation,QcResultmain→origin/main→origin/master→HEAD~1)MergeOk/NeedsFix/CreatePrForReview(triggered at >200 lines)_docs/logs/YYYY-MM-DD-{worktree}-impl.mdwith timestamp, stats, results, risk, issuesCLI Integration (
codex-rs/cli/src/main.rs)/qcsubcommand via clap with args:--feature,--profile,--agent-name,--ai-namecodex-rs/for Rust testsTests (9 total)
Documentation
codex-rs/_docs/qc-orchestrator.md: comprehensive user guideQC_IMPLEMENTATION_SUMMARY.md: technical detailsInfrastructure
[workspace]declarations incli/Cargo.tomlandtui/Cargo.tomlType of Change
Component
Testing
Test Environment:
Test Results:
Self-validation: QC analyzed own implementation, correctly recommended
CreatePrForReviewdue to 423 lines changed.Security Impact
Checklist
Screenshots (if applicable)
N/A - CLI tool with text output shown in Changes section
Additional Notes
Ready for Tauri GUI integration. Log format designed for both CLI and GUI consumption. Base ref fallback handles various repo configurations robustly.
Original prompt
Implement a fully working QC orchestrator feature in the zapabob/codex repository and open a PR.
Goal
/qcslash subcommand from the Rust CLI and later from the Tauri GUI._docs/logs.Key requirements
CLI integration (
codex-rs/cli/src/main.rsand related CLI code)/qcexposed as a slash-style command so it can be called as:codex /qc --profile standard --feature "..." --agent-name "..." --ai-name "..."profile(optional):minimal | standard | full, default from config.agent_name(optional): logical agent name (e.g.codex-cli-agent), default to a sensible value.ai_name(optional): model/front-end identifier (e.g.claude-code,gemini,gpt-4.1), default to a sensible value.feature(optional): short human-readable description of the change./qcshould:QcInputstruct and call a newrun_qcAPI in aqc_orchestratormodule.QC orchestrator module (new Rust module, e.g.
codex-rs/core/src/qc_orchestrator.rsor appropriate location)Stringmaps) to represent configuration, inputs, diff stats, test results, and the QC outcome. For example:TestProfileenum:Minimal,Standard,Full(withfrom_strandas_str).QcConfigstruct:default_profile: TestProfile,max_lines_without_pr: usize,base_ref: String.QcInputstruct:feature,agent_name,ai_name,profile.DiffStatsstruct:changed_lines,changed_files.CommandStatusenum:NotRun { reason },Passed,Failed { summary }.TestResultstruct:label,command,status,warnings.Recommendationenum:MergeOk,NeedsFix,CreatePrForReview.QcResultstruct:timestamp,worktree,diff,tests,risk_score,recommendation,reasons,issues,log_path.run_qc(repo_root: &Path, input: QcInput, config: QcConfig) -> Result<QcResult, anyhow::Error>that:chrono::Local.config.base_ref(e.g.mainor configured branch) andHEAD:changed_lines= sum of added+deleted lines fromgit2::DiffLineType::Addition | Deletion.changed_files= count of non-unmodified deltas.input.profile:Minimal:cargo test -p codex-cli.Standard(default):cargo test --all.cargo clippy --all --all-targets -- -D warnings.pnpm testor, if pnpm is unavailable,npm test.Full:Standard.cargo tarpaulin --workspace.pnpm lintornpm run lint.std::process::Commandto run these commands relative torepo_root.TestResultinstances; never panic if a command is missing. Instead, mark that test asNotRun { reason }.risk_score: f32using diff size and failed tests (e.g. add weight for failures and for large diffs, then clamp to 0.0–1.0).Recommendationplus textual reasons:NeedsFix.changed_lines > max_lines_without_pr(200), override recommendation toCreatePrForReviewand add a reason mentioning the "200行ルール".risk_score > 0.7but diff is small, still considerNeedsFix.worktreename for logging (e.g. fromHEADbranch name or worktree path) using git2._docs/logs/YYYY-MM-DD-{worktree}-impl.md(see logging).Logging in
_docs/logs_docs/logsin the repo root._docs/logsif it does not exist._docs/logs/YYYY-MM-DD-{worktree}-impl.mdLocal::now().This pull request was created as a result of the following prompt from Copilot chat.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.