Skip to content

Expose affect parameter in tool-registry schema - #11

Open
kunkunGames wants to merge 1 commit into
mainfrom
expose-affect-parameter-schema-13289953424880790571
Open

Expose affect parameter in tool-registry schema#11
kunkunGames wants to merge 1 commit into
mainfrom
expose-affect-parameter-schema-13289953424880790571

Conversation

@kunkunGames

Copy link
Copy Markdown
Owner

Exposed the affect parameter (sentiment/emotional tags) in the tool-registry schema for several core tools (recall, batch_remember, amend, reconstruct_history, and search_traces).

Key changes:

  • Schema Updates: Added affect to the JSON schema definitions in lib/tools/memory-schemas.js.
  • Database Support: Added the affect column to the fragments table in lib/memory/memory-schema.sql with a CHECK constraint and an optimized partial index.
  • Implementation:
    • Updated BatchRememberProcessor to support bulk insertion of affect values.
    • Updated MemoryRememberer to support updating affect via the amend tool.
    • Updated HistoryReconstructor and _queryFragmentTraces to support filtering by affect.
    • Updated FragmentReader and tool_recall to include the affect field in results.
  • Cleanup: Removed the now-obsolete TODO in MemoryRecaller.js.
  • Verification: Added and passed a new unit test tests/unit/affect-exposure-extended.test.js to ensure all relevant schemas correctly expose the parameter.

PR created automatically by Jules for task 13289953424880790571 started by @kunkunGames

- 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>
@google-labs-jules

Copy link
Copy Markdown

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +185 to +187
if (Array.isArray(affect)) {
params.push(affect);
affectClause = `AND f.affect = ANY($${params.length})`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment thread lib/tools/reconstruct.js
Comment on lines +189 to +191
if (Array.isArray(affect)) {
params.push(affect);
affectClause = `AND f.affect = ANY($${params.length})`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +185 to +187
if (Array.isArray(affect)) {
params.push(affect);
affectClause = `AND f.affect = ANY($${params.length})`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment thread lib/tools/reconstruct.js
Comment on lines +189 to +191
if (Array.isArray(affect)) {
params.push(affect);
affectClause = `AND f.affect = ANY($${params.length})`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@chatgpt-codex-connector

Copy link
Copy Markdown

💡 Codex Review

https://github.com/kunkunGames/memento-mcp/blob/7d35b57e79669c122a36bb33c221291722df609b/lib/memory/HistoryReconstructor.js#L185-L187
P2 Badge 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.


https://github.com/kunkunGames/memento-mcp/blob/7d35b57e79669c122a36bb33c221291722df609b/lib/tools/reconstruct.js#L189-L191
P2 Badge 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.

ℹ️ 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".

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