Skip to content

feat: add review-gated semantic alpha#7

Merged
botAGI merged 2 commits into
mainfrom
codex/v02-alpha-semantic
May 18, 2026
Merged

feat: add review-gated semantic alpha#7
botAGI merged 2 commits into
mainfrom
codex/v02-alpha-semantic

Conversation

@botAGI
Copy link
Copy Markdown
Owner

@botAGI botAGI commented May 18, 2026

Summary

  • Add v0.2 alpha semantic scanner, candidate schema, source-span verifier, review store, and local/null/fake/ollama provider layer.
  • Wire morpheus compile --semantic --review, morpheus wake . --semantic --review, and morpheus review list/show/accept/reject/diff/apply.
  • Add alpha fixtures for unmarked repos, prompt injection, and invalid source spans.

Verification

  • ruff check .
  • pytest tests/ -q (574 passed)
  • morpheus stale .
  • morpheus wake . --private
  • morpheus verify --all
  • Canary dogfood: morpheus wake . --semantic --review on this repo produced 60 candidates, 60 source-backed; accepted 5 candidates and morpheus review apply generated a verified receipt.

Notes

  • Default semantic review provider is local deterministic heuristic, so no cloud calls happen silently.
  • Ollama provider is explicit local-only and covered with mock transport tests; CI requires no network, GPU, or external API.
  • WAKE.md is scanned as context, but local extraction does not turn it into candidates and verifier will not self-confirm WAKE.md as primary evidence.
  • review apply re-verifies accepted source spans before promoting candidates; changed sources are returned to needs_review.

@botAGI botAGI force-pushed the codex/v02-alpha-semantic branch from f6fe531 to 9b61bc2 Compare May 18, 2026 11:54
@botAGI botAGI marked this pull request as ready for review May 18, 2026 11:55
@botAGI botAGI merged commit 1cd3974 into main May 18, 2026
4 checks passed
@botAGI botAGI deleted the codex/v02-alpha-semantic branch May 18, 2026 11:57
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +207 to +213
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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Comment on lines +305 to +308
(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(
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Comment on lines +92 to +96
candidate = _candidate_from_ollama_entry(
entry,
source=source,
run_id=run_id,
prompt_sha256=prompt_sha256,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant