[GH-ISSUE #1468] [Issue]: Professor Mari requests can exceed token limits from large context #727

Closed
opened 2026-10-20 17:32:26 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @cha1latte on GitHub (May 28, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1468

Originally assigned to: @cha1latte on GitHub.

Summary

Professor Mari can run into token generation problems because some requests appear to include far too many tokens. The reporter suspects base64 or non-decompiled content may be getting loaded into the prompt/context.

Expected behavior

Professor Mari should keep request context within usable token limits and avoid including large raw/base64/generated content when answering codebase questions.

Actual behavior

Professor Mari runs into token generation problems on many requests due to excessive token usage.

Steps to reproduce

  1. Run the app on the latest refactor version with pnpm tauri dev.
  2. Open Professor Mari.
  3. Ask codebase questions that trigger repository/tool context loading.
  4. Observe token generation failures or excessive token usage on multiple requests.

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: latest refactor version
  • Run mode: Tauri desktop via pnpm tauri dev
  • OS + version: Windows 11
  • Node + pnpm versions: Not specified
  • Rust version, if relevant: Not specified
  • Remote Runtime URL configured? Not specified
  • Provider, model, or integration, if relevant: Not specified

Hardware reported: x86 laptop with NVIDIA GPU and Intel i7.

Logs, screenshots, or video

Not provided. Reported during manual Normal User First Pass by Muni.

Regression notes

Not specified.

Additional context

Source: Discord manual smoke-test report from MuniMuni during the Normal User First Pass.

Reporter note: likely cause may be loading base64 or failing to decompile/exclude large generated content properly.

Reporter also noted a fix is reportedly being worked on in merge/prof-mari.

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 @cha1latte on GitHub (May 28, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1468 Originally assigned to: @cha1latte on GitHub. ## Summary Professor Mari can run into token generation problems because some requests appear to include far too many tokens. The reporter suspects base64 or non-decompiled content may be getting loaded into the prompt/context. ## Expected behavior Professor Mari should keep request context within usable token limits and avoid including large raw/base64/generated content when answering codebase questions. ## Actual behavior Professor Mari runs into token generation problems on many requests due to excessive token usage. ## Steps to reproduce 1. Run the app on the latest `refactor` version with `pnpm tauri dev`. 2. Open Professor Mari. 3. Ask codebase questions that trigger repository/tool context loading. 4. Observe token generation failures or excessive token usage on multiple requests. ## Impact area - [ ] App shell, navigation, startup, or providers - [ ] Catalog resources - [ ] Chat mode - [ ] Roleplay mode - [ ] Game mode - [ ] Shared mode UI - [x] Runtime systems: generation, world-state, visuals, tracker, or haptics - [x] Professor Mari or shell tools - [x] React-free engine behavior, contracts, agents, or capability ports - [ ] 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: latest `refactor` version - Run mode: Tauri desktop via `pnpm tauri dev` - OS + version: Windows 11 - Node + pnpm versions: Not specified - Rust version, if relevant: Not specified - Remote Runtime URL configured? Not specified - Provider, model, or integration, if relevant: Not specified Hardware reported: x86 laptop with NVIDIA GPU and Intel i7. ## Logs, screenshots, or video Not provided. Reported during manual Normal User First Pass by Muni. ## Regression notes Not specified. ## Additional context Source: Discord manual smoke-test report from MuniMuni during the Normal User First Pass. Reporter note: likely cause may be loading base64 or failing to decompile/exclude large generated content properly. Reporter also noted a fix is reportedly being worked on in `merge/prof-mari`. ## 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-20 17:32:26 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@cha1latte commented on GitHub (May 28, 2026):

Fixed in #1471.

The issue was that Professor Mari had unbounded context ingress from multiple paths: attachments could be injected into the task prompt verbatim, including raw image/base64 data, and code-search/read tooling could include generated output or encoded/binary-like source content. That meant large screenshots, generated artifacts, or wrapped encoded blobs could push Mari requests past provider token limits before the model ever saw the task.

The fix was architectural, not just a UI size patch. The Rust Professor Mari command/tool boundary now enforces the context contract: attachment count, metadata, per-attachment text, and total attachment text are bounded; image/binary-like attachments are represented without raw payloads; generated/cache directories such as graphify-out are skipped; encoded/binary-like source content is rejected; and wrapped base64-style payloads have a regression test. The UI also avoids sending raw image data and caps text reads, but that is defense-in-depth rather than the trusted enforcement point.

Verification included targeted Professor Mari Rust tests, full Rust workspace tests, clippy with warnings denied, pnpm check, pnpm build, Graphify refresh, proof gate, GitHub CI, and review-thread cleanup.

<!-- gh-comment-id:4567216099 --> @cha1latte commented on GitHub (May 28, 2026): Fixed in #1471. The issue was that Professor Mari had unbounded context ingress from multiple paths: attachments could be injected into the task prompt verbatim, including raw image/base64 data, and code-search/read tooling could include generated output or encoded/binary-like source content. That meant large screenshots, generated artifacts, or wrapped encoded blobs could push Mari requests past provider token limits before the model ever saw the task. The fix was architectural, not just a UI size patch. The Rust Professor Mari command/tool boundary now enforces the context contract: attachment count, metadata, per-attachment text, and total attachment text are bounded; image/binary-like attachments are represented without raw payloads; generated/cache directories such as graphify-out are skipped; encoded/binary-like source content is rejected; and wrapped base64-style payloads have a regression test. The UI also avoids sending raw image data and caps text reads, but that is defense-in-depth rather than the trusted enforcement point. Verification included targeted Professor Mari Rust tests, full Rust workspace tests, clippy with warnings denied, pnpm check, pnpm build, Graphify refresh, proof gate, GitHub CI, and review-thread cleanup.
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#727
No description provided.