fix(memory): accept time_window_days global alias
Summary
- Allows
QueryGlobalRequestto deserializetime_window_daysas an alias forwindow_days. - Updates the consolidated
memory_treetool schema to expose the canonicalwindow_daysfield forquery_globalwhile preserving the existingtime_window_dayscompatibility path. - Adds regression tests for the alias and consolidated schema exposure.
Problem
The consolidated memory_tree tool advertised time_window_days for query_global, but the backend deserialized query_global arguments into:
QueryGlobalRequest { window_days: u32 }
So calls shaped like this failed with missing field 'window_days':
{
"mode": "query_global",
"time_window_days": 7
}
Solution
Accept time_window_days as a serde alias for window_days:
#[serde(alias = "time_window_days")]
pub window_days: u32,
and make the consolidated schema explicit about window_days for query_global.
Submission Checklist
- [x] Tests added or updated (happy path + failure / edge case): alias deserialization test and consolidated schema exposure test added.
- [x] N/A: Diff coverage >= 80% — local coverage tooling could not be run in this environment; changed behavior is covered by focused unit tests in source.
- [x] N/A: Coverage matrix updated — bug fix to existing tool schema/deserialization behavior; no feature row added/removed/renamed.
- [x] N/A: All affected feature IDs from the matrix are listed — no matrix feature row changed.
- [x] No new external network dependencies introduced.
- [x] N/A: Manual smoke checklist updated — internal memory tool schema/deserialization fix.
- [x] Linked issue closed via
Closes #2252.
Impact
- Runtime/platform impact: Rust core memory tree request deserialization and tool schema only.
- Compatibility impact: back-compatible; existing callers using
window_dayscontinue to work, and consolidated tool callers usingtime_window_daysnow work too. - Security impact: none; no new capability or external access.
Related
Closes #2252
AI Authored PR Metadata
Linear Issue
- Key: N/A
- URL: N/A
Commit & Branch
- Branch:
fix/memory-tree-window-alias - Commit SHA:
c3350ae
Validation Run
- [x]
pnpm --filter openhuman-app format:check— N/A: Rust-only change. - [x]
pnpm typecheck— N/A: Rust-only change. - [x] Focused tests: attempted
cargo test --manifest-path Cargo.toml memory_tree --lib; blocked locally, see below. - [x] Rust fmt/check: attempted
cargo fmt --check; blocked locally, see below. - [x] Tauri fmt/check: N/A: no
app/src-taurichanges.
Validation Blocked
-
command:cargo fmt --check -
error:error: no such command: fmt -
impact:Local environment has Rust 1.75 without rustfmt installed; formatting should be verified by CI. -
command:cargo test --manifest-path Cargo.toml memory_tree --lib -
error:failed to parse lock file ... Cargo.lock; lock file version 4 requires -Znext-lockfile-bump -
impact:Local cargo is 1.75 and cannot read the repository's lockfile format; CI/newer cargo should run the focused tests.
Behavior Changes
- Intended behavior change:
memory_treeglobal queries accept bothwindow_daysand the consolidated-schema aliastime_window_days. - User-visible effect: LLM/tool calls using the advertised consolidated field no longer fail with missing
window_days.
Parity Contract
- Legacy behavior preserved: existing
window_dayscallers continue to deserialize identically. - Guard/fallback/dispatch parity checks: only request deserialization/schema metadata changed; query execution remains unchanged.
Duplicate / Superseded PR Handling
- Duplicate PR(s): none known.
- Canonical PR: this PR.
- Resolution: N/A.
Summary by CodeRabbit
- Improvements
- Memory query endpoints now accept an alternate parameter name ("time_window_days") in requests for compatibility with existing clients.
- The memory tool’s parameter schema now exposes both "window_days" and "time_window_days" so interfaces can supply either field.
This PR makes Memory Tree Global Query Field Compatibility 🎯 2 (Simple) | ⏱️ ~8 minutes "I nibble on a schema, neat and small, ✏️ Tip: You can configure your own custom pre-merge checks in the settings.📝 Walkthrough
Walkthrough
QueryGlobalRequest.window_days accept time_window_days via a serde alias and updates the consolidated MemoryTree tool schema to expose both window_days and time_window_days; tests verify both deserialization and schema presence.Changes
Layer / File(s)
Summary
QueryGlobalRequest deserialization alias
src/openhuman/memory/tree/retrieval/rpc.rsQueryGlobalRequest.window_days gains #[serde(alias = "time_window_days")]. A unit test verifies time_window_days JSON deserializes into window_days.
Tool schema and documentation update
src/openhuman/tools/impl/memory/tree/mod.rsMemoryTreeTool.parameters_schema() now documents both time_window_days and window_days (with a compatibility note for query_global), and a schema unit test asserts both fields are present.Estimated code review effort
Poem
Two names at once — no error at all.
time_window_days and window_days agree,
The rabbit hops on, schema-smile for me! 🐇"🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name
Status
Explanation
Title check
✅ Passed
The title accurately describes the main change: adding a serde alias for time_window_days to the window_days field in QueryGlobalRequest.
Linked Issues check
✅ Passed
The PR fully addresses issue
#2252 by implementing the serde alias approach and updating the consolidated schema to expose both window_days and time_window_days fields.
Out of Scope Changes check
✅ Passed
All changes are directly scoped to fixing the schema/deserialization mismatch described in issue
#2252; no unrelated modifications detected.
Docstring Coverage
✅ Passed
Docstring coverage is 83.33% which is sufficient. The required threshold is 80.00%.
Description Check
✅ Passed
Check skipped - CodeRabbit’s high-level summary is enabled.
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 @coderabbitai help to get the list of available commands and usage tips.