feat(server): schema for review round-trip loop (CRU-131) - #381
Merged
Conversation
Add round_number + allow_recheck to persona_reviews and round_number + responds_to_feedback_id to agent_feedback so the Phase 2 recheck loop has the columns it needs to persist round-scoped state and cross-round references. Pure schema readiness — no transitions into awaiting_recheck or round-2 writes are wired up yet. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
selfcontained
marked this pull request as ready for review
April 22, 2026 16:46
This was referenced Apr 22, 2026
Merged
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Phase 2 of the review round-trip feature (CRU-127). Pure schema readiness — no new transitions into
awaiting_recheckor round-2 writes are wired up yet. Builds on Phase 1 (CRU-128 / migration 0016).Migration
0017_persona-review-round-trip.sqlpersona_reviews:round_number INT NOT NULL DEFAULT 1allow_recheck BOOLEAN NOT NULL DEFAULT falseagent_feedback:round_number INT NOT NULL DEFAULT 1responds_to_feedback_id INT REFERENCES agent_feedback(id) ON DELETE SET NULLidx_agent_feedback_responds_toonresponds_to_feedback_id-- Down Migrationblock that drops the index, FK-bearing column, and the four new columns. Phase 1 columns (resolution_reason,resolution_commit,resolved_at,last_reviewed_commit,persona_review_resolutions) are left untouched.awaiting_recheckpersona-review status — status is validated in app code, not Postgres. That value is not yet written anywhere in this PR.Manager query helpers (
apps/server/src/agents/manager.ts)PersonaReviewRecordgainsroundNumber+allowRecheck;FeedbackRecordgainsroundNumber+respondsToFeedbackId.SELECT/RETURNINGclauses that hydrate those record types now surface the new columns.createPersonaReviewaccepts an optionalallowRecheckparam. All other writers rely on the DB defaults so existing behavior is unchanged.Notes
persona_review_resolutionsin its final shape (no temp summary column), so the "backfill and drop" step from the ticket description is a no-op here.pgmigrations(last applied:0016_feedback-resolution-capture).Test plan
pnpm run check— typecheck clean (backend + web).pnpm run test— 372 unit tests pass.pnpm run test:e2e— 138 E2E tests pass.node-pg-migrateup then down against a throwaway DB. New columns/index appear with correct types + defaults, default-inserting intoagent_feedbackyieldsround_number=1/responds_to_feedback_id=null, and a single-step rollback removes all Phase 2 artifacts while preserving Phase 1 columns.