Expose affect parameter in tool-registry schema - #11
Conversation
- Add affect column and partial index to database schema. - Expose affect parameter in recall, batch_remember, amend, reconstruct_history, and search_traces tool schemas. - Update MemoryRememberer, BatchRememberProcessor, and HistoryReconstructor to handle affect parameter. - Update FragmentReader and tool handlers to include affect in outputs and filtering. - Remove TODO comment in MemoryRecaller. - Add unit test for schema verification. Co-authored-by: kunkunGames <271022317+kunkunGames@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7d35b57e79
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (Array.isArray(affect)) { | ||
| params.push(affect); | ||
| affectClause = `AND f.affect = ANY($${params.length})`; |
There was a problem hiding this comment.
Ignore empty affect arrays in history reconstruction filter
When reconstruct_history receives affect: [], this branch still adds f.affect = ANY($n), which evaluates to false for every row and returns an empty timeline. The schema currently allows array input without minItems, so clients that serialize “no affect filter” as an empty array will get silently incorrect no-result responses instead of unfiltered results; this should match the existing reader behavior that skips filtering for empty arrays.
Useful? React with 👍 / 👎.
| if (Array.isArray(affect)) { | ||
| params.push(affect); | ||
| affectClause = `AND f.affect = ANY($${params.length})`; |
There was a problem hiding this comment.
Skip affect predicate for empty arrays in search_traces
search_traces has the same empty-array handling bug: passing affect: [] adds f.affect = ANY($n), which guarantees zero matches. Because the new tool-registry schema exposes array-form affect values, callers can legitimately send empty arrays and unexpectedly suppress all trace results; treat empty arrays as “no filter” before building SQL.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7d35b57e79
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (Array.isArray(affect)) { | ||
| params.push(affect); | ||
| affectClause = `AND f.affect = ANY($${params.length})`; |
There was a problem hiding this comment.
Ignore empty affect arrays in history reconstruction filter
When reconstruct_history receives affect: [], this branch still adds f.affect = ANY($n), which evaluates to false for every row and returns an empty timeline. The schema currently allows array input without minItems, so clients that serialize “no affect filter” as an empty array will get silently incorrect no-result responses instead of unfiltered results; this should match the existing reader behavior that skips filtering for empty arrays.
Useful? React with 👍 / 👎.
| if (Array.isArray(affect)) { | ||
| params.push(affect); | ||
| affectClause = `AND f.affect = ANY($${params.length})`; |
There was a problem hiding this comment.
Skip affect predicate for empty arrays in search_traces
search_traces has the same empty-array handling bug: passing affect: [] adds f.affect = ANY($n), which guarantees zero matches. Because the new tool-registry schema exposes array-form affect values, callers can legitimately send empty arrays and unexpectedly suppress all trace results; treat empty arrays as “no filter” before building SQL.
Useful? React with 👍 / 👎.
💡 Codex Reviewhttps://github.com/kunkunGames/memento-mcp/blob/7d35b57e79669c122a36bb33c221291722df609b/lib/memory/HistoryReconstructor.js#L185-L187 When https://github.com/kunkunGames/memento-mcp/blob/7d35b57e79669c122a36bb33c221291722df609b/lib/tools/reconstruct.js#L189-L191
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Exposed the
affectparameter (sentiment/emotional tags) in the tool-registry schema for several core tools (recall,batch_remember,amend,reconstruct_history, andsearch_traces).Key changes:
affectto the JSON schema definitions inlib/tools/memory-schemas.js.affectcolumn to thefragmentstable inlib/memory/memory-schema.sqlwith a CHECK constraint and an optimized partial index.BatchRememberProcessorto support bulk insertion ofaffectvalues.MemoryRemembererto support updatingaffectvia theamendtool.HistoryReconstructorand_queryFragmentTracesto support filtering byaffect.FragmentReaderandtool_recallto include theaffectfield in results.MemoryRecaller.js.tests/unit/affect-exposure-extended.test.jsto ensure all relevant schemas correctly expose the parameter.PR created automatically by Jules for task 13289953424880790571 started by @kunkunGames