Skip to content

feat(examples): add skills-based code review agent with sandbox and database#138

Open
coder-mtj wants to merge 2 commits into
trpc-group:mainfrom
coder-mtj:feat/issue-92-cr-agent
Open

feat(examples): add skills-based code review agent with sandbox and database#138
coder-mtj wants to merge 2 commits into
trpc-group:mainfrom
coder-mtj:feat/issue-92-cr-agent

Conversation

@coder-mtj

Copy link
Copy Markdown

Description | 描述

Automated code review agent using Skills + sandbox + database storage.

Implements the full pipeline: diff parsing → Filter safety check → 6-category rule scanning → sandbox execution → deduplication + redaction → JSON/MD report → SQLite persistence.

Related Issue | 关联 Issue

Fix #92

Change Type | 修改类型

  • New feature | 新功能
  • Documentation update | 文档更新

Test Coverage | 测试覆盖

  • 116 tests across 8 test modules, all passing
  • 8 fixture diff files covering all acceptance criteria
  • Verified locally: python -m pytest examples/skills_code_review_agent/tests/ -v

Self-test Checklist | 自测清单

  • Verified locally | 本地验证通过
  • No existing features affected | 无影响现有功能
  • All 8 fixture diffs generate valid reports
  • Database stores task/findings/sandbox_runs/filter_logs correctly
  • Fake mode completes in <2 minutes

…atabase

Implements trpc-group#92 — automated code review agent with:
- 6 rule scanners (security, async, resource leak, DB lifecycle, missing tests, secret info)
- Filter chain for pre-execution safety interception
- Local sandbox with timeout/output limits/env isolation
- Deduplication and sensitive info redaction
- JSON + Markdown report generation
- SQLite persistence (4 tables: tasks, findings, sandbox_runs, filter_logs)
- 8 test fixture diffs covering all acceptance criteria
- 116 tests across 8 test modules (unit + integration + acceptance)

Signed-off-by: coder-mtj <coder-mtj@users.noreply.github.com>
@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@a547d6b). Learn more about missing BASE report.

Additional details and impacted files
@@            Coverage Diff             @@
##             main        #138   +/-   ##
==========================================
  Coverage        ?   87.51874%           
==========================================
  Files           ?         467           
  Lines           ?       44018           
  Branches        ?           0           
==========================================
  Hits            ?       38524           
  Misses          ?        5494           
  Partials        ?           0           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…, 3-tier confidence, AST analysis, SARIF output, schema versioning, and full documentation

Bug fixes:
- Fix report.py severity/category confusion (secret_info is a category, not severity)
- Fix sandbox script path resolution to locate skills/ from repo root
- Fix run_review.py emoji to ASCII-safe for Windows GBK compatibility
- Fix agent.py hardcoded model → env-var-driven configuration
- Fix SKILL.md missing references (create OUTPUT_SCHEMA.md, rules/rules.json)
- Fix run_checks.py from stub to functional scanner execution

Feature enhancements:
- Three-tier confidence system (high >=0.8 / warning >=0.55 / needs_human_review)
- Policy-as-code filter governance (filter_policy.json)
- FakeSandboxRunner with trigger-based edge case simulation
- AST taint analysis (Python AST + JS/TS regex)
- 4 new scanners: bare_except, mutable_defaults, assert_control_flow, hardcoded_paths
- Per-scanner confidence thresholds
- Schema versioning with incremental column migrations (v1→v4)
- SARIF v2.1.0 output for GitHub Code Scanning
- Fixture evaluation framework with precision/recall/F1
- Multi-input support (--diff-file, --repo-path, stdin)

Test expansion (116 → 205 tests, 9 → 15 files):
- test_agent.py (8), test_ast_analyzer.py (18), test_cli.py (12)
- test_edge_cases.py (22), test_performance.py (8), test_fixture_evaluation.py (10)

Documentation:
- DESIGN.md (159 lines): architecture, design decisions, trade-offs
- README.md: bilingual, CLI reference, scan categories table
- ai-prompts.md: 4-round development record
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

基于 Skills + 沙箱 + 数据库存储构建自动代码评审 Agent

1 participant