feat(memory-tree): status panel + on/off toggle (#1856 Part 1)
Summary
- Adds the Memory Tree status panel (4 tiles + auto-sync toggle) inside
MemoryWorkspace, surfacing it in both/intelligenceand Settings → Memory data with a single mount point. - Wires up two new RPCs —
memory_tree_pipeline_status(read-side aggregate) andmemory_tree_set_enabled(toggle that flipsscheduler_gate.modebetweenautoandoff). - Drops the half-baked
useConsciousItems+useMemoryIngestionStatus-driven status pill fromIntelligence.tsx; the new panel supersedes it.
Problem
#1856 calls for a real Memory Tree status surface that exposes pipeline health and lets the user pause auto-ingest without restarting the core. The existing header pill was sourced from the legacy actionable-items pipeline and showed counts that no longer matched anything visible.
Solution
Rust (src/openhuman/memory_tree/tree/rpc.rs, src/openhuman/memory/schema.rs):
pipeline_status_rpcaggregatesmem_tree_chunks(COUNT + MAX(timestamp_ms) in a single query) + per-statemem_tree_jobscounters + awalkdir-driven recursive size ofmemory_tree_content_root(). All blocking I/O runs onspawn_blocking. A purederive_pipeline_statushelper locks the precedence rules (paused>error>syncing>running>idle).set_enabled_rpcflipsconfig.scheduler_gate.mode = SchedulerGateMode::{Auto, Off}, persists withconfig.save(), and hot-reloads viascheduler_gate::gate::update_config(...)so live workers observe the new policy at their nextwait_for_capacity()await. Idempotent (changed=falsefor no-ops).- Schema entries match the existing
RegisteredControllerpattern;all_controller_schemas_and_registered_controllers_stay_in_synccontinues to pass.
Frontend (app/src/):
MemoryTreeStatusPanel.tsxrenders the four-tile dashboard plus an inline toggle row whose markup mirrorsAIPanel'sToggleRow. Adaptive polling — 1.5s while syncing/active jobs, 4s otherwise — mirrorsuseMemoryIngestionStatus. Error banner with retry button covers the fetch failure path; toggle errors surface via the existingonToastchannel.memoryTreePipelineStatus()/memoryTreeSetEnabled()wrappers intauriCommands/memoryTree.tskeep the snake_case-on-the-wire convention used by the sibling helpers.- Mounted above
<MemorySources>inMemoryWorkspace(one place, two surfaces). - Intelligence header cleanup: removed
useConsciousItems+useMemoryIngestionStatus+useIntelligenceStatsimports + thesystemStatus*derivation block + the two pill JSX blocks. The hooks themselves stay — they have their own tests and may serve future consumers.
i18n: new memoryTree.status.* keys in en.ts + the English chunk + all 12 non-English chunk-1 files. pnpm i18n:check reports missing: 0, extra: 0, drifted: 0 across every locale.
Notes / tradeoffs:
- The 20-min Composio fetch loop is intentionally NOT paused by this toggle yet — that requires a
Notifysignal on the periodic timer and is queued for #1856 Part 2. - Schema does not yet record original-source sizes, so
compression_ratiois deferred until that is plumbed.
Submission Checklist
- [x] Tests added or updated (happy path + at least one failure / edge case) per Testing Strategy — 5 new Rust tests in
memory_tree::tree::rpc::tests(precedence rules, idle/paused/ingested branches, toggle round-trip incl. no-op); 6 new Vitest cases covering tiles, skeleton, toggle round-trip, paused branch, fetch error + retry, and toast on toggle error. - [x] Diff coverage ≥ 80% — every new branch in
pipeline_status_rpc,derive_pipeline_status,set_enabled_rpc, the React panel, and the hook is exercised. Localpnpm debug unit MemoryTreeStatusPanelandcargo test --lib memory_tree::tree::rpc::testspass with all 6 + 15 cases green. - [x] N/A: Coverage matrix updated — no feature-row add/remove/rename, only a new status surface within an existing one.
- [x] N/A: All affected feature IDs listed in
## Related— no matrix-row change. - [x] No new external network dependencies introduced — only
walkdir(already inCargo.toml). - [x] N/A: Manual smoke checklist — not a release-cut surface.
- [x] Linked issue referenced via
Refs #1856(intentionally NOTCloses— Part 2 / Part 3 of the issue stay open).
Impact
- Desktop: users get an immediate, color-coded view of Memory Tree health (Status / Last sync / Total chunks / Wiki size) and a 1-click pause/resume control. Paused state survives core restart (persisted in
config.toml). - Pause semantics: flipping the toggle off sets
scheduler_gate.mode = off, which the existing memory queue worker (memory_queue/worker.rs) cooperatively respects viawait_for_capacity(). The 20-min Composio fetch loop is unaffected (queued for Part 2). - Performance: the status RPC is two SQL counters (one aggregate, one per-job-state) plus a
walkdirof the memory_tree content root — cheap enough to poll at 1.5–4s. Logged atdebuglevel with[memory-tree][rpc]and[ui-flow][memory-tree-status]prefixes for trace grepping. - Compatibility: no schema migration, no config-shape change beyond toggling an existing enum value.
Related
Refs #1856 (Part 1 only — Part 2 = pause 20-min Composio fetch loop + team siloing; Part 3 = integration health list).
Follow-up work:
- Pause the 20-min Composio fetch loop on toggle (
memory_sync/composio/periodic.rsneeds aNotifysignal). - Add
compression_ratioonce original source sizes land in the chunks schema. - Integration health list (#1856 Part 3).
- Team-level knowledge siloing (#1856 Part 2).
Summary by CodeRabbit
- New Features
- Memory Tree Status Panel: 4-tile dashboard (status, last sync, total chunks, storage) with skeletons and live polling.
- Auto-sync toggle with busy/disabled states, retry flow, and toast notifications on toggle failures.
- Panel integrated into the Memory workspace, replacing legacy header status pills.
- Localization
- Added translations for the status panel across many languages.
- Tests
- UI tests for display states, loading, error/retry, and toggle interactions.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 06aeb045-0dea-4713-b28f-06712718163d
📥 Commits
Reviewing files that changed from the base of the PR and between 9e07bdc7c00f32676d63eba933e1e3704cf4f83f and cd4e94fce19ca53ff644630bdf7d64792900fbdf.
📒 Files selected for processing (3)
app/src/pages/Intelligence.tsxapp/src/utils/tauriCommands/memoryTree.tssrc/openhuman/memory/schema.rs
💤 Files with no reviewable changes (1)
- app/src/pages/Intelligence.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
- app/src/utils/tauriCommands/memoryTree.ts
- src/openhuman/memory/schema.rs
📝 Walkthrough
Walkthrough
Adds backend RPCs (pipeline_status, set_enabled) with handlers/tests, TypeScript tauri wrappers, an adaptive polling hook and MemoryTreeStatusPanel UI (four tiles + auto-sync toggle), i18n keys across languages, component tests, and integrates the panel into MemoryWorkspace while removing legacy header pills.
Changes
Memory Tree Status Panel Feature
| Layer / File(s) | Summary |
|---|---|
Backend RPC handlers & tests src/openhuman/memory_tree/tree/rpc.rs |
New RPC types and implementations: pipeline status aggregation (chunks, jobs, wiki size), compute_dir_size_bytes, derive_pipeline_status precedence, set_enabled persistence/hot-update, and unit/async tests covering status derivation and toggle persistence. |
Controller schema and handlers src/openhuman/memory/schema.rs |
Registers memory_tree controller schemas and adds handlers that load config and delegate to RPC functions. |
Frontend RPC Command Wrappers app/src/utils/tauriCommands/memoryTree.ts |
Typed wrappers memoryTreePipelineStatus() and memoryTreeSetEnabled() that invoke core RPC, unwrap envelopes, and return typed responses. |
UI Polling Hook & Component app/src/components/intelligence/MemoryTreeStatusPanel.tsx |
useMemoryTreeStatus adaptive polling hook (fast/slow cadence, cancel on unmount) and MemoryTreeStatusPanel rendering four tiles (status, last sync, total chunks, wiki size), skeletons, error banner+retry, and auto-sync toggle with toast error reporting; hook re-exported. |
Component Test Suite app/src/components/intelligence/MemoryTreeStatusPanel.test.tsx |
Vitest tests mocking tauri commands: resolved tile rendering, loading skeletons, toggle round-trip and paused UI, error+retry flow, and toggle failure toasts. |
Localization app/src/lib/i18n/chunks/*, app/src/lib/i18n/en.ts |
Adds memoryTree.status.* keys (labels, state strings, error/retry/toggle messages, relative time buckets) across language chunks and central English map. |
Integration & Cleanup app/src/components/intelligence/MemoryWorkspace.tsx, app/src/pages/Intelligence.tsx |
Mounts MemoryTreeStatusPanel inside MemoryWorkspace (wires onToast) and removes legacy Intelligence header pills, replacing with placeholder comments. |
Sequence Diagram(s)
sequenceDiagram
participant MemoryWorkspace
participant StatusPanel as MemoryTreeStatusPanel
participant Hook as useMemoryTreeStatus
participant TauriCmd as Tauri Commands
participant Backend as Backend RPC
participant Toast as onToast Callback
MemoryWorkspace->>StatusPanel: mount (onToast)
StatusPanel->>Hook: start polling
Hook->>TauriCmd: memoryTreePipelineStatus()
TauriCmd->>Backend: openhuman.memory_tree_pipeline_status
Backend-->>TauriCmd: PipelineStatusResponse
TauriCmd-->>Hook: typed status
Hook-->>StatusPanel: status (loading=false)
StatusPanel->>StatusPanel: render tiles + toggle
User->>StatusPanel: toggle auto-sync
StatusPanel->>TauriCmd: memoryTreeSetEnabled(false)
TauriCmd->>Backend: openhuman.memory_tree_set_enabled
alt toggle succeeds
Backend-->>TauriCmd: SetEnabledResponse
TauriCmd-->>StatusPanel: response
StatusPanel->>Hook: refresh()
Hook->>TauriCmd: memoryTreePipelineStatus()
Backend-->>StatusPanel: updated paused status
StatusPanel->>StatusPanel: re-render paused state
else toggle fails
Backend-->>TauriCmd: Error
TauriCmd-->>StatusPanel: Error
StatusPanel->>Toast: onToast({ message })
end
Estimated code review effort
🎯 4 (Complex) | ⏱️ ~45 minutes
Possibly related issues
- tinyhumansai/openhuman#1856 — Implements the Memory Tree status panel and scheduler toggle described in the issue (RPCs, UI, and wiring).
Suggested reviewers
- graycyrus
- M3gA-Mind
Poem
I munched the bytes and watched the sync,
Four shining tiles — click and blink.
I paused the flow, then nudged it free,
The tree breathed calm and hummed to me.
Hooray — small bytes, big joy. 🐇✨
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title clearly and concisely describes the main change: adding a Memory Tree status panel UI component with an on/off toggle functionality, which is the primary focus across all modified files. |
| Docstring Coverage | ✅ Passed | Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. |
| Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
[!WARNING] There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.
🔧 ESLint
If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add
eslintto devDependencies.
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.
Pushed 4 commits addressing all 5 CodeRabbit actionables on top of feat/1856-memory-tree-status-panel:
- Actionable 1 (
memoryTree.tswrappers must usecore_rpc_relay) — fixed in1785ac28. BothmemoryTreePipelineStatusandmemoryTreeSetEnablednow route throughinvoke('core_rpc_relay', { request: { method, params } }). The status panel mounts during boot and starts polling before the realtime socket has connected, which is exactly the case AGENTS.md /.claude/memory.mdflag as acallCoreRpcfoot-gun (rawfetch()fallback → CORS preflight). Kept the rest of the file oncallCoreRpcsince other wrappers are user-initiated and not part of this PR. - Actionable 2 (
formatRelativeMsmust go through i18n) — fixed ind8c5a802. Helper now takes thettranslator and pulls every bucket (justNow,secondsAgo,minuteAgo/minutesAgo,hourAgo/hoursAgo,dayAgo/daysAgo) out of thememoryTree.status.*namespace. The runtimet()does not interpolate, so{count}placeholders are substituted client-side via.replace('{count}', String(n)), matching the establisheddevices.lastSeenMinutes/team.memberCountpattern. Added 8 new keys toen.tsplus all 13 chunk-1 files (en + 12 locale chunks, non-English entries seeded with the English copy).pnpm i18n:checkreportsmissing: 0 / extra: 0for every locale. - Actionable 3 (fake timers in MemoryTreeStatusPanel test) — fixed in
072f7d90.beforeEachnow pinsvi.useFakeTimers({ shouldAdvanceTime: true })+vi.setSystemTime(FIXED_NOW_MS),payload()deriveslast_sync_msfrom the same constant, andafterEachrestores real timers and mocks.shouldAdvanceTime: trueis necessary so RTL'swaitForand the panel's polling loop keep making progress without per-testadvanceTimersByTimecalls;setSystemTimestill freezes the wall clock forformatRelativeMs. All 6 existing tests pass. - Actionable 4 (
wiki_size_bytesonly walkwiki/) — fixed in65526ce1. Picked Option A (scope walk tocontent_root.join("wiki")) so the wire field stayswiki_size_bytes, matching the UI tile label "Wiki size". Missingwiki/short-circuits to 0, so fresh installs are unaffected. Updated the rustdoc onPipelineStatusResponse.wiki_size_bytesto document the new scope. - Actionable 5 (redact walk-error path) — fixed in
65526ce1. Verifiedwalkdir::Error'sDisplayimpl writes"IO error for operation on <abs-path>: ...", so{err}was a second path-leak vector beyonderr.path(). Switched the log tohas_path={} kind={:?}— boolean +io::ErrorKindonly.
Validation (all from the worktree, against upstream/main):
cargo fmt --manifest-path Cargo.toml --check— clean.GGML_NATIVE=OFF cargo check --manifest-path Cargo.toml --lib— pass (pre-existing warnings only).GGML_NATIVE=OFF cargo test --lib memory_tree::tree::rpc::tests— 15/15 pass (5 new + 10 existing).pnpm exec prettier --checkover the changed TS files — clean.pnpm exec eslint --max-warnings 0over the changed TS files — clean.pnpm typecheck— clean.pnpm i18n:check—missing: 0 / extra: 0for all 12 non-English locales.pnpm debug unit MemoryTreeStatusPanel— 6/6 pass.
Tip is 65526ce1. Force-with-lease push, no new PR.
thanks, looks good merging this now