feat(memory): wire recall into makeDispatcher + vf plan; fix bun:sqlite bundle leak#506
Merged
Conversation
…te bundle leak - dispatch-runtime.ts: wire resolveMemoryProvider+renderMemoryBlock into makeDispatcher (passes memBlock as 4th arg to buildEnginePrompt) - plan.ts: wire recall into buildPlanPrompt (beside §2 Non-negotiables); fix ctxDir bug (pass join(base,CTX_DIR) not bare base to resolveMemoryProvider) - commands.ts: re-export buildPlanPrompt for test access - index-db.ts: replace static bun:sqlite import with lazy require() to prevent ERR_UNSUPPORTED_ESM_URL_SCHEME in Node.js dist bundle; --external bun:sqlite alone insufficient (bun bundler still emits static import) Closes #488 Closes #489 Signed-off-by: magicpro97 <magicpro97@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR completes wiring of memory recall into the remaining prompt-construction entry points (vf plan and per-unit dispatch) and adjusts the builtin sqlite-backed memory index to avoid leaking bun:sqlite into the Node-targeted dist bundle.
Changes:
- Inject recalled “Relevant past decisions” blocks into
buildEnginePrompt(dispatch) andbuildPlanPrompt(plan). - Wire memory provider resolution + recall into
makeDispatcher()andplan()using repo settings and.vibeflowcontext dir. - Make
bun:sqliteloading lazy in the memory DB implementation to prevent Node dist load failures; add/extend tests for plan prompt behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/commands-plan.test.ts | Adds unit tests for buildPlanPrompt memory-block inclusion/omission. |
| src/memory/index-db.ts | Switches from static bun:sqlite import to lazy loading to avoid Node bundle load errors. |
| src/commands/plan.ts | Extends buildPlanPrompt with optional memoryBlock and wires memory recall into plan(). |
| src/commands/dispatch-runtime.ts | Wires memory recall into makeDispatcher() and passes memBlock to buildEnginePrompt. |
| src/commands.ts | Re-exports buildPlanPrompt for tests/consumers. |
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.
Wire memory recall into the two remaining query points and fix the Node.js dist bundle issue.
resolveMemoryProvider+renderMemoryBlockinjected,memBlockpassed tobuildEnginePromptbuildPlanPromptgets optionalmemoryBlockparam; wired inplan()entry; ctxDir bug fixed (was passing repo root, now passes.vibeflowdir)buildPlanPrompt(needed by tests)require("bun:sqlite")vialoadSqlite()— fixesERR_UNSUPPORTED_ESM_URL_SCHEMEin Node smoke test (--external bun:sqlitealone insufficient)Closes #488
Closes #489