feat(examples): add automated code review agent example (Skills + sandbox + DB storage)#198
feat(examples): add automated code review agent example (Skills + sandbox + DB storage)#198DNKYr wants to merge 22 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #198 +/- ##
==========================================
Coverage ? 87.84906%
==========================================
Files ? 482
Lines ? 45157
Branches ? 0
==========================================
Hits ? 39670
Misses ? 5487
Partials ? 0 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
是否可以补充一下设计文档? |
AI Code Review我已完整审阅 发现的问题
|
感谢review!我已经添加设计中英双文设计文档在:example/doc/design.md 和 example/doc/design_zh.md 现在将Fix Code Warning |
Cube runtimes create sandbox clients with network connections that must be explicitly destroyed. The session.close() handles workspace teardown, but cube sandboxes persist until destroy() is called. Container and local runtimes are no-ops for this check.
AI Code Review我已经完整阅读了 发现的问题🚨 Critical
|
| warnings: list[str] = [] | ||
| runner = Runner(app_name="code_review_agent", agent=agent, | ||
| session_service=InMemorySessionService()) | ||
| prompt = REVIEW_REQUEST_TEMPLATE.format( |
There was a problem hiding this comment.
静态 findings 未脱敏即送外部 LLM
发送给 LLM 的 prompt 仅对 diff 做 redact_text,findings_json 直接序列化原始 finding(含 evidence/title/recommendation)。当一行同时包含密钥与另一类模式时,security finding 的 evidence 会以明文送入外部 LLM,与示例“密钥不外泄”的承诺冲突。建议对每个 finding 的文本字段先 redact_text 再序列化。
AI Code Review发现的问题
|
…inally, handle JSON-escaped quotes in sensitive_assign pattern 1. run_llm_review now redacts each finding's evidence/title/recommendation individually before JSON serialization, plus a belt-and-braces pass over the serialized string. This prevents non-secrets checkers from leaking raw source code (potentially containing keys) to the LLM. 2. runtime.destroy() moved into a finally block so cube sandbox client resources are released even when session.open() or run_llm_review() raises an exception. 3. sensitive_assign regex updated to match both raw and JSON-escaped quotes (e.g. password = \"value\" in serialized JSON), so post-serialization redaction still catches password-style secrets.
AI Code Review我已经审查了完整的 diff。该 PR 添加了一个完整的 发现的问题
|
Summary
Adds
examples/skills_code_review_agent/— an automated code-review agent prototype that integrates the tRPC-Agent SDK's Skill system, workspace runtimes (local/container/cube), Filter governance, and SQL persistence.Closes #92.
What's Included
env -ienvironment whitelist, 60s timeouts, 256KB output caps; local fallback (dev-only); cube support (env-configured)review(--diff-file / --repo-path / --fixture, --runtime, --dry-run) +show --task-idVerification
Container mode: opt-in via
CR_CONTAINER_TESTS=1(requires Docker).