Skip to content
This repository was archived by the owner on Oct 20, 2026. It is now read-only.

chore: tidy repo, default to OpenAI, fix silent review failures - #5

Merged
aimanmalib merged 7 commits into
mainfrom
chore/tidy
Oct 20, 2026
Merged

aimanmalib merged 7 commits into
mainfrom
chore/tidy

Conversation

@aimanmalib

Copy link
Copy Markdown
Owner

Tidy-up so the repo is honest and works out of the box for someone who only has an OpenAI or OpenRouter key.

What changed

Behaviour / bug fixes

  • Default provider is now openai (was Xiaomi MiMo). MiMo stays a preset; MiMoClient, MiMoConfig and the legacy mimo: YAML block keep working.
  • Client sends "stream": false explicitly. Found in the real smoke test: an OpenAI-compatible server that streams by default when stream is omitted made every agent fail to parse and come back empty.
  • The CLI now prints the review. Text output used to show only tokens and duration, never the findings. Text/markdown now render each agent's output plus the summary; JSON includes per-agent status/error and the summary report; --output works for every format.
  • Failures are no longer silent. If every review agent fails (bad key, unreachable endpoint), the command exits 1 with the first error and skips the summary call. Before, it printed "Review Complete!" and exited 0.
  • Other client fixes: temperature=0 was ignored (or fallback), null usage/content fields crashed parsing, and 4xx errors such as 401 were retried. Retries now cover only 429/5xx/network errors.
  • Status output goes to stderr, so -f json on stdout is parseable. An empty directory is an error.

Packaging

  • LICENSE holder: Muhammad Aiman. pyproject: author, project URLs, SPDX license = "MIT", 3.13 + OS/console classifiers.
  • Distribution renamed mimo-codeguard → codeguard-llm (never published on PyPI). The import package and CLI are still codeguard.
  • Removed 4 dependencies that are never imported (gitpython, tiktoken, radon, bandit) and the empty setup.cfg.
  • Ruff rule set pinned explicitly (ruff 0.17 widened its defaults, so an unchanged main would have started failing CI). Auto-fixes applied.

Repo hygiene

  • CI: Python 3.10–3.13, actions/checkout@v5, actions/setup-python@v6, read-only token.
  • .github/dependabot.yml (pip + github-actions, monthly, minor/patch grouped) and SECURITY.md (private reports via GitHub Security Advisories).
  • README checked against the code: removed the hand-typed test-count badge and the token-consumption estimates, which can't be reproduced. The providers table now matches the presets, and the config example shows only options the code reads (it no longer implies ${VAR} expansion). Quick Start is verified. Added the Sasa Teguh footer. CONTRIBUTING no longer has a stale test count.

How it was verified

  • pytest: 53 → 65 passed, with -W error::DeprecationWarning, on Python 3.10, 3.12 and 3.13. New tests cover the client (stream flag, zero temperature, null fields, retry policy), the orchestrator (all-fail path) and the CLI output.
  • ruff check + ruff format --check are clean.
  • In a fresh venv: pip install -e . works, codeguard --version and codeguard --help run, and the wheel metadata is checked with uv build.
  • Real end-to-end smoke test against an OpenAI-compatible endpoint (Gemini Flash model), set up only through the openai preset env vars and a YAML config, with no code edits. I reviewed a 4-line file that has a SQL injection.
    • Before the fix: all 7 calls returned HTTP 200, yet every agent's output was empty and the CLI still reported success.
    • After the fix: 7 calls, about 26 s. All 6 agents succeeded. Security flagged the SQL injection as critical (CWE-89) and the summary recommended REQUEST_CHANGES.
  • Failure path: with an unreachable endpoint the command exits 1 with "all review agents failed (first error: All connection attempts failed)".

🤖 Generated with Claude Code

aimanmalib and others added 7 commits October 20, 2026 06:30
ruff 0.17 widened its default rule set, so an unpinned CI would start
failing on code that hasn't changed. Select an explicit rule set
(E, F, I, UP, B) and apply the resulting fixes (import order, PEP 604
optionals, strict zip, one long line).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A fresh install now works with just OPENAI_API_KEY (or any provider
picked in codeguard.yaml) instead of defaulting to the Xiaomi MiMo
endpoint. MiMo stays available as a preset; the MiMoClient/MiMoConfig
names and the legacy top-level `mimo:` YAML block keep working.
Internals now use LLMClient / config.llm directly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Found in a real run against an OpenAI-compatible router: when `stream`
is omitted it answers with server-sent events, the JSON parse fails, and
every agent came back empty. Send "stream": false explicitly.

Also: honour temperature=0 / max_tokens=0 instead of treating them as
unset, tolerate null usage/content fields, retry only on 429/5xx and
transport errors (an invalid key now fails fast instead of retrying).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The text output only showed token count and duration, never the actual
findings, and a run where every agent failed (bad key, wrong endpoint)
still reported "Review Complete!" with exit code 0.

- text/markdown output now render each agent's findings and the summary
- JSON output includes per-agent status/error and the summary report
- --output works for every format
- the review fails (exit 1, with the first error) when all review agents
  fail, without spending a call on the summary agent
- status messages go to stderr so `-f json` on stdout stays parseable
- a directory with no supported source files is an error
- fix the package docstring, which listed commands that don't exist

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- LICENSE: copyright holder is Muhammad Aiman
- pyproject: real author, project URLs, SPDX license expression,
  Python 3.13 + OS/console classifiers
- rename the distribution to codeguard-llm (was mimo-codeguard; never
  published). Import package and CLI stay `codeguard`
- drop dependencies that are never imported (gitpython, tiktoken,
  radon, bandit)
- remove the empty setup.cfg; pyproject.toml is the only packaging file
- ignore uv.lock

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- CI matrix adds Python 3.13; actions/checkout@v5, actions/setup-python@v6
- workflow token is read-only
- Dependabot: pip + github-actions, monthly, minor/patch grouped
- SECURITY.md: report privately via GitHub Security Advisories

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- drop the hand-typed test-count badge (CI badge stays)
- providers table generated from the actual presets, OpenAI marked as
  default, plus the <PROVIDER>_BASE_URL override
- Quick Start verified: clone, pip install -e ., OPENAI_API_KEY, review
- config example only shows options the code uses; note that ${VAR}
  is not expanded inside the YAML (the old example implied it was)
- remove the unverifiable token-consumption estimates
- document output formats, exit status and the dev workflow
- CONTRIBUTING: no stale test count, 3.10-3.13, current good-first-issues
- footer: Built by Sasa Teguh

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@aimanmalib
aimanmalib merged commit 1bfd5bd into main Oct 20, 2026
4 checks passed
@aimanmalib
aimanmalib deleted the chore/tidy branch October 20, 2026 06:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant