[GH-ISSUE #2172] [Issue]: Persona duplicate preserves active state #1082

Closed
opened 2026-10-21 05:26:27 +07:00 by bsakaguchi · 0 comments
Owner

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

Originally assigned to: @Promansis on GitHub.

Summary

Duplicating the active persona on the refactor branch can preserve the source persona's active flags, leaving more than one persona marked active.

Expected behavior

Duplicating a persona should create an inactive copy. Legacy main forced duplicated personas to isActive: "false", so the existing active persona stayed the only active persona until the user explicitly activated another one.

Actual behavior

The refactor duplicate path uses generic storage_duplicate for personas. That path removes the id and copies the rest of the row, so an active source persona can produce a duplicate with isActive and/or active still truthy. The explicit persona activation command enforces uniqueness, but duplicate bypasses that invariant.

Steps to reproduce

  1. On refactor, create or select a persona and activate it.
  2. Duplicate that active persona from the personas panel.
  3. Inspect the stored personas rows or reload the persona selector.
  4. Observe that both the original and duplicate can be marked active.

Impact area

  • 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 static trace at 7d4f39f4; legacy reference main at 77a30fa4
  • Run mode: Tauri desktop / remote runtime storage command path
  • OS + version: not run-time specific
  • Node + pnpm versions: not relevant
  • Rust version, if relevant: not checked
  • Remote Runtime URL configured? not relevant
  • Provider, model, or integration, if relevant: not relevant

Logs, screenshots, or video

Static evidence:

  • Current duplicate wrapper: src/shared/api/storage-commands-api.ts calls storage_duplicate.
  • Current entity duplicate routing: src-tauri/src/commands/storage/commands/entities.rs only special-cases characters, prompts, chat presets, connections, and messages; personas fall through to generic duplicate.
  • Current generic duplicate: src-tauri/src/commands/storage/shared.rs removes id and appends Copy to name, but does not clear isActive or active.
  • Current activation path: src-tauri/src/commands/storage/personas.rs patches every persona to exactly one active row, proving uniqueness is still an expected invariant.
  • Legacy behavior: main:packages/server/src/services/storage/characters.storage.ts duplicatePersona inserted the copy with isActive: "false".

Regression notes

Worked on legacy main: duplicated personas were always inactive. The refactor storage command is broader and currently misses the persona-specific active-state reset.

Additional context

Found during the Contracts + Storage Base parityscan slice for crud-active-duplicate. Likely fix: special-case personas in duplicate_entity or a persona-owned duplicate helper, clearing both isActive and active on the copy before create. Add focused storage proof for duplicating active and inactive personas.

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 4, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2172 Originally assigned to: @Promansis on GitHub. ## Summary Duplicating the active persona on the refactor branch can preserve the source persona's active flags, leaving more than one persona marked active. ## Expected behavior Duplicating a persona should create an inactive copy. Legacy `main` forced duplicated personas to `isActive: "false"`, so the existing active persona stayed the only active persona until the user explicitly activated another one. ## Actual behavior The refactor duplicate path uses generic `storage_duplicate` for `personas`. That path removes the `id` and copies the rest of the row, so an active source persona can produce a duplicate with `isActive` and/or `active` still truthy. The explicit persona activation command enforces uniqueness, but duplicate bypasses that invariant. ## Steps to reproduce 1. On `refactor`, create or select a persona and activate it. 2. Duplicate that active persona from the personas panel. 3. Inspect the stored `personas` rows or reload the persona selector. 4. Observe that both the original and duplicate can be marked active. ## Impact area - [x] 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` static trace at `7d4f39f4`; legacy reference `main` at `77a30fa4` - Run mode: Tauri desktop / remote runtime storage command path - OS + version: not run-time specific - Node + pnpm versions: not relevant - Rust version, if relevant: not checked - Remote Runtime URL configured? not relevant - Provider, model, or integration, if relevant: not relevant ## Logs, screenshots, or video Static evidence: - Current duplicate wrapper: `src/shared/api/storage-commands-api.ts` calls `storage_duplicate`. - Current entity duplicate routing: `src-tauri/src/commands/storage/commands/entities.rs` only special-cases characters, prompts, chat presets, connections, and messages; `personas` fall through to generic duplicate. - Current generic duplicate: `src-tauri/src/commands/storage/shared.rs` removes `id` and appends ` Copy` to `name`, but does not clear `isActive` or `active`. - Current activation path: `src-tauri/src/commands/storage/personas.rs` patches every persona to exactly one active row, proving uniqueness is still an expected invariant. - Legacy behavior: `main:packages/server/src/services/storage/characters.storage.ts` `duplicatePersona` inserted the copy with `isActive: "false"`. ## Regression notes Worked on legacy `main`: duplicated personas were always inactive. The refactor storage command is broader and currently misses the persona-specific active-state reset. ## Additional context Found during the Contracts + Storage Base parityscan slice for `crud-active-duplicate`. Likely fix: special-case `personas` in `duplicate_entity` or a persona-owned duplicate helper, clearing both `isActive` and `active` on the copy before create. Add focused storage proof for duplicating active and inactive personas. ## 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:26:27 +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#1082
No description provided.