feat(session-edit): correctness review mark on session_edits#369
Conversation
Adds a human review mark (correct | incorrect) to the raw-session edit
overlay, stored in session_edits. Default-unmarked turns keep no row;
editing a turn's content auto-marks it correct.
Schema:
- New column correctness VARCHAR(20) NULL (correct|incorrect; NULL =
unmarked), added to the create DDL and migrated onto existing tenants
via a new ensureColumn ALTER on connect.
- edited_content keeps NOT NULL; '' is the "no content override"
sentinel so a row can be mark-only (real edits always have non-empty
content). A row exists when it has a content/tag edit OR a mark.
API (v1alpha2, X-API-Key + X-Mnemo-Agent-Id):
- PUT /session-messages/{id}/mark {correctness} — set the mark (400 on
an invalid value); preserves any existing content/tag overlay.
- DELETE /session-messages/{id}/mark — clear the mark; if the row had no
content override it is removed entirely (back to no record).
- PUT /session-messages/{id} (content edit) now auto-sets correct; a
tag-only change does not alter the mark.
Reads surface correctness wherever the turn is read, when set:
- Session Search (/memories?memory_type=session) merges correctness into
metadata (plus the content overlay when the turn was edited);
- raw browse (/session-messages) adds a correctness field but always
shows original content;
- GET /session-messages/{id}/edit returns the full row.
Repo gains MarkSessionEdit (mark-only upsert preserving content) and
ClearSessionEditMark (clear mark, delete mark-only rows); the overlay
apply logic now gates content override on EditedContentSet so mark-only
rows leave content/tags untouched while still surfacing the mark.
Tests: mark set/update + version, invalid value 400, not-found 404,
mark-only surfaces correctness without changing content, content edit
auto-correct, unmark deletes mark-only row, unmark preserves content
edit, raw browse surfaces correctness with original content. Full suite
+ vet + gofmt green.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f8bf9fe6e7
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| ON DUPLICATE KEY UPDATE | ||
| correctness = VALUES(correctness), |
There was a problem hiding this comment.
Preserve marks when reverting only content edits
When a turn has both a content overlay and a correctness mark, this upsert stores the mark in the same session_edits row that DELETE /session-messages/{id}/edit still removes via DeleteSessionOverlay → DeleteSessionEdit. In that scenario, reverting only the edited content also drops the review mark, even though /mark and /edit are separate APIs; the edit-delete path should clear the content/tag override while keeping correctness when it is set, and delete the row only when no mark remains.
Useful? React with 👍 / 👎.
Add a human review mark (correct | incorrect) to raw session turns,
stored in
session_edits. No row exists until a turn is edited ormarked; editing a turn's content auto-marks it correct.
Endpoints (v1alpha2)
PUT /session-messages/{id}/mark— set mark{correctness}(400 on invalid value)DELETE /session-messages/{id}/mark— clear mark (removes the row if it had no content edit)Behavior
session_edits.correctnesscolumn (correct|incorrect, NULL = unmarked); auto-migrated onto existing tenants viaensureColumn.edited_content = ''= no content override (mark-only row); real edits are always non-empty.PUT /session-messages/{id}) auto-setscorrect; tag-only change leaves the mark unchanged.Reads (surface
correctnesswhen set)/memories?memory_type=session): inmetadata, plus content overlay when edited./session-messages):correctnessfield; content stays original.GET /session-messages/{id}/edit: full row.Tradeoff / scope
sessions/memories, embeddings, or FTS; recall is unaffected.Tests