Skip to content

feat(memory): add semantic dogfood ops - #652

Merged
delete-cloud merged 2 commits into
mainfrom
feat/semantic-memory-dogfood-ops
Jun 29, 2026
Merged

delete-cloud merged 2 commits into
mainfrom
feat/semantic-memory-dogfood-ops

Conversation

@delete-cloud

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

Copy link
Copy Markdown
Owner

Summary

  • Add admin-only semantic dogfood topic seeding for creating a durable finalized topic that can be reviewed and indexed.
  • Add session-scoped memory review listing for remote dogfood flows.
  • Require explicit confirm_global for semantic rebuild because rebuild clears the global semantic backend.
  • Add delete_topic cleanup support for PG/SQLite topic stores and fenced durable stores so failed dogfood core writes can compensate safely.
  • Update ADR-0072 with the dogfood/rebuild operational boundary.

Review Gate

  • Implemented via delegated worker flow.
  • Local subagent review found P1/P2 issues twice; fixes were applied and re-reviewed.
  • Final fresh subagent review reported: no P1/P2 findings.

Verification

  • git diff --check
  • uv run ruff format --check src/coding_agent/cli/remote_commands.py src/coding_agent/remote/client.py src/coding_agent/server/http_server.py src/coding_agent/server/schemas.py src/coding_agent/server/session_manager.py src/coding_agent/topics/store.py src/coding_agent/stores/durable_pg.py src/coding_agent/stores/durable_local.py tests/cli/test_remote_client.py tests/ui/test_http_server.py
  • uv run ruff check src/coding_agent/cli/remote_commands.py src/coding_agent/remote/client.py src/coding_agent/server/http_server.py src/coding_agent/server/schemas.py src/coding_agent/server/session_manager.py src/coding_agent/topics/store.py src/coding_agent/stores/durable_pg.py src/coding_agent/stores/durable_local.py tests/cli/test_remote_client.py tests/ui/test_http_server.py
  • uv run pytest -q tests/ui/test_http_server.py::TestSemanticMemoryMaintenance tests/ui/test_http_server.py::TestMemoryReviewTransitions tests/cli/test_remote_client.py
  • uv run pytest -q tests/coding_agent/test_topic_store_contract.py tests/coding_agent/test_sqlite_topic_store.py tests/coding_agent/test_topic_store.py tests/coding_agent/test_topic_lifecycle.py tests/coding_agent/test_semantic_maintenance.py tests/coding_agent/test_semantic_sync.py tests/coding_agent/test_semantic_recall.py tests/coding_agent/test_semantic_tape_index.py tests/coding_agent/test_pg_durable_fencing.py tests/coding_agent/test_sqlite_local_durable_fencing.py

Summary by CodeRabbit

  • New Features

    • Added a session-level view for reviewed memory items, with optional status filtering.
    • Added a maintenance action to seed a semantic “dogfood” topic for a session.
    • Global semantic-memory rebuilds now require an explicit extra confirmation, and responses clearly indicate global scope.
  • Bug Fixes

    • Improved safety around destructive rebuild actions to reduce accidental global changes.
    • Added clearer handling for session-scoped memory visibility and maintenance errors.

Add admin dogfood topic seeding, session-scoped memory review listing, and explicit global semantic rebuild confirmation.\n\nVerification:\n- git diff --check\n- uv run ruff format --check src/coding_agent/cli/remote_commands.py src/coding_agent/remote/client.py src/coding_agent/server/http_server.py src/coding_agent/server/schemas.py src/coding_agent/server/session_manager.py src/coding_agent/topics/store.py src/coding_agent/stores/durable_pg.py src/coding_agent/stores/durable_local.py tests/cli/test_remote_client.py tests/ui/test_http_server.py\n- uv run ruff check src/coding_agent/cli/remote_commands.py src/coding_agent/remote/client.py src/coding_agent/server/http_server.py src/coding_agent/server/schemas.py src/coding_agent/server/session_manager.py src/coding_agent/topics/store.py src/coding_agent/stores/durable_pg.py src/coding_agent/stores/durable_local.py tests/cli/test_remote_client.py tests/ui/test_http_server.py\n- uv run pytest -q tests/ui/test_http_server.py::TestSemanticMemoryMaintenance tests/ui/test_http_server.py::TestMemoryReviewTransitions tests/cli/test_remote_client.py\n- uv run pytest -q tests/coding_agent/test_topic_store_contract.py tests/coding_agent/test_sqlite_topic_store.py tests/coding_agent/test_topic_store.py tests/coding_agent/test_topic_lifecycle.py tests/coding_agent/test_semantic_maintenance.py tests/coding_agent/test_semantic_sync.py tests/coding_agent/test_semantic_recall.py tests/coding_agent/test_semantic_tape_index.py tests/coding_agent/test_pg_durable_fencing.py tests/coding_agent/test_sqlite_local_durable_fencing.py
@coderabbitai

coderabbitai Bot commented Jun 29, 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 40 minutes and 10 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: 3d242c88-1dd4-4011-94d1-48fe3493dee4

📥 Commits

Reviewing files that changed from the base of the PR and between 7455db4 and 36a2266.

📒 Files selected for processing (4)
  • coding-agent/src/coding_agent/remote/client.py
  • coding-agent/src/coding_agent/server/session_manager.py
  • coding-agent/tests/cli/test_remote_client.py
  • coding-agent/tests/ui/test_http_server.py
📝 Walkthrough

Walkthrough

Adds two new REST endpoints (GET /sessions/{id}/memory/reviews and POST /sessions/{id}/memory/semantic/dogfood-topic), a SessionManager.seed_semantic_dogfood_topic method with tape forking and compensation logic, topic deletion for PG/SQLite stores, and tightens semantic rebuild to require an explicit confirm_global: true field, with matching CLI subcommands and remote client helpers.

Changes

Semantic Memory Extensions

Layer / File(s) Summary
API schemas: MemoryReviewRecordResponse, rebuild confirm_global, dogfood topic
coding-agent/src/coding_agent/server/schemas.py, coding-agent/docs/adr/0072-tape-memory-semantic-index-and-enable-switch.md
Introduces MemoryReviewRecordResponse, SemanticDogfoodTopicRequest/Response; adds confirm_global field (validator enforces true) to SemanticMemoryRebuildRequest and scope: "global" to SemanticMemoryRebuildResponse; ADR documents the new rebuild safeguard and both new endpoints.
Topic deletion in PG and SQLite stores
coding-agent/src/coding_agent/topics/store.py, coding-agent/src/coding_agent/stores/durable_local.py, coding-agent/src/coding_agent/stores/durable_pg.py
Adds delete_topic to PGTopicStore and SQLiteTopicStore (cascading DELETEs in dependency order), and surfaces it through PGDurableStore/FencedPGTopicStore and SQLiteLocalDurableStore/FencedSQLiteTopicStore facades with authority fencing.
SessionManager.seed_semantic_dogfood_topic
coding-agent/src/coding_agent/server/session_manager.py
Adds SemanticDogfoodTopicSeedResult dataclass and seed_semantic_dogfood_topic method: runs under maintenance admission lock, forks tape, creates/finalizes one topic via TopicLifecycle, compensates on post-commit failure (topic deletion + tape truncation), optionally writes a memory review candidate and triggers semantic sync (both captured as warnings), then returns the result and updates the runtime tape.
HTTP endpoints: GET memory/reviews and POST memory/semantic/dogfood-topic
coding-agent/src/coding_agent/server/http_server.py
Adds response/visibility helpers for ReviewedMemoryRecord, a SemanticDogfoodTopicResponse mapper, HTTP 409 mapping for the dogfood-topic missing-store condition, and two new REST endpoints with session and admin auth respectively.
CLI subcommands and remote client helpers
coding-agent/src/coding_agent/cli/remote_commands.py, coding-agent/src/coding_agent/remote/client.py
Adds remote memory reviews (optional --status filter) and remote memory dogfood-topic CLI subcommands; renames --confirm to --confirm-global on rebuild; adds list_remote_memory_reviews, _get_remote_json_list, and seed_remote_semantic_dogfood_topic to the remote client with an updated rebuild_remote_semantic_memory signature.
Tests
coding-agent/tests/cli/test_remote_client.py, coding-agent/tests/ui/test_http_server.py
Adds maintenance fakes (_MemoryMaintenanceTopicStore, _MemoryMaintenanceTapeStore, topic syncers), updates all rebuild POST bodies to include confirm_global: true and asserts scope: "global" in responses, and adds new test cases for reviews listing, dogfood-topic CLI/HTTP flows, and memory review session visibility.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • delete-cloud/Coding-Agent-Loop#634: Adds SQLite/PG TopicStore parity and SessionManager.selected_topic_store() selection logic that the new dogfood topic seeding and topic deletion code directly builds on.
  • delete-cloud/Coding-Agent-Loop#638: Modifies the semantic-memory maintenance HTTP surface and SessionManager/schema handling in the same area as the rebuild confirmation and dogfood endpoint changes.
  • delete-cloud/Coding-Agent-Loop#651: Adds admin-auth header/token plumbing that the new dogfood-topic admin endpoint and rebuild_remote_semantic_memory admin-auth flow depend on.

Poem

🐇 Hoppin' through the memory lanes,
Forking tapes and seeding topics in chains,
confirm_global: true keeps destruction at bay,
Dogfood topics bloom in the runtime's display,
Reviews by status, scoped just to you—
The rabbit commits, and warnings stay too! 🌱

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 3.42% 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 is concise and accurately reflects the main semantic-memory dogfood operations added in this change.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/semantic-memory-dogfood-ops

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.

@delete-cloud
delete-cloud marked this pull request as ready for review June 29, 2026 03:26

@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: 3

🤖 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/remote/client.py`:
- Around line 393-397: The list_remote_memory_reviews flow is still using user
auth only, so requests can fail when only an admin token is configured. Update
the authentication used by the remote memory reviews helper in client.py to
match the adjacent semantic-memory methods by falling back to
admin_auth_headers(endpoint) when user auth is unavailable, and make sure the
request path-building logic in list_remote_memory_reviews() remains unchanged.

In `@coding-agent/src/coding_agent/server/session_manager.py`:
- Around line 1490-1503: `propose_memory_candidate_from_topic(finalized)` is
currently executed outside the warning-handled failure path, so proposal errors
can escape after the topic is already finalized. Move the proposal call into the
same `try` block in `session_manager.py` that already wraps
`review_store.add_candidate`, and handle any exception there by logging a
warning and appending it to `warnings`, just like the existing candidate-write
failure path. Keep the control flow in `session_manager.py` centered around
`memory_write_enabled`, `review_store.candidate_writes_enabled`, and
`add_candidate` so proposal and write failures are both treated as non-fatal
warnings.

In `@coding-agent/tests/ui/test_http_server.py`:
- Around line 323-330: The _runtime_ctx helper is replacing an explicitly
provided empty Tape because it uses a truthiness fallback. Update the tape
selection in _runtime_ctx to preserve any non-None Tape instance passed by the
caller, even when it is empty, and only create a new Tape when tape is None.
Keep the change localized to the SimpleNamespace construction so the injection
hook continues to work for blank tapes.
🪄 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: 0dbc3fa9-f5d2-4bd4-8215-12da58acedac

📥 Commits

Reviewing files that changed from the base of the PR and between 5d825d6 and 7455db4.

📒 Files selected for processing (11)
  • coding-agent/docs/adr/0072-tape-memory-semantic-index-and-enable-switch.md
  • coding-agent/src/coding_agent/cli/remote_commands.py
  • coding-agent/src/coding_agent/remote/client.py
  • coding-agent/src/coding_agent/server/http_server.py
  • coding-agent/src/coding_agent/server/schemas.py
  • coding-agent/src/coding_agent/server/session_manager.py
  • coding-agent/src/coding_agent/stores/durable_local.py
  • coding-agent/src/coding_agent/stores/durable_pg.py
  • coding-agent/src/coding_agent/topics/store.py
  • coding-agent/tests/cli/test_remote_client.py
  • coding-agent/tests/ui/test_http_server.py

Comment thread coding-agent/src/coding_agent/remote/client.py
Comment thread coding-agent/src/coding_agent/server/session_manager.py
Comment thread coding-agent/tests/ui/test_http_server.py
Handle memory-review auth fallback, candidate proposal failures, and empty-tape test injection.\n\nVerification:\n- git diff --check\n- uv run ruff format --check src/coding_agent/remote/client.py src/coding_agent/server/session_manager.py tests/cli/test_remote_client.py tests/ui/test_http_server.py\n- uv run ruff check src/coding_agent/remote/client.py src/coding_agent/server/session_manager.py tests/cli/test_remote_client.py tests/ui/test_http_server.py\n- uv run pytest -q tests/ui/test_http_server.py::TestSemanticMemoryMaintenance tests/ui/test_http_server.py::TestMemoryReviewTransitions tests/cli/test_remote_client.py\n- uv run pytest -q tests/coding_agent/test_semantic_maintenance.py tests/coding_agent/test_semantic_sync.py tests/coding_agent/test_semantic_recall.py tests/coding_agent/test_semantic_tape_index.py tests/coding_agent/test_topic_store_contract.py tests/coding_agent/test_sqlite_topic_store.py tests/coding_agent/test_topic_store.py tests/coding_agent/test_topic_lifecycle.py tests/coding_agent/test_pg_durable_fencing.py tests/coding_agent/test_sqlite_local_durable_fencing.py
@delete-cloud
delete-cloud merged commit 085c82f into main Jun 29, 2026
2 checks passed
@delete-cloud
delete-cloud deleted the feat/semantic-memory-dogfood-ops branch June 29, 2026 03:51
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