[PR #7727] [MERGED] fix(backup): keep agents' Max Output Tokens in profile exports #7899

Closed
opened 2026-10-24 04:08:39 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7727
Author: @SpicyMarinara
Created: 10/16/2026
Status: ✅ Merged
Merged: 10/16/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/7661-profile-export-maxtokens


📝 Commits (1)

  • 0c2efa7 fix(backup): keep agents' Max Output Tokens in profile exports

📊 Changes

2 files changed (+71 additions, -6 deletions)

View changed files

📝 packages/server/src/routes/backup.routes.ts (+10 -6)
➕ scripts/regressions/profile-export-agent-settings.regression.ts (+61 -0)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #7661

Why this change

  • A profile export set every agent's Max Output Tokens (settings.maxTokens) to null. The export treated any agent setting whose name merely contained "token", "secret", "password" or "apiKey" as a credential, and maxTokens contains "token". Restoring that profile on a fresh install put every agent back on the default output limit without any warning.
  • The same broad match also blanked other token-count settings (maxContextTokens, summaryBudgetTokens, package settings like existingNoteTokenBudget), and it had already needed a name-by-name exemption for the Secret Plot settings (#7657).

What changed

  • redactAgentSecrets (profile export, both native and compatible) now treats a setting as a credential only when its name ends in a credential word, optionally stored Encrypted: token, spotifyAccessToken, spotifyRefreshToken, youtubeApiKey, apiKey/api_key, clientSecret, secret(s), password(s), passphrase, credential(s), bearer, privateKey/accessKey/secretKey, accessTokens/refreshTokens, apiKeyEncrypted. Nested settings are still checked the same way.
  • Token counts end in plural "Tokens" or put "Token" first (maxTokens, maxOutputTokens, existingNoteTokenBudget), so they export again. Secret Plot settings only start with "secret", so the three-name exemption from #7657 is gone. A credential-style name under that prefix (secretPlotToken) is still blanked.
  • New regression scripts/regressions/profile-export-agent-settings.regression.ts runs an agent row through sanitizeProfileTableRows("agent_configs", …). It checks that 10 non-credential settings survive, 13 credential names are blanked, nested settings follow the same rule, and no credential value reaches the export. On unfixed staging it fails with maxTokens ... null !== 2048.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Agent-run checks (not a substitute for the boxes above):

  • npx tsc --noEmit for shared, server, client and root
  • prettier --check on both changed files
  • Regressions: profile-export-agent-settings (new; fails before the fix, passes after), bulk-export-zips, nanogpt-credentials, connection-model-list, profile-import-data-security, profile-import-asset-security

Manual verification notes

  • Manually verify: in Agents, set an agent's Max Output Tokens to a non-default value (e.g. 2048), export the profile as a native ZIP, and check that profile-tables/agent_configs.jsonl keeps settings.maxTokens: 2048.
  • Manually verify: import that ZIP on a fresh install and confirm the agent's Max Output Tokens shows 2048.
  • Manually verify: with Spotify connected or a YouTube API key saved on the Music DJ agent, the exported row still has spotifyAccessToken, spotifyRefreshToken and youtubeApiKey set to null.
  • Manually verify: the Narrative Director's Secret Plot toggle, interval and prompt still survive an export/import round trip.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

No docs, UI copy, version or changelog changes.

UI evidence (if applicable)

Not applicable (server-side export only).


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/7727 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/16/2026 **Status:** ✅ Merged **Merged:** 10/16/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/7661-profile-export-maxtokens` --- ### 📝 Commits (1) - [`0c2efa7`](https://github.com/Pasta-Devs/Marinara-Engine/commit/0c2efa79120f4e529f295b543d9ad998b9ef4409) fix(backup): keep agents' Max Output Tokens in profile exports ### 📊 Changes **2 files changed** (+71 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/src/routes/backup.routes.ts` (+10 -6) ➕ `scripts/regressions/profile-export-agent-settings.regression.ts` (+61 -0) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue Closes #7661 ## Why this change - A profile export set every agent's **Max Output Tokens** (`settings.maxTokens`) to `null`. The export treated any agent setting whose name merely *contained* "token", "secret", "password" or "apiKey" as a credential, and `maxTokens` contains "token". Restoring that profile on a fresh install put every agent back on the default output limit without any warning. - The same broad match also blanked other token-count settings (`maxContextTokens`, `summaryBudgetTokens`, package settings like `existingNoteTokenBudget`), and it had already needed a name-by-name exemption for the Secret Plot settings (#7657). ## What changed - `redactAgentSecrets` (profile export, both native and compatible) now treats a setting as a credential only when its name **ends** in a credential word, optionally stored `Encrypted`: `token`, `spotifyAccessToken`, `spotifyRefreshToken`, `youtubeApiKey`, `apiKey`/`api_key`, `clientSecret`, `secret(s)`, `password(s)`, `passphrase`, `credential(s)`, `bearer`, `privateKey`/`accessKey`/`secretKey`, `accessTokens`/`refreshTokens`, `apiKeyEncrypted`. Nested settings are still checked the same way. - Token counts end in plural "Tokens" or put "Token" first (`maxTokens`, `maxOutputTokens`, `existingNoteTokenBudget`), so they export again. Secret Plot settings only start with "secret", so the three-name exemption from #7657 is gone. A credential-style name under that prefix (`secretPlotToken`) is still blanked. - New regression `scripts/regressions/profile-export-agent-settings.regression.ts` runs an agent row through `sanitizeProfileTableRows("agent_configs", …)`. It checks that 10 non-credential settings survive, 13 credential names are blanked, nested settings follow the same rule, and no credential value reaches the export. On unfixed `staging` it fails with `maxTokens ... null !== 2048`. ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` Agent-run checks (not a substitute for the boxes above): - `npx tsc --noEmit` for shared, server, client and root - `prettier --check` on both changed files - Regressions: `profile-export-agent-settings` (new; fails before the fix, passes after), `bulk-export-zips`, `nanogpt-credentials`, `connection-model-list`, `profile-import-data-security`, `profile-import-asset-security` ### Manual verification notes - Manually verify: in Agents, set an agent's **Max Output Tokens** to a non-default value (e.g. 2048), export the profile as a native ZIP, and check that `profile-tables/agent_configs.jsonl` keeps `settings.maxTokens: 2048`. - Manually verify: import that ZIP on a fresh install and confirm the agent's Max Output Tokens shows 2048. - Manually verify: with Spotify connected or a YouTube API key saved on the Music DJ agent, the exported row still has `spotifyAccessToken`, `spotifyRefreshToken` and `youtubeApiKey` set to `null`. - Manually verify: the Narrative Director's Secret Plot toggle, interval and prompt still survive an export/import round trip. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) No docs, UI copy, version or changelog changes. ## UI evidence (if applicable) Not applicable (server-side export only). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-24 04:08:39 +07:00
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#7899
No description provided.