Skip to content

fix: Standardize namespace before userId parameter order in Java SDK#180

Open
raphaeldelio wants to merge 1 commit intoredis:mainfrom
raphaeldelio:fix/java-sdk-standardize-param-order
Open

fix: Standardize namespace before userId parameter order in Java SDK#180
raphaeldelio wants to merge 1 commit intoredis:mainfrom
raphaeldelio:fix/java-sdk-standardize-param-order

Conversation

@raphaeldelio
Copy link
Collaborator

@raphaeldelio raphaeldelio commented Mar 4, 2026

Summary

Fixes inconsistent parameter ordering in WorkingMemoryService that caused confusion and bugs

Changes

  • Standardized all methods to use namespace before userId parameter order
  • Updated internal method calls within the service
  • Fixed affected tests

Breaking Change

This changes the method signatures for:

  • getWorkingMemory
  • putWorkingMemory
  • deleteWorkingMemory

Callers passing explicit values for both namespace and userId will need to swap the argument order.


Note

Medium Risk
This is a breaking SDK API change: it reorders public method parameters for getWorkingMemory, putWorkingMemory, and deleteWorkingMemory, so existing callers passing both namespace and userId may silently swap values and hit wrong keys/queries if not updated.

Overview
Standardizes WorkingMemoryService public APIs to use consistent parameter ordering with namespace before userId for getWorkingMemory, putWorkingMemory, and deleteWorkingMemory, and updates all internal call sites to match.

Updates unit/integration tests to use the new signature, and adds an integration test that creates multiple working memories and verifies each can be retrieved independently.

Written by Cursor Bugbot for commit 63df6cc. This will update automatically on new commits. Configure here.

@raphaeldelio raphaeldelio requested review from bsbodden and jruaux March 4, 2026 14:33
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

.build();

return putWorkingMemory(sessionId, updated, userId, namespace, null, null);
return putWorkingMemory(sessionId, updated, namespace, userId, null, null);
Copy link

Choose a reason for hiding this comment

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

Swapped namespace and userId in addMemoriesToWorkingMemory call

High Severity

In addMemoriesToWorkingMemory, the call putWorkingMemory(sessionId, updated, null, namespace, null, null) passes null as the namespace parameter and the local namespace variable as the userId parameter. After the signature reorder to (sessionId, memory, namespace, userId, ...), this call was not updated and now has the arguments swapped. The namespace value gets sent as a user_id query parameter and namespace falls back to the default instead of the intended value.

Fix in Cursor Fix in Web

Copy link
Collaborator

Choose a reason for hiding this comment

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

@raphaeldelio 👆🏽


// Execute
AckResponse response = client.workingMemory().deleteWorkingMemory("session-123", "user-456", "test-namespace");
AckResponse response = client.workingMemory().deleteWorkingMemory("session-123", "test-namespace", "user-456");
Copy link

Choose a reason for hiding this comment

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

Test passes userId and namespace in wrong order

Medium Severity

In testPutWorkingMemory, the call putWorkingMemory("session-123", memory, "user-456", "test-namespace", null, null) was not updated for the new parameter order. After the signature change to (sessionId, memory, namespace, userId, ...), this passes "user-456" as namespace and "test-namespace" as userId, which is reversed from the intended values.

Fix in Cursor Fix in Web

Copy link
Collaborator

Choose a reason for hiding this comment

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

@raphaeldelio 👆🏽

Copy link
Collaborator

@bsbodden bsbodden left a comment

Choose a reason for hiding this comment

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

LGTM, but check the automated reviews and why the CI is breaking

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.

2 participants