fix(memory): clean up unused JWT token parameter in memory init (#204)#300
Conversation
The upstream whisper-rs-sys builds whisper.cpp via CMake which defaults to /MD (dynamic CRT), but Rust and all other C deps use /MT (static CRT). This causes LNK2038/LNK1169 linker errors on Windows. Patch whisper-rs-sys from tinyhumansai/whisper-rs-sys fork which adds config.static_crt(true) and overrides all per-config CMake flags (Debug/Release/MinSizeRel/RelWithDebInfo) from /MD to /MT. Closes tinyhumansai#273
Memory is local-only (SQLite). The from_token() method accepted a JWT but ignored it, always falling back to new_local(). Remove the dead method, make jwt_token optional in MemoryInitRequest for backward compat, and document the local-only design. Closes tinyhumansai#204 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughThis PR resolves issue Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/tinyhumansai-sdk.md`:
- Line 390: Update the docs to reflect the current runtime holder: replace the
description that the client is stored in MemoryState with the actual global
holder MEMORY_CLIENT_STATE, and state its type/structure as
OnceLock<Mutex<Option<MemoryClientRef>>> (the active holder defined in
openhuman::memory::ops, referencing MEMORY_CLIENT_STATE and MemoryClientRef) so
the documentation matches the implementation.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: a5e5e615-5007-4524-9ae1-a77406572274
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (8)
Cargo.tomlapp/src/utils/tauriCommands.tsdocs/tinyhumansai-sdk.mdsrc/core/jsonrpc.rssrc/openhuman/memory/ops.rssrc/openhuman/memory/rpc_models.rssrc/openhuman/memory/schemas.rssrc/openhuman/memory/store/client.rs
| ``` | ||
|
|
||
| The client is stored as `Arc<MemoryClient>` inside a `Mutex<Option<MemoryClientRef>>` (`MemoryState`), shared across Tauri commands. | ||
| The client is stored as `Arc<MemoryClient>` inside a `Mutex<Option<MemoryClientRef>>` (`MemoryState`), shared across RPC handlers. |
There was a problem hiding this comment.
Fix the state-holder reference to match current implementation.
Line 390 says the client is stored via MemoryState, but the active runtime holder is the global MEMORY_CLIENT_STATE in src/openhuman/memory/ops.rs (OnceLock<Mutex<Option<MemoryClientRef>>>). Updating this avoids implementation drift in docs.
📝 Proposed doc fix
-The client is stored as `Arc<MemoryClient>` inside a `Mutex<Option<MemoryClientRef>>` (`MemoryState`), shared across RPC handlers.
+The client is stored as `Arc<MemoryClient>` in a process-wide `OnceLock<Mutex<Option<MemoryClientRef>>>`
+(`MEMORY_CLIENT_STATE` in `src/openhuman/memory/ops.rs`), shared across RPC handlers.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| The client is stored as `Arc<MemoryClient>` inside a `Mutex<Option<MemoryClientRef>>` (`MemoryState`), shared across RPC handlers. | |
| The client is stored as `Arc<MemoryClient>` in a process-wide `OnceLock<Mutex<Option<MemoryClientRef>>>` | |
| (`MEMORY_CLIENT_STATE` in `src/openhuman/memory/ops.rs`), shared across RPC handlers. |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@docs/tinyhumansai-sdk.md` at line 390, Update the docs to reflect the current
runtime holder: replace the description that the client is stored in MemoryState
with the actual global holder MEMORY_CLIENT_STATE, and state its type/structure
as OnceLock<Mutex<Option<MemoryClientRef>>> (the active holder defined in
openhuman::memory::ops, referencing MEMORY_CLIENT_STATE and MemoryClientRef) so
the documentation matches the implementation.
…humansai#204) (tinyhumansai#300) * fix: patch whisper-rs-sys for Windows MSVC static CRT (/MT) The upstream whisper-rs-sys builds whisper.cpp via CMake which defaults to /MD (dynamic CRT), but Rust and all other C deps use /MT (static CRT). This causes LNK2038/LNK1169 linker errors on Windows. Patch whisper-rs-sys from tinyhumansai/whisper-rs-sys fork which adds config.static_crt(true) and overrides all per-config CMake flags (Debug/Release/MinSizeRel/RelWithDebInfo) from /MD to /MT. Closes tinyhumansai#273 * fix: clean up unused JWT token parameter in memory init Memory is local-only (SQLite). The from_token() method accepted a JWT but ignored it, always falling back to new_local(). Remove the dead method, make jwt_token optional in MemoryInitRequest for backward compat, and document the local-only design. Closes tinyhumansai#204 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: sanil jain <jainsanil18@gmail.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
MemoryClient::from_token()that silently ignored the JWT parameterjwt_tokenoptional (Option<String>) inMemoryInitRequestfor backward compatibilitysyncMemoryClientToken(), and SDK documentation to reflect local-only memorymemory.initaccepts empty paramsProblem
memory_initRPC accepted a JWT token but always created a local SQLite client, ignoring the token entirely. The frontend sent a JWT on every login viasyncMemoryClientToken(), creating confusion about whether remote memory sync was supported. (#204)Solution
Chose the "remove and document" approach: removed
from_token(), madejwt_tokenoptional with#[serde(default)], and documented at every touch point (Rust doc-comments, RPC schema description, SDK docs, TypeScript JSDoc) that memory is local-only. Frontend still sends the token for backward compat but it's explicitly discarded.Submission Checklist
invoke_memory_init_accepts_empty_paramstest injsonrpc.rsMemoryClient,MemoryInitRequest,syncMemoryClientToken, SDK docslet _ = request.jwt_token;with explanationImpact
jwt_tokenstill work).Related
🤖 Generated with Claude Code
Summary by CodeRabbit
Refactor
Documentation
Chores