fix(memory): load GotchasMemory named export (#517) - #668
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (4)
WalkthroughThree execution modules adopt a defensive import pattern for GotchasMemory (destructured try/catch), regression tests cover success and failure paths, package version is bumped to 5.1.8, and registry/manifest/story docs are updated. ChangesGotchasMemory Named Export Fix
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
📊 Coverage ReportCoverage report not available
Generated by PR Automation (Story 6.1) |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 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 @.aiox-core/core/execution/context-injector.js:
- Around line 23-27: The try/catch around the dynamic require for GotchasMemory
silently swallows any import error; update the catch to capture the thrown error
(e.g., "err") and surface minimal debug context instead of swallowing it — keep
the fallback assignment GotchasMemory = null but log or debug the error with a
short message including the module name and the caught error (reference the
existing require('../memory/gotchas-memory') block and the GotchasMemory symbol)
so future regressions are visible during debugging.
In @.aiox-core/core/execution/subagent-dispatcher.js:
- Around line 30-34: The catch block that falls back when requiring
'../memory/gotchas-memory' currently swallows errors; change it to catch the
error (e.g., catch (err)) and log minimal context before setting GotchasMemory =
null so missing/corrupt memory modules are diagnosable — include the module path
('../memory/gotchas-memory') and the error.message or error.stack in the log
(use console.error or the module's logger if available) while keeping the
fallback assignment to GotchasMemory unchanged.
In @.aiox-core/core/ideation/ideation-engine.js:
- Around line 15-19: The require fallback for GotchasMemory currently swallows
errors; update the try/catch around require('../memory/gotchas-memory') so the
catch captures the error (e.g., catch (err)) and surfaces lightweight
diagnostics: log or warn including the error message/stack (use console.warn or
the module's logger) and set GotchasMemory = null, and also attach the error to
a module-level symbol (e.g., exports.gotchasMemoryLoadError or
module.gotchasMemoryLoadError) so callers can observe degradation; modify the
block around GotchasMemory to implement this behavior.
In `@tests/core/gotchas-memory-imports.test.js`:
- Around line 3-6: Replace the relative require imports with the project's
absolute import paths: locate the requires for IdeationEngine, ContextInjector,
SubagentDispatcher, and GotchasMemory in
tests/core/gotchas-memory-imports.test.js and change them from
'../../.aiox-core/core/...' to the repository's absolute module paths used
elsewhere (importing the modules by their package-root absolute identifiers) so
the test uses absolute imports consistent with the project's convention.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 4545a569-418a-4efb-85ba-2549183a8562
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (8)
.aiox-core/core/execution/context-injector.js.aiox-core/core/execution/subagent-dispatcher.js.aiox-core/core/ideation/ideation-engine.js.aiox-core/data/entity-registry.yaml.aiox-core/install-manifest.yamldocs/stories/epic-123/STORY-123.12-gotchas-memory-named-export.mdpackage.jsontests/core/gotchas-memory-imports.test.js
There was a problem hiding this comment.
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 @.aiox-core/core/execution/context-injector.js:
- Around line 24-34: The try/catch can miss the case where
require('../memory/gotchas-memory') succeeds but doesn't export GotchasMemory,
leaving GotchasMemory undefined and gotchasMemoryLoadError null; after the
destructuring in the try block (where GotchasMemory is assigned), add a guard
that checks if GotchasMemory is undefined and, if so, set gotchasMemoryLoadError
to a new Error describing the missing named export and emit the same debug
warning as in the catch when process.env.AIOX_DEBUG is set so callers can detect
the failed export; reference the GotchasMemory binding, gotchasMemoryLoadError
variable, and the require('../memory/gotchas-memory') call in
context-injector.js.
In @.aiox-core/core/ideation/ideation-engine.js:
- Around line 16-26: The current destructuring of ({ GotchasMemory } =
require('../memory/gotchas-memory')) can yield GotchasMemory = undefined without
throwing, leaving gotchasMemoryLoadError null and silently disabling
IdeationEngine.gotchasMemory; update the try/catch to first require the module
into a temp (e.g., const mod = require('../memory/gotchas-memory')), then if
(!mod || typeof mod.GotchasMemory === 'undefined') set gotchasMemoryLoadError to
a new Error describing the missing export and (when AIOX_DEBUG) log a clear
warning including that error; otherwise assign GotchasMemory = mod.GotchasMemory
so ideate() and IdeationEngine.gotchasMemory behave correctly.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 6ba5a70b-fbe3-42d6-8d0d-0ed8e6012e2c
📒 Files selected for processing (6)
.aiox-core/core/execution/context-injector.js.aiox-core/core/execution/subagent-dispatcher.js.aiox-core/core/ideation/ideation-engine.js.aiox-core/data/entity-registry.yaml.aiox-core/install-manifest.yamltests/core/gotchas-memory-imports.test.js
✅ Files skipped from review due to trivial changes (1)
- .aiox-core/install-manifest.yaml
🚧 Files skipped from review as they are similar to previous changes (3)
- tests/core/gotchas-memory-imports.test.js
- .aiox-core/core/execution/subagent-dispatcher.js
- .aiox-core/data/entity-registry.yaml
Addressed in later commits on this PR. HEAD 9886fd3 fixes the GotchasMemory diagnostics, missing named export guard, and adds regression coverage; CI is green.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 @.aiox-core/core/ideation/ideation-engine.js:
- Around line 29-33: The code only checks that gotchasMemoryModule.GotchasMemory
is not undefined but doesn't verify it's constructible; update the guard around
gotchasMemoryModule/GotchasMemory so it confirms GotchasMemory is a
function/class (e.g., typeof GotchasMemory === 'function') or otherwise
constructible before assigning and attempting new GotchasMemory(); if the check
fails, throw a clear Error that includes GOTCHAS_MEMORY_MODULE and the actual
typeof value to preserve context for the surrounding try/catch that handles
optional dependency loading.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 43f5e4f2-fe3c-42e3-b696-f8d73d1ad62d
📒 Files selected for processing (6)
.aiox-core/core/execution/context-injector.js.aiox-core/core/execution/subagent-dispatcher.js.aiox-core/core/ideation/ideation-engine.js.aiox-core/data/entity-registry.yaml.aiox-core/install-manifest.yamltests/core/gotchas-memory-imports.test.js
✅ Files skipped from review due to trivial changes (1)
- .aiox-core/install-manifest.yaml
🚧 Files skipped from review as they are similar to previous changes (3)
- .aiox-core/core/execution/subagent-dispatcher.js
- .aiox-core/data/entity-registry.yaml
- .aiox-core/core/execution/context-injector.js
…#668) * fix: load gotchas memory named export (SynkraAI#517) * fix: surface gotchas memory load diagnostics (SynkraAI#517) * fix: guard gotchas memory named export (SynkraAI#517) * fix: require constructible gotchas memory export (SynkraAI#517)
Summary
gotchas-memory.js.IdeationEngine,ContextInjector, andSubagentDispatcherand verifies each receives a realGotchasMemoryinstance.@aiox-squads/coreto5.1.8and records Story 123.12.Validation
node -c .aiox-core/core/ideation/ideation-engine.js && node -c .aiox-core/core/execution/context-injector.js && node -c .aiox-core/core/execution/subagent-dispatcher.jsIdeationEngine,ContextInjector,SubagentDispatchernpm test -- tests/core/gotchas-memory-imports.test.js --runInBandnpm test -- tests/core/gotchas-memory-imports.test.js tests/core/context-injector.test.js tests/core/subagent-dispatcher.test.js --runInBand(69 tests passed)npm run validate:manifestnpm run validate:publishnpm run lint -- --quietnpm run typechecknpm run test:ci(315 suites passed, 7838 tests passed, 149 skipped)git diff --checkRefs #517.
Supersedes #521.
Summary by CodeRabbit
Bug Fixes
Tests
Documentation
Chores