fix(ingestion): wire memory persistence contract into the ingestion hook - #612
Merged
jamiepine merged 3 commits intoAug 8, 2026
Conversation
Without this, set_terminal_outcome is unreachable for ingestion chunks and every file fails "completed without memory_persistence_complete signal", retrying indefinitely.
…ream Reverts an accidental edit introduced in the previous commit; the branch now differs from main only by the hook wiring line.
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Walkthrough
ChangesIngestion memory contract
Estimated code review effort: 1 (Trivial) | ~2 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
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.
Fixes #611
Problem
process_chunk()insrc/agent/ingestion.rscreates aMemoryPersistenceContractStateand hands it to the branch tool server viaBranchToolProfile::MemoryPersistence, but theSpacebotHookfor the same run is built withSpacebotHook::new(...)only — the contract is never attached to the hook.The hook's
on_tool_result(src/hooks/spacebot.rs) is the only production caller ofset_terminal_outcome, and it is guarded bylet Some(contract_state) = &self.memory_persistence_contract. With the contract unset, that guard short-circuits on every ingestion run, so even a successfulmemory_persistence_completetool call never registers.process_chunkthen always fails itshas_terminal_outcome()check with:The file is kept for retry, and the ingestion poll loop (default 30 s, no retry cap) retries it forever — indefinite repeated LLM calls for every ingested file.
Fix
Attach the contract to the hook, exactly as
src/agent/branch.rsalready does for chat-driven branches (hook = hook.with_memory_persistence_contract(contract_state.clone());):One line, immediately after the
SpacebotHook::new(...)call inprocess_chunk.Verified on a production deployment running a patched v0.5.0 build: with this change, ingestion chunks complete, files are deleted after successful ingestion, and the retry loop no longer fires.
🤖 Generated with Claude Code