Skip to content

feat(memory): add review transition API - #626

Merged
delete-cloud merged 3 commits into
mainfrom
feat/memory-review-transition-api
Jun 25, 2026
Merged

delete-cloud merged 3 commits into
mainfrom
feat/memory-review-transition-api

Conversation

@delete-cloud

@delete-cloud delete-cloud commented Jun 25, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • add a session-scoped memory review transition API: POST /sessions/{session_id}/memory/reviews/{candidate_id}
  • expose semantic memory syncer/service in session runtime config when semantic memory is enabled
  • keep review-store transitions authoritative and semantic index sync as a derived follow-up
  • update ADR-0072 acceptance criteria for the transition API behavior

Verification

  • UV_PYTHON=3.12 uv run pytest tests/ui/test_http_server.py::TestMemoryReviewTransitions -q -> 10 passed
  • UV_PYTHON=3.12 uv run pytest tests/coding_agent/test_memory_switch.py tests/coding_agent/test_semantic_sync.py -q -> 48 passed
  • UV_PYTHON=3.12 uv run pytest tests/ui/test_http_server.py -q -> 279 passed
  • UV_PYTHON=3.12 uv run pytest tests/coding_agent/test_semantic_tape_index.py tests/coding_agent/test_semantic_sync.py tests/coding_agent/test_memory_switch.py -q -> 66 passed
  • uv run ruff check src/coding_agent/core/app.py src/coding_agent/server/http_server.py src/coding_agent/server/schemas.py src/coding_agent/topics/semantic_sync.py tests/coding_agent/test_memory_switch.py tests/ui/test_http_server.py -> pass
  • git diff --check on changed files -> pass

Review Gate

  • local code-review-expert found two P2 transition issues; both fixed with regressions
  • second review found a P2 sync-stage ValueError mapping issue; fixed with a regression
  • final local code-review-expert pass reported no P1/P2 findings

Notes

  • AGENTS.md references RTK.md and prompts/codex-delegatee.md, but those files are not present in this worktree; I followed the pasted AGENTS rules.

Summary by CodeRabbit

  • New Features

    • Added a new session-based memory review action for accepting, rejecting, or archiving reviewed items.
    • Review actions can now include an optional safe reason and return updated review details.
    • When semantic memory is enabled, review changes now stay in sync with search/indexed memory results.
  • Bug Fixes

    • Improved handling for missing, invalid, or already-finalized review items.
    • Added clearer error responses when review updates fail or cannot be synced.

@coderabbitai

coderabbitai Bot commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@delete-cloud, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 46 minutes and 41 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7a86af66-c774-4f01-b367-7493d90d90a4

📥 Commits

Reviewing files that changed from the base of the PR and between 5233b7d and 64f6154.

📒 Files selected for processing (4)
  • coding-agent/docs/adr/0072-tape-memory-semantic-index-and-enable-switch.md
  • coding-agent/pyproject.toml
  • coding-agent/src/coding_agent/server/http_server.py
  • coding-agent/tests/ui/test_http_server.py
📝 Walkthrough

Walkthrough

This PR adds a session-scoped memory review transition endpoint, the request/response schemas it uses, semantic-sync wiring during startup, and end-to-end tests plus ADR checklist entries for accepted, rejected, archived, and failure paths.

Changes

Session memory review transitions

Layer / File(s) Summary
Review contract
coding-agent/src/coding_agent/server/schemas.py, coding-agent/src/coding_agent/topics/semantic_sync.py, coding-agent/docs/adr/0072-tape-memory-semantic-index-and-enable-switch.md
Adds the reviewed-memory transition request/response models, a review-sync forwarding method, and ADR text that defines the session-scoped endpoint semantics and error cases.
Semantic-memory wiring
coding-agent/src/coding_agent/core/app.py, coding-agent/tests/coding_agent/test_memory_switch.py
Creates semantic_memory_syncer and semantic_memory_review_sync_service during semantic-memory startup and updates config tests for enabled, disabled, and plugin-omission cases.
HTTP transition endpoint
coding-agent/src/coding_agent/server/http_server.py
Adds the POST /sessions/{session_id}/memory/reviews/{candidate_id} handler, store/service extraction helpers, candidate validation, transition execution, and HTTP error mapping for sync and ownership failures.
Endpoint tests and checklist
coding-agent/tests/ui/test_http_server.py, coding-agent/docs/adr/0072-tape-memory-semantic-index-and-enable-switch.md
Adds runtime helpers and end-to-end POST tests for accepted, rejected, missing, terminal, unsafe-reason, semantic-disabled, and sync-failure paths, and records those cases in the ADR acceptance criteria.

Sequence Diagram(s)

sequenceDiagram
  participant "POST /sessions/{session_id}/memory/reviews/{candidate_id}" as ReviewRequest
  participant transition_memory_review
  participant MemoryReviewStore
  participant SemanticMemoryReviewSyncService
  participant SemanticMemorySyncer

  ReviewRequest->>transition_memory_review: request body and path params
  transition_memory_review->>MemoryReviewStore: transition candidate to accepted, rejected, or archived
  MemoryReviewStore-->>transition_memory_review: ReviewedMemoryRecord
  opt semantic_memory_review_sync_service configured
    transition_memory_review->>SemanticMemoryReviewSyncService: sync_reviewed_memory(record)
    SemanticMemoryReviewSyncService->>SemanticMemorySyncer: sync_reviewed_memory(record)
  end
  transition_memory_review-->>ReviewRequest: response or HTTP error
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • delete-cloud/Coding-Agent-Loop#618: Adds the semantic-memory backend/index and config plumbing that this PR extends with review-sync wiring and the new transition endpoint.

Poem

I hopped through the semantic grove today,
A review leaf changed from yes to nay.
With sync and store in tidy rows,
The burrow hums as the memory grows.
🐰✨ One carrot for the code review path!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 4.76% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: a new memory review transition API.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/memory-review-transition-api

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@coding-agent/src/coding_agent/server/http_server.py`:
- Around line 2800-2814: The semantic memory sync path in the HTTP handler
currently turns a post-commit sync failure into a 500, which is not safely
retryable once the review store has already been updated. Update the logic
around _sync_memory_review_service in the HTTP server handler so that failed
sync is treated as best-effort/reconciled or, if the same status is retried,
rerun the semantic sync idempotently before deciding on an error. Keep the retry
behavior aligned with the terminal-status check so a committed review does not
force a 400 on subsequent repair attempts.
- Line 2748: Add FastAPI dependency helpers to Ruff’s immutable-calls allowlist
so the standard `Depends(...)` pattern in `http_server.py` is not flagged by
B008. Update the Ruff lint configuration in `pyproject.toml` to include
`fastapi.Depends` and `fastapi.Security` under `extend-immutable-calls`, which
will cover the `auth_context_from_headers` dependency usage and similar FastAPI
injection points throughout `http_server.py`.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 856c4bb7-1862-4c49-9892-ee07cd49bcc7

📥 Commits

Reviewing files that changed from the base of the PR and between 0363ac9 and 5233b7d.

📒 Files selected for processing (7)
  • coding-agent/docs/adr/0072-tape-memory-semantic-index-and-enable-switch.md
  • coding-agent/src/coding_agent/core/app.py
  • coding-agent/src/coding_agent/server/http_server.py
  • coding-agent/src/coding_agent/server/schemas.py
  • coding-agent/src/coding_agent/topics/semantic_sync.py
  • coding-agent/tests/coding_agent/test_memory_switch.py
  • coding-agent/tests/ui/test_http_server.py

@delete-cloud
delete-cloud merged commit c4932bf into main Jun 25, 2026
2 checks passed
@delete-cloud
delete-cloud deleted the feat/memory-review-transition-api branch June 25, 2026 02:08
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