mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #3670] [Issue]: capability migration is marked complete before chat selections persist #1981
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#1981
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 @Xelvanis on GitHub (Jul 16, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3670
Originally assigned to: @SpicyMarinara on GitHub.
Summary
The v2.3 legacy capability migration writes
availability-migration-v1.jsonbefore migrating per-chat capability selections. That marker is also the gate that decides whether the chat migration runs. If the process exits or the chat migration fails after the marker is written, the next startup treats migration as complete and permanently skips the unfinished chat work.This can leave legacy packages installed globally while older chats are missing their expected Maps, Calls, or Conversation-game selections.
Expected behavior
The migration should be restart-safe and idempotent:
After a failure at any earlier step, the next startup should retry or resume safely.
Actual behavior
migrateLegacyAvailability()installs packages and then writes the marker withwriteFile()plusrename()before returningmigrated: true.Only after that function returns does
app.tscallmigrateLegacyChatCapabilitySelections(db). On a later startup, the marker makesmigrateLegacyAvailability()returnmigrated: false, andapp.tstherefore does not call the chat migration again.The persistence ordering creates an additional failure window:
patchMetadata()updates the in-memory file-native store, while the table write is debounced for 750 ms. There is noflushDB()before migration completion. A hard exit can therefore leave the marker on disk while all or part of the chat migration remains only in memory.The chat migration call is also outside the package-migration
try/catch, so a thrown chat patch aborts startup after the marker has already been written.Steps to reproduce
capability-packages/availability-migration-v1.jsonif reproducing against a disposable copy.writeAvailabilityMigration("legacy")completes but before the chat migration is durably flushed, terminate the process abruptly. For deterministic fault injection, throw or exit immediately beforemigrateLegacyChatCapabilitySelections(db), or from the firstpatchMetadata()call.availability-migration-v1.jsonexists, somigrateLegacyAvailability()returnsmigrated: false.app.tsskipsmigrateLegacyChatCapabilitySelections(db)and the affected chats retain unmigratedactiveAgentIds.Environment
stagingat77f9f2a61e3647cad9f41399430648a00a735210)Logs, screenshots, or video
No specific error is required; an abrupt process exit is sufficient.
Relevant ordering:
package-manager.service.ts: marker gate and marker writeapp.ts: chat migration runs only whenmigration.migratedis truelegacy-capability-chat-migration.ts: sequential per-chat patchesfile-backed-store.ts: 750 ms debounced persistenceAdditional context
The package architecture contract in
docs/development/optional-agent-packages.mdsays migration is idempotent and records completion only after all legacy availability entries are durable. Issue #3612 also explicitly requires interrupted-download and upgrade-retention proof.Suggested correction:
flushDB()and fail if persistence did not complete.A separate package-stage marker could be retained for avoiding re-downloads, but it must not suppress unfinished chat migration.
Temporary recovery for an already affected installation is to back up the data directory, remove
capability-packages/availability-migration-v1.json, and restart while the official catalog is reachable. The installed-package checks should avoid unnecessary reinstallation, and the chat migration is designed to be idempotent.Related: #3669 covers the separate problem where the chat migration forces
enableAgents: true. This issue concerns completion ordering and retry durability even after that behavior is corrected.Template check
@SpicyMarinara commented on GitHub (Jul 16, 2026):
Resolved in #3678: the legacy capability migration now flushes per-chat selections before writing its completion marker, so interrupted work retries safely. Migration regressions and the full validation suite pass.