Skip to content

feat(memory): wire semantic topic recall deps - #623

Merged
delete-cloud merged 1 commit into
mainfrom
feat/semantic-topic-runtime-recall
Jun 24, 2026
Merged

delete-cloud merged 1 commit into
mainfrom
feat/semantic-topic-runtime-recall

Conversation

@delete-cloud

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

Copy link
Copy Markdown
Owner

Summary

  • inject optional topic store and TopicRangeIndex dependencies into SemanticMemoryPlugin
  • propagate explicit semantic topic dependencies into child pipelines
  • fail fast on invalid explicit topic dependencies even when semantic memory/read is disabled
  • add tests for topic rehydration, non-rendering of backend hit text, child propagation, and invalid dependency validation

Tests

  • UV_PYTHON=3.12 uv run pytest tests/coding_agent/plugins/test_semantic_memory.py tests/coding_agent/test_semantic_recall.py tests/coding_agent/test_memory_switch.py tests/coding_agent/test_bootstrap.py -q
  • UV_PYTHON=3.12 uv run ruff check src/coding_agent/plugins/semantic_memory.py src/coding_agent/core/app.py tests/coding_agent/plugins/test_semantic_memory.py tests/coding_agent/test_memory_switch.py
  • git diff --check

Review

  • Local code-review-expert review found two P2 issues; both fixed and re-reviewed as APPROVE_NO_P1_P2.

Non-goals

  • Does not instantiate a durable PG topic store automatically.
  • Does not add new vector backend adapters or storage schema.

Summary by CodeRabbit

  • New Features

    • Added support for passing semantic topic storage and indexing into agent and child pipeline setup.
    • Semantic memory can now use custom topic data during recall and context building.
  • Bug Fixes

    • Added validation to catch invalid topic storage/index inputs early.
    • Topic summaries now prefer authoritative topic data when available, avoiding fallback text in output.
  • Tests

    • Expanded coverage for topic loading, dependency forwarding, and failure cases when semantic memory is unavailable or read access is disabled.

@coderabbitai

coderabbitai Bot commented Jun 24, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds topic_store and topic_index injection to SemanticMemoryPlugin via two new validation helpers. Extends create_child_pipeline and create_agent with matching optional parameters that are validated early, forwarded through the child pipeline builder, passed to SemanticMemoryPlugin construction, and stored in ctx_config. Tests cover plugin hydration, constructor validation, pipeline wiring, and fail-fast error cases.

Changes

Semantic topic injection into SemanticMemoryPlugin and pipeline API

Layer / File(s) Summary
SemanticMemoryPlugin validation helpers and constructor
coding-agent/src/coding_agent/plugins/semantic_memory.py
Adds _validate_topic_store and _validate_topic_index helpers that normalize None to defaults and enforce async/type contracts. Extends SemanticMemoryPlugin.__init__ with topic_store/topic_index parameters delegating to those helpers, and updates build_context to use self._topic_index instead of constructing a fresh TopicRangeIndex().
Pipeline API extension
coding-agent/src/coding_agent/core/app.py
Imports TopicRangeIndex and SemanticTopicStore, adds _validate_semantic_topic_dependencies for early validation, extends create_child_pipeline and create_agent with semantic_topic_store/semantic_topic_index parameters, forwards them through _create_child_with_environment into SemanticMemoryPlugin construction, and stores them in ctx_config.
Plugin and integration tests
coding-agent/tests/coding_agent/plugins/test_semantic_memory.py, coding-agent/tests/coding_agent/test_memory_switch.py
Adds FakeTopicStore doubles and a _topic() helper. Covers topic hydration in build_context, constructor TypeError on invalid arguments, forwarding of explicit topic dependencies to the plugin, propagation into child pipelines, and fail-fast errors when semantic memory or read is disabled.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • delete-cloud/Coding-Agent-Loop#614: Establishes the semantic memory enable/disable wiring in create_child_pipeline and the test_memory_switch.py test framework that this PR directly extends.

Poem

🐰 Hop hop, the topics flow,
Through pipelines high and stores below,
A load_topic async call,
Validates the store for all,
The index threads from parent down,
No sentinel text to make us frown! 🌿

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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 change: wiring semantic topic recall dependencies into memory.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/semantic-topic-runtime-recall

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.

🧹 Nitpick comments (1)
coding-agent/src/coding_agent/core/app.py (1)

138-153: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoff

Validation logic is duplicated with the plugin's helpers.

_validate_semantic_topic_dependencies re-implements the same load_topic async-contract and TopicRangeIndex checks already present in semantic_memory.py's _validate_topic_store / _validate_topic_index. Since the app-level check exists to fail fast when the plugin isn't constructed (semantic/read disabled), the two paths must stay in lockstep; today they can silently drift (e.g. divergent error messages or contract rules). Consider extracting a single shared validator and reusing it in both places.

🤖 Prompt for 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.

In `@coding-agent/src/coding_agent/core/app.py` around lines 138 - 153, The
semantic topic dependency validation is duplicated between
_validate_semantic_topic_dependencies in app.py and the plugin helpers in
semantic_memory.py, so the contract can drift over time. Extract the async
load_topic and TopicRangeIndex checks into a shared validator and have both
_validate_semantic_topic_dependencies and the plugin’s
_validate_topic_store/_validate_topic_index call it, keeping the error messages
and rules aligned in one place.
🤖 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.

Nitpick comments:
In `@coding-agent/src/coding_agent/core/app.py`:
- Around line 138-153: The semantic topic dependency validation is duplicated
between _validate_semantic_topic_dependencies in app.py and the plugin helpers
in semantic_memory.py, so the contract can drift over time. Extract the async
load_topic and TopicRangeIndex checks into a shared validator and have both
_validate_semantic_topic_dependencies and the plugin’s
_validate_topic_store/_validate_topic_index call it, keeping the error messages
and rules aligned in one place.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3b468cc4-eda8-438f-b986-47e988c75141

📥 Commits

Reviewing files that changed from the base of the PR and between ceef1a5 and 0397d2e.

📒 Files selected for processing (4)
  • coding-agent/src/coding_agent/core/app.py
  • coding-agent/src/coding_agent/plugins/semantic_memory.py
  • coding-agent/tests/coding_agent/plugins/test_semantic_memory.py
  • coding-agent/tests/coding_agent/test_memory_switch.py

@delete-cloud
delete-cloud merged commit 8ff005d into main Jun 24, 2026
2 checks passed
@delete-cloud
delete-cloud deleted the feat/semantic-topic-runtime-recall branch June 24, 2026 15: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