[GH-ISSUE #7661] [Issue]: Profile export blanks agents' Max Output Tokens (maxTokens matches the credential redaction) #4237

Closed
opened 2026-10-21 06:13:11 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @stonebystone on GitHub (Oct 14, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/7661

Originally assigned to: @SpicyMarinara on GitHub.

Summary

Profile export blanks every agent's Max Output Tokens (settings.maxTokens). redactAgentSecrets in packages/server/src/routes/backup.routes.ts treats any agent setting whose key matches /token|secret|password|api[_-]?key/i as a credential and sets it to null, and maxTokens matches on "token".

Expected behavior

A profile export keeps non-credential agent settings, including each agent's Max Output Tokens, so restoring the profile brings those limits back.

Actual behavior

The exported agent_configs rows have maxTokens: null. Importing that profile on a fresh install writes the null, and normalizeAgentMaxTokens then falls back to DEFAULT_AGENT_MAX_TOKENS, so every agent quietly returns to the default output limit. (When the agent row already exists, import skips the settings column, so the existing value survives.)

Steps to reproduce

  1. In Agents, open any agent and set Max Output Tokens to a non-default value (e.g. 2048). Save.
  2. Export the profile as a native ZIP (Settings → profile export, or GET /api/backup/export-profile?format=zip).
  3. Open profile-tables/agent_configs.jsonl in the ZIP and find that agent's row: settings.maxTokens is null.
  4. Import the ZIP on a fresh install: the agent's Max Output Tokens is back to the default.

Environment

  • Marinara Engine version: v2.5.0, staging at 5c07e57f5
  • Install type: source
  • OS + version: Windows 11
  • Browser or app shell: n/a (server-side export)

Logs, screenshots, or video

Found while testing #7657 against a profile export: the Agent Editor showed 4096 for the Narrative Director, and the exported row had maxTokens: null.

Additional context

The same over-broad match also caught the secretPlot* Narrative Director settings (secretPlotEnabled, secretPlotRunInterval). #7657 exempts those three settings by name (secretPlotEnabled, secretPlotRunInterval, secretPlotPromptTemplate), but maxTokens is still affected. A likely fix is matching credential-style names more narrowly (e.g. /(^|[a-z])(api[_-]?key|token)$/i-style endings, or an explicit allowlist of non-secret keys such as maxTokens), so real tokens stay redacted.

cc @SpicyMarinara

Template check

Please uncheck (untick) 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 @stonebystone on GitHub (Oct 14, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/7661 Originally assigned to: @SpicyMarinara on GitHub. ## Summary Profile export blanks every agent's **Max Output Tokens** (`settings.maxTokens`). `redactAgentSecrets` in `packages/server/src/routes/backup.routes.ts` treats any agent setting whose key matches `/token|secret|password|api[_-]?key/i` as a credential and sets it to `null`, and `maxTokens` matches on "token". ## Expected behavior A profile export keeps non-credential agent settings, including each agent's Max Output Tokens, so restoring the profile brings those limits back. ## Actual behavior The exported `agent_configs` rows have `maxTokens: null`. Importing that profile on a fresh install writes the null, and `normalizeAgentMaxTokens` then falls back to `DEFAULT_AGENT_MAX_TOKENS`, so every agent quietly returns to the default output limit. (When the agent row already exists, import skips the settings column, so the existing value survives.) ## Steps to reproduce 1. In Agents, open any agent and set **Max Output Tokens** to a non-default value (e.g. 2048). Save. 2. Export the profile as a native ZIP (Settings → profile export, or `GET /api/backup/export-profile?format=zip`). 3. Open `profile-tables/agent_configs.jsonl` in the ZIP and find that agent's row: `settings.maxTokens` is `null`. 4. Import the ZIP on a fresh install: the agent's Max Output Tokens is back to the default. ## Environment - Marinara Engine version: v2.5.0, `staging` at 5c07e57f5 - Install type: source - OS + version: Windows 11 - Browser or app shell: n/a (server-side export) ## Logs, screenshots, or video Found while testing #7657 against a profile export: the Agent Editor showed 4096 for the Narrative Director, and the exported row had `maxTokens: null`. ## Additional context The same over-broad match also caught the `secretPlot*` Narrative Director settings (`secretPlotEnabled`, `secretPlotRunInterval`). #7657 exempts those three settings by name (`secretPlotEnabled`, `secretPlotRunInterval`, `secretPlotPromptTemplate`), but `maxTokens` is still affected. A likely fix is matching credential-style names more narrowly (e.g. `/(^|[a-z])(api[_-]?key|token)$/i`-style endings, or an explicit allowlist of non-secret keys such as `maxTokens`), so real tokens stay redacted. cc @SpicyMarinara ## Template check Please **uncheck (untick)** 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 06:13:12 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (Oct 16, 2026):

Working on this in #7727.

<!-- gh-comment-id:6212229493 --> @SpicyMarinara commented on GitHub (Oct 16, 2026): Working on this in #7727.
Author
Owner

@SpicyMarinara commented on GitHub (Oct 16, 2026):

Fixed on staging by #7727. Thank you for the precise report, @stonebystone!

<!-- gh-comment-id:6212889634 --> @SpicyMarinara commented on GitHub (Oct 16, 2026): Fixed on staging by #7727. Thank you for the precise report, @stonebystone!
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#4237
No description provided.