Add auditable research candidate promotion policy - #97
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6145bd4f38
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| decisions: List[Dict[str, Any]] = [] | ||
| for candidate in candidates: | ||
| evidence = candidate.get("evidence") if isinstance(candidate.get("evidence"), dict) else {} | ||
| evidence_refs = [key for key in ("metadata_url", "artifact_url", "publisher") if evidence.get(key)] |
There was a problem hiding this comment.
Exclude publisher metadata from the evidence-reference count
When a scored feed event has a metadata URL and an author/publisher but no artifact URL, the default minimum_evidence=2 gate passes because publisher is counted as a reference. score_pending_events() commonly creates exactly this shape when the registry leaf URL is metadata rather than an artifact, so candidates can be promoted with only one actual evidence reference; publisher presence should remain the separate require_publisher gate described by the policy.
Useful? React with 👍 / 👎.
| if apply and eligible and policy["mode"] == "draft_case" and not candidate.get("case_id"): | ||
| from secopsai.research_cases import add_evidence, add_subject, create_case | ||
| case = create_case(title=f"Investigate {candidate['ecosystem']} package {candidate['package']}", summary=f"Automatically promoted as a draft investigation after deterministic policy checks. Similarity score: {candidate['score']}. This is a lead, not a maliciousness verdict.", case_type="typosquatting", severity="medium", confidence=min(int(float(candidate["score"])), 80), owner=actor, metadata={"candidate_id": candidate["candidate_id"], "promotion_policy": policy}, db_path=db_path) |
There was a problem hiding this comment.
Claim each candidate before creating its promotion case
When two --apply invocations overlap, both can read the same candidate as new and pass this check before either updates it. Each invocation then commits a separate case, subject, and evidence record; the later update wins the candidate's case_id, while the unique promotion event retains only one of the two case IDs, leaving an orphan case and inconsistent audit history. Atomically reserve the candidate with a conditional status update before creating the case, or make the entire promotion operation transactional.
Useful? React with 👍 / 👎.
Deploying secopsai with
|
| Latest commit: |
6145bd4
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://e4ebe7d5.secopsai.pages.dev |
| Branch Preview URL: | https://codex-research-promotion-pol.secopsai.pages.dev |
Deploying website with
|
| Latest commit: |
6145bd4
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://4414110d.website-bks.pages.dev |
| Branch Preview URL: | https://codex-research-promotion-pol.website-bks.pages.dev |
Adds the durable Core policy required by Mission Control discovery automation.
Verification: 453 Core tests and 4 subtests passed; focused promotion tests passed.