feat: add review-gated semantic alpha#7
Conversation
f6fe531 to
9b61bc2
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9b61bc299b
ℹ️ 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".
| if candidate.status != "accepted" or candidate.label != "source_backed": | ||
| continue | ||
| verified = verify_candidate_span(project_root, candidate) | ||
| if verified.label == "source_backed": | ||
| accepted.append(verified) | ||
| candidates[index] = verified | ||
| continue |
There was a problem hiding this comment.
Mark applied candidates to prevent duplicate claim promotion
After review apply succeeds, accepted candidates remain status="accepted", so running review apply again re-promotes the same entries and appends duplicate claims/evidence to .morpheus/state.json each time. This corrupts state history for normal repeated usage (for example, users re-running apply after checking output) and should be prevented by marking candidates as applied/consumed or filtering out already-applied IDs before appending.
Useful? React with 👍 / 👎.
| (morpheus_dir / "WAKE.md").write_text(wake_md) | ||
| (morpheus_dir / "state.json").write_text(state_json) | ||
| (morpheus_dir / "evidence.jsonl").write_bytes(evidence_jsonl) | ||
| (receipts_dir / receipt_file_name(receipt["receipt_id"])).write_text( |
There was a problem hiding this comment.
Guard review-apply writes against symlink output paths
_write_state_receipt writes WAKE.md, state.json, evidence.jsonl, receipts, and audit.log without any symlink checks, unlike compile which explicitly rejects symlink outputs. If an attacker or misconfigured repo places a symlink under .morpheus/, review apply can overwrite files outside the project root. Add reject_symlink_paths/reject_symlink_components checks before these writes to preserve the existing safety model.
Useful? React with 👍 / 👎.
| candidate = _candidate_from_ollama_entry( | ||
| entry, | ||
| source=source, | ||
| run_id=run_id, | ||
| prompt_sha256=prompt_sha256, |
There was a problem hiding this comment.
Skip malformed Ollama entries instead of aborting extraction
Each Ollama entry is converted directly to SemanticCandidate without catching ValidationError, so a single malformed item (for example unknown kind, line_start=0, or out-of-range confidence) raises and aborts the entire semantic review run. Because LLM JSON is often partially invalid, this turns one bad candidate into a full command failure; wrap candidate parsing in exception handling and continue on invalid entries.
Useful? React with 👍 / 👎.
Summary
morpheus compile --semantic --review,morpheus wake . --semantic --review, andmorpheus review list/show/accept/reject/diff/apply.Verification
ruff check .pytest tests/ -q(574 passed)morpheus stale .morpheus wake . --privatemorpheus verify --allmorpheus wake . --semantic --reviewon this repo produced60candidates,60source-backed; accepted 5 candidates andmorpheus review applygenerated a verified receipt.Notes
WAKE.mdis scanned as context, but local extraction does not turn it into candidates and verifier will not self-confirmWAKE.mdas primary evidence.review applyre-verifies accepted source spans before promoting candidates; changed sources are returned toneeds_review.