mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #4767] [Feature]: Make workspace assistant output limits configurable and adequate for power-user workflows #2624
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#2624
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @xDanteMD on GitHub (Aug 8, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/4767
Originally assigned to: @kolacheee on GitHub.
What problem does this solve?
The workspace assistant (Professor Mari on the Home screen) has hardcoded output limits tuned for casual usage that silently break for power users with large collections or complex tasks. The primary culprit is
COMMAND_OUTPUT_LIMIT = 32,000characters (~8K tokens), which truncatesapp_datacommand output mid-field without warning.The 32K output limit is 0.8% of a 1M context window. The model has 1,000,000 tokens of context available, but the application limits tool output to ~8,000 tokens. The remaining 992,000 tokens are unused.
Affected limits
COMMAND_OUTPUT_LIMITworkspace-agent.service.ts:157workspace-agent.service.tsmari dbfallback for raw DB access on Windows — users have no workaround when structured tools hit limitsReproduction: character cards with large data
A character with 20 alternate greetings (~750 tokens each, ~3,000 characters each) produces a JSON output of ~60,000+ characters. The
compactOutputfunction (workspace-agent.service.ts:692-694) slices it at 32,000 characters:Steps to reproduce:
app_data character.getwith the character's IDThe
character.gethandler (mari-db.service.ts:1762-1766) returns the full parsed row including all fields. TheexecuteActiondispatcher (mari-db.service.ts:1696-1727) routes toexecuteCharacterAction(mari-db.service.ts:1729-1931), which callsparseRow(mari-db.service.ts:411-418) to reconstruct the full card. The truncation happens in the output formatting layer, not in data retrieval. The workspace assistant's structured tool protocol (app_data) correctly returns the full data — the issue is purely in the output size limit.Real-world failure mode
app_data character.getThe LLM's own diagnosis (from a live session): "Root cause: the read cap (32k chars) hit before the alternate_greetings array finished."
Impact
mari db(raw DB fallback) is unavailable. Users have no fallback when the structured tools hit limitsapp_dataactions, not justcharacter.get. Lorebook entries, preset sections, and other large entities hit the same truncationProposed solution
Option A: Per-action limits (recommended starting point)
Read operations (
character.get,lorebook.get,preset.get) use a higher limit (e.g., 100,000 characters or no limit). Write operations keep the current limit. This matches the principle that reads are cheap and writes need verification. The data is already in memory — there's no performance cost to returning it. This directly addresses the truncation bug without changing the safety net for writes.Option B: Dynamic limits based on context window (recommended long-term)
Scale
COMMAND_OUTPUT_LIMITbased on the connection'smaxContext:This automatically adapts to the user's model capabilities. Prior art: the
maxContextvalue is already available on the connection object and used byfitMessagesToContext()(base-provider.ts).Option C: User-configurable settings
Add a "Workspace Limits" section to Settings > Advanced:
COMMAND_OUTPUT_LIMIT(default: 32,000, recommended: 100,000+)Option D: Field-aware truncation (complementary)
Instead of slicing at a character boundary, truncate after complete JSON fields. This prevents broken JSON but still loses data. Best combined with A, B, or C — it's a defensive improvement that reduces damage from truncation rather than preventing it.
Recommended: Option A + B combined. Per-action limits for immediate relief, with dynamic scaling as the long-term solution.
Alternatives considered
character.get, return a summary object (name, description, tags) plus the full data. The model can request specific fields if needed. Complementary to raising the limit but adds API complexity.Related issues
app_dataentities. The fix in #4673 addressed lorebook-specific handling; this issue requests a systemic fix for the underlyingCOMMAND_OUTPUT_LIMIT.maxContext) — themaxContextplumbing has had reliability issues, which is worth considering when building dynamic scaling on top of it.success: trueeven on failure. Same class of problem — silent truncation with no structured error reporting. The workspace assistant'scompactOutputtruncation is a specific instance of this broader pattern.Additional context
commandAppDatafunction (workspace-agent.service.ts:2722-2745) is the entry point for allapp_datacommands. The limit is applied after the command returns, meaning the data is fully fetched before being sliced.mari db(raw DB fallback) is unavailable. Users have no workaround when the structured tools hit limits.Research undertaken: codebase analysis of
workspace-agent.service.ts(COMMAND_OUTPUT_LIMIT at line 157, compactOutput at lines 692-694, commandAppData at lines 2722-2745),mari-db.service.ts(executeAction at lines 1696-1727, executeCharacterAction at lines 1729-1931, character.get handler at lines 1762-1766, parseRow at lines 411-418). Real-world testing with a character card containing 20 alternate greetings (~60K characters). LLM's own diagnosis confirmed the 32K read cap as root cause. Traced the full data flow: commandAppData → executeAction → executeCharacterAction → parseRow → full data returned → compactOutput truncates at 32K. The truncation is purely in the output formatting layer — the data retrieval is correct. Repo-wide search for related issues: #4673 (truncated lorebook entries, same root cause), #3864 (remove hidden hard constraints, same philosophy), #2857/#2858 (500-char output limit, precedent fix), #4390 (unverified done, compounding failure), #2288 (useMaxContext not honored, maxContext plumbing issues), #2687 (silent agent output corruption, same pattern). Prior research documented in github-issues/README.md (workspace-agent analysis across lines 220-600, 1200-1260, 1499-1590, 1846-2060; mari-db.service analysis for executeAction and character action handlers).