[GH-ISSUE #2068] [Issue]: hostable remote runtime lacks legacy API rate limits #1014

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

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

Originally assigned to: @cha1latte on GitHub.

Summary

The hostable Rust Remote Runtime does not visibly preserve the legacy server's API rate-limit policy for hot or privileged HTTP paths.

Expected behavior

Hostable Remote Runtime API paths should have legacy-equivalent abuse throttling:

  • A default /api/* per-IP request limit.
  • Lower route-specific limits for hot or privileged paths where legacy had them.
  • 429 responses with retry metadata when a client exceeds the limit.

Actual behavior

Target 3 parityscan found no hostable Rust rate-limit source, 429 source, or Retry-After emitter for Remote Runtime API routes. The remote client can consume Retry-After if a server sends it, but this scan did not find a server-side source for that header in the refactor hostable runtime.

Legacy evidence:

  • packages/server/src/middleware/rate-limit.ts defined a default API rule of 600 requests/minute.
  • The same file defined route-specific limits for generation, TTS, connection image test, SillyTavern bulk import, backup, update apply, sidecar privileged routes, haptic commands, and extensions.
  • The legacy hook emitted RateLimit-Limit, RateLimit-Remaining, RateLimit-Reset, and Retry-After, and returned 429 after the limit.
  • packages/server/src/app.ts registered rateLimitHook for API requests.

Refactor evidence:

  • src-tauri/src/http_server.rs maps hostable routes and layers CORS plus security_middleware, but this scan found no rate-limit layer/source there.
  • src/shared/api/remote-runtime.ts parses Retry-After into retryAfterMs, but that only helps if the runtime sends retry metadata.

Steps to reproduce

  1. Run the hostable Remote Runtime from the refactor branch.
  2. Repeatedly call /api/invoke or a dedicated API route from the same client IP.
  3. Compare the behavior to legacy main API routes that returned 429 with Retry-After after configured route/default limits.

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: refactor / Target 3 rescan on 2026-06-04; refactor trace at 9bcfb164; legacy main trace at 77a30fa4
  • Run mode: remote runtime
  • OS + version: not captured
  • Node + pnpm versions: not relevant
  • Rust version, if relevant: not captured
  • Remote Runtime URL configured? yes
  • Provider, model, or integration, if relevant: hostable HTTP runtime

Logs, screenshots, or video

No live repeated-request repro attached. This is static parity evidence from Target 3.

Focused adjacent proof run:

cargo test --manifest-path src-tauri/Cargo.toml hostable_security_

Result: passed, 11 tests. This does not prove rate-limit behavior.

Regression notes

Legacy main had explicit API rate limits enabled by default and documented in docs/CONFIGURATION.md. Refactor Remote Runtime may still be safe behind external proxies, but the legacy-equivalent app-owned limit was not found.

Additional context

Split from Target 3 PERF/body/cache parity row:

Acceptance criteria:

  • Add an explicit hostable Remote Runtime API rate-limit policy, or document an intentional divergence.
  • Add focused proof that rate-limited API traffic returns 429 plus retry metadata where expected.
  • Preserve Retry-After parsing through the remote client error path.

Template check

Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @Promansis on GitHub (Jun 3, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2068 Originally assigned to: @cha1latte on GitHub. ## Summary The hostable Rust Remote Runtime does not visibly preserve the legacy server's API rate-limit policy for hot or privileged HTTP paths. ## Expected behavior Hostable Remote Runtime API paths should have legacy-equivalent abuse throttling: - A default `/api/*` per-IP request limit. - Lower route-specific limits for hot or privileged paths where legacy had them. - `429` responses with retry metadata when a client exceeds the limit. ## Actual behavior Target 3 parityscan found no hostable Rust rate-limit source, `429` source, or `Retry-After` emitter for Remote Runtime API routes. The remote client can consume `Retry-After` if a server sends it, but this scan did not find a server-side source for that header in the refactor hostable runtime. Legacy evidence: - `packages/server/src/middleware/rate-limit.ts` defined a default API rule of 600 requests/minute. - The same file defined route-specific limits for generation, TTS, connection image test, SillyTavern bulk import, backup, update apply, sidecar privileged routes, haptic commands, and extensions. - The legacy hook emitted `RateLimit-Limit`, `RateLimit-Remaining`, `RateLimit-Reset`, and `Retry-After`, and returned `429` after the limit. - `packages/server/src/app.ts` registered `rateLimitHook` for API requests. Refactor evidence: - `src-tauri/src/http_server.rs` maps hostable routes and layers CORS plus `security_middleware`, but this scan found no rate-limit layer/source there. - `src/shared/api/remote-runtime.ts` parses `Retry-After` into `retryAfterMs`, but that only helps if the runtime sends retry metadata. ## Steps to reproduce 1. Run the hostable Remote Runtime from the refactor branch. 2. Repeatedly call `/api/invoke` or a dedicated API route from the same client IP. 3. Compare the behavior to legacy `main` API routes that returned `429` with `Retry-After` after configured route/default limits. ## 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: `refactor` / Target 3 rescan on 2026-06-04; refactor trace at `9bcfb164`; legacy `main` trace at `77a30fa4` - Run mode: remote runtime - OS + version: not captured - Node + pnpm versions: not relevant - Rust version, if relevant: not captured - Remote Runtime URL configured? yes - Provider, model, or integration, if relevant: hostable HTTP runtime ## Logs, screenshots, or video No live repeated-request repro attached. This is static parity evidence from Target 3. Focused adjacent proof run: ```bash cargo test --manifest-path src-tauri/Cargo.toml hostable_security_ ``` Result: passed, 11 tests. This does not prove rate-limit behavior. ## Regression notes Legacy `main` had explicit API rate limits enabled by default and documented in `docs/CONFIGURATION.md`. Refactor Remote Runtime may still be safe behind external proxies, but the legacy-equivalent app-owned limit was not found. ## Additional context Split from Target 3 PERF/body/cache parity row: - Target detail: #2050 - Umbrella issue: #2059 - Parity index: #1904 Acceptance criteria: - Add an explicit hostable Remote Runtime API rate-limit policy, or document an intentional divergence. - Add focused proof that rate-limited API traffic returns `429` plus retry metadata where expected. - Preserve `Retry-After` parsing through the remote client error path. ## Template check Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:25:10 +07:00
Author
Owner

@cha1latte commented on GitHub (Jun 3, 2026):

Fixed in #2073

<!-- gh-comment-id:4616067193 --> @cha1latte commented on GitHub (Jun 3, 2026): Fixed in #2073
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#1014
No description provided.