-
-
Notifications
You must be signed in to change notification settings - Fork 846
fix: 修复 file_path 始终为 null 的问题 #217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Windelly
wants to merge
6
commits into
lintsinghua:v3.0.0
Choose a base branch
from
Windelly:fix/filepath-null
base: v3.0.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
7763d0a
fix: 修复 file_path 始终为 null 的问题
Windelly e10fb57
fix: address Qodo review feedback for PR #217
Windelly 5b9d3e0
chore: trigger Qodo re-review
Windelly f3d0b74
fix: address Qodo review - normalize None guard, stats consistency, t…
Windelly 9c77394
fix: Qodo round 3 - type-safe stats, guarded cross-file merge
Windelly e56dcfd
fix: define files_with_findings_set and populate filtered_findings
Windelly File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
backend/alembic/versions/009_add_verdict_to_agent_findings.py
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| """Add verdict column to agent_findings | ||
|
|
||
| Revision ID: 009_add_verdict_to_agent_findings | ||
| Revises: 008_add_files_with_findings | ||
| Create Date: 2026-05-04 | ||
|
|
||
| """ | ||
| from alembic import op | ||
| import sqlalchemy as sa | ||
|
|
||
|
|
||
| # revision identifiers, used by Alembic. | ||
| revision = '009_add_verdict_to_agent_findings' | ||
| down_revision = '008_add_files_with_findings' | ||
| branch_labels = None | ||
| depends_on = None | ||
|
|
||
|
|
||
| def upgrade() -> None: | ||
| op.add_column('agent_findings', sa.Column('verdict', sa.String(length=30), nullable=True)) | ||
|
|
||
|
|
||
| def downgrade() -> None: | ||
| op.drop_column('agent_findings', 'verdict') |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -194,6 +194,7 @@ class AgentFindingResponse(BaseModel): | |
| status: str | ||
|
|
||
| suggestion: Optional[str] = None | ||
| verdict: Optional[str] = None | ||
| poc: Optional[dict] = None | ||
|
|
||
| created_at: datetime | ||
|
|
@@ -1264,9 +1265,17 @@ async def _save_findings( | |
| file_path = ( | ||
| finding.get("file_path") or | ||
| finding.get("file") or | ||
| finding.get("location", "").split(":")[0] if ":" in finding.get("location", "") else finding.get("location") | ||
| (finding.get("location", "").split(":")[0] if ":" in finding.get("location", "") else finding.get("location", "")) | ||
| ) | ||
|
|
||
| # 🔥 v2.2: file_path 为空直接跳过 | ||
| if not file_path or not file_path.strip(): | ||
| logger.warning( | ||
| f"[SaveFindings] 🚫 跳过无 file_path 的 finding: " | ||
| f"title={finding.get('title', 'N/A')[:50]}, type={finding.get('vulnerability_type', '?')}" | ||
| ) | ||
| continue | ||
|
|
||
| # 🔥 v2.1: 文件路径验证 - 过滤幻觉发现 | ||
| if project_root and file_path: | ||
| # 清理路径(移除可能的行号) | ||
|
|
@@ -1336,7 +1345,8 @@ async def _save_findings( | |
|
|
||
| # 🔥 Handle verification status | ||
| is_verified = finding.get("is_verified", False) | ||
| if finding.get("verdict") == "confirmed": | ||
| verdict = finding.get("verdict") # confirmed / likely / uncertain / false_positive | ||
| if verdict == "confirmed": | ||
| is_verified = True | ||
|
|
||
| # 🔥 Handle PoC information | ||
|
|
@@ -1381,6 +1391,7 @@ async def _save_findings( | |
| code_snippet=code_snippet[:10000] if code_snippet else None, | ||
| suggestion=suggestion[:5000] if suggestion else None, | ||
| is_verified=is_verified, | ||
| verdict=verdict, # 🔥 新增:保存 verdict 到数据库 | ||
| ai_confidence=confidence, # 🔥 FIX: Use ai_confidence, not confidence | ||
|
Comment on lines
1402
to
1406
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1. Verdict migration missing AgentFinding 新增了 verdict 字段且保存时会写入该列,但 Alembic 迁移里 agent_findings 表定义不包含 verdict,运行时插入会失败并触发回滚,导致任务可能“完成”但 findings 实际未入库。 Agent Prompt
|
||
| status=FindingStatus.VERIFIED if is_verified else FindingStatus.NEW, | ||
| # 🔥 Additional fields | ||
|
|
||
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
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.