Add QC orchestrator with git2 integration and 200-line PR policy#58
Draft
Add QC orchestrator with git2 integration and 200-line PR policy#58
Conversation
Co-authored-by: zapabob <130830376+zapabob@users.noreply.github.com>
Co-authored-by: zapabob <130830376+zapabob@users.noreply.github.com>
Co-authored-by: zapabob <130830376+zapabob@users.noreply.github.com>
Co-authored-by: zapabob <130830376+zapabob@users.noreply.github.com>
Co-authored-by: zapabob <130830376+zapabob@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add QC orchestrator feature to codex repository
Add QC orchestrator with git2 integration and 200-line PR policy
Nov 19, 2025
zapabob
reviewed
Nov 19, 2025
codex-rs/tui/Cargo.toml
Outdated
| [package] | ||
| name = "codex-tui" | ||
| version = "2.3.0" | ||
| edition = "2021" |
|
I have read the CLA Document and I hereby sign the CLA 0 out of 2 committers have signed the CLA. |
Owner
|
I have read the CLA Document and I hereby sign the CLA |
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.
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.