codex/黄超健#25
Open
MRX1205 wants to merge 1 commit into
Hidden character warning
The head ref may contain hidden characters: "codex/\u9ec4\u8d85\u5065"
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Implements the previously placeholder “enterprise agent” execution loop end-to-end, adding deterministic planning, tool execution with auditing/events, RAG retrieval, and systematic sensitive-data redaction.
Changes:
- Replace placeholder worker with Planner → Executor → ToolRegistry execution, persisting run/task status, results, events, audit logs, and token cost.
- Add security protections: prompt-injection detection on task creation and centralized sanitization applied to tool outputs, run events, audit logs, and stored results.
- Enhance RAG and admin metrics: permission-aware search + citations/filtered docs, and dashboard fields for duration, recent failures, and queue health.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_acceptance_guidance.py | Removes xfail so acceptance guidance now runs as normal tests. |
| agentops_assessment/security.py | Adds centralized sanitize() for redacting sensitive keys/text. |
| agentops_assessment/rag/security.py | Tightens prompt injection detection patterns and simplifies docstring. |
| agentops_assessment/rag/search.py | Implements permission-aware retrieval, scoring, citations, and answer stub. |
| agentops_assessment/backend/worker.py | Implements full background execution flow and persists run/task updates. |
| agentops_assessment/backend/database.py | Sanitizes run event and audit log payloads before persisting. |
| agentops_assessment/backend/auth.py | Adds audit logging for permission denials in require_permissions. |
| agentops_assessment/backend/app.py | Adds prompt-injection rejection + audit; enforces run ownership/admin access. |
| agentops_assessment/agent/tools.py | Sanitizes tool outputs at the registry boundary. |
| agentops_assessment/agent/planner.py | Adds deterministic plan creation incl. SKU extraction and optional OA step. |
| agentops_assessment/agent/executor.py | Implements step execution, arg rendering, events/audits, and final result assembly. |
| agentops_assessment/admin/metrics.py | Adds average duration, recent failures, and queue health metrics. |
| COLLABORATION_LOG.md | Documents decisions, assumptions, verification results, and remaining risks. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+36
to
+38
| lowered = key.lower() | ||
| if key in SENSITIVE_KEYS or any(marker in lowered for marker in SENSITIVE_KEYS): | ||
| continue |
Comment on lines
+45
to
+46
| for marker in SENSITIVE_TEXT: | ||
| cleaned = cleaned.replace(marker, "[redacted]") |
Comment on lines
+219
to
+220
| has_stock_risk = current_stock < safety_stock or forecast_units > available_stock | ||
| return bool(has_stock_risk and (stock_gap >= 30 or sales_impact > 5000 or forecast_units > available_stock)) |
Comment on lines
+229
to
+231
| with database.connect() as conn: | ||
| database.init_db(conn) | ||
| database.insert_run_event(conn, run_id, event_type, payload, tool_name=tool_name) |
Comment on lines
+241
to
+243
| with database.connect() as conn: | ||
| database.init_db(conn) | ||
| database.insert_audit_log(conn, actor_id, action, resource, payload, decision=decision) |
Comment on lines
+86
to
+88
| def _needs_approval_draft(prompt: str) -> bool: | ||
| markers = ["创建", "审批草稿", "审批建议", "补货审批", "生成补货"] | ||
| return any(marker in prompt for marker in markers) |
| ] | ||
|
|
||
|
|
||
| def sanitize(value: Any) -> Any: |
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.
完成能力点
oa:approval:write,缺权限时跳过并审计。核心设计思想和重要取舍
本地验证命令和结果
python scripts/self_check.py:通过,公开自检完成。python -m pytest -q:通过,10 passed, 1 warning。已知未完成事项或风险
兼容影响
tests/test_acceptance_guidance.py从 xfail 指导测试转为普通回归测试,用于校准业务闭环、权限、RAG、脱敏和可见性。协作者和分工
COLLABORATION_LOG.md 关键结论摘要