[GH-ISSUE #1885] [Issue]: storage_list calls slow down repeatedly #911

Closed
opened 2026-10-21 05:23:18 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @Promansis on GitHub (Jun 2, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1885

Originally assigned to: @Promansis on GitHub.

Summary

storage_list calls observed in Crab Nebula devtools appear to get progressively slower with repeated calls. Investigation found the remote /api/invoke path had drifted from the embedded Tauri storage command and was not using the optimized message-list projection paths.

Expected behavior

Repeated storage_list calls for the same data shape should stay roughly stable, with cost scaling to the requested result shape rather than repeatedly materializing full message payloads when projected fields are requested.

Actual behavior

In the Crab Nebula devtools/runtime path, each storage_list call appeared slower than the previous one. The remote dispatcher duplicated older storage_list logic and could deserialize/materialize full message rows for chat message projections that the embedded command handles with narrower storage reads.

Steps to reproduce

  1. Run the app through the Crab Nebula/devtools or remote-runtime path.
  2. Trigger repeated storage_list calls, especially message-list calls with filters.chatId and projected fields.
  3. Watch call timings in devtools and compare later calls against earlier calls.

Impact area

  • App shell, navigation, startup, or providers
  • Catalog resources
  • Chat mode
  • Roleplay mode
  • Game mode
  • Shared mode UI
  • Runtime systems: generation, world-state, visuals, tracker, or haptics
  • Professor Mari or shell tools
  • React-free engine behavior, contracts, agents, or capability ports
  • Shared API wrapper or remote runtime routing
  • Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime
  • Docs, contributor workflow, or templates

Environment

  • Branch or commit: observed during local refactor-branch development; candidate fix currently on investigate-storage-list-growth
  • Run mode: Crab Nebula/devtools remote runtime path
  • OS + version: not captured
  • Node + pnpm versions: not relevant
  • Rust version, if relevant: not captured
  • Remote Runtime URL configured? yes, implied by devtools/runtime path
  • Provider, model, or integration, if relevant: not relevant

Logs, screenshots, or video

No screenshot attached yet. Local investigation found src-tauri/src/http_dispatch.rs handled storage_list separately from src-tauri/src/commands/storage/commands/entities.rs, missing the optimized message ID/projection paths used by embedded Tauri.

Regression notes

Unclear exact regression point. The remote dispatcher likely drifted after embedded storage_list gained faster message list projection handling.

Additional context

Candidate fix: make remote storage_list delegate to the shared storage command implementation so embedded Tauri and /api/invoke use the same optimized code path. Local targeted proof: cargo test --manifest-path src-tauri/Cargo.toml dispatch_storage_list_uses_projected_message_reads; lane check: cargo check --manifest-path src-tauri/Cargo.toml.

Template check

  • I DID NOT read this template and provide the requested details.
Originally created by @Promansis on GitHub (Jun 2, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1885 Originally assigned to: @Promansis on GitHub. ## Summary `storage_list` calls observed in Crab Nebula devtools appear to get progressively slower with repeated calls. Investigation found the remote `/api/invoke` path had drifted from the embedded Tauri storage command and was not using the optimized message-list projection paths. ## Expected behavior Repeated `storage_list` calls for the same data shape should stay roughly stable, with cost scaling to the requested result shape rather than repeatedly materializing full message payloads when projected fields are requested. ## Actual behavior In the Crab Nebula devtools/runtime path, each `storage_list` call appeared slower than the previous one. The remote dispatcher duplicated older `storage_list` logic and could deserialize/materialize full message rows for chat message projections that the embedded command handles with narrower storage reads. ## Steps to reproduce 1. Run the app through the Crab Nebula/devtools or remote-runtime path. 2. Trigger repeated `storage_list` calls, especially message-list calls with `filters.chatId` and projected fields. 3. Watch call timings in devtools and compare later calls against earlier calls. ## Impact area - [ ] App shell, navigation, startup, or providers - [ ] Catalog resources - [ ] Chat mode - [ ] Roleplay mode - [ ] Game mode - [ ] Shared mode UI - [ ] Runtime systems: generation, world-state, visuals, tracker, or haptics - [ ] Professor Mari or shell tools - [ ] React-free engine behavior, contracts, agents, or capability ports - [x] Shared API wrapper or remote runtime routing - [x] Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime - [ ] Docs, contributor workflow, or templates ## Environment - Branch or commit: observed during local refactor-branch development; candidate fix currently on `investigate-storage-list-growth` - Run mode: Crab Nebula/devtools remote runtime path - OS + version: not captured - Node + pnpm versions: not relevant - Rust version, if relevant: not captured - Remote Runtime URL configured? yes, implied by devtools/runtime path - Provider, model, or integration, if relevant: not relevant ## Logs, screenshots, or video No screenshot attached yet. Local investigation found `src-tauri/src/http_dispatch.rs` handled `storage_list` separately from `src-tauri/src/commands/storage/commands/entities.rs`, missing the optimized message ID/projection paths used by embedded Tauri. ## Regression notes Unclear exact regression point. The remote dispatcher likely drifted after embedded `storage_list` gained faster message list projection handling. ## Additional context Candidate fix: make remote `storage_list` delegate to the shared storage command implementation so embedded Tauri and `/api/invoke` use the same optimized code path. Local targeted proof: `cargo test --manifest-path src-tauri/Cargo.toml dispatch_storage_list_uses_projected_message_reads`; lane check: `cargo check --manifest-path src-tauri/Cargo.toml`. ## Template check - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:23:18 +07:00
Author
Owner

@Xelvanis commented on GitHub (Jun 2, 2026):

Additional storage comparison note, not a separate issue yet: #1890 appears to cover the remote storage_list dispatcher drift called out here. If repeated slowdown remains after that PR, the next root-cause check should compare the broader storage backend shape.

Legacy file-native storage loaded supported table snapshots into memory once, updated in-memory rows, then debounced/safety-flushed dirty tables. Refactor FileStorage usually reads/parses a collection file per operation and rewrites pretty JSON for most mutations. That broader per-operation file I/O pattern may still matter for hot selectors/timelines even after individual projected-read fast paths are fixed.

Useful follow-up proof would be a cold/warm timing harness around repeated storage_list/storage_get calls before deciding whether to add an in-memory cache, compact/index sidecar, or narrower collection-specific readers.

<!-- gh-comment-id:4599206134 --> @Xelvanis commented on GitHub (Jun 2, 2026): Additional storage comparison note, not a separate issue yet: #1890 appears to cover the remote `storage_list` dispatcher drift called out here. If repeated slowdown remains after that PR, the next root-cause check should compare the broader storage backend shape. Legacy file-native storage loaded supported table snapshots into memory once, updated in-memory rows, then debounced/safety-flushed dirty tables. Refactor `FileStorage` usually reads/parses a collection file per operation and rewrites pretty JSON for most mutations. That broader per-operation file I/O pattern may still matter for hot selectors/timelines even after individual projected-read fast paths are fixed. Useful follow-up proof would be a cold/warm timing harness around repeated `storage_list`/`storage_get` calls before deciding whether to add an in-memory cache, compact/index sidecar, or narrower collection-specific readers.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#911
No description provided.