Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

address review (codex): key reassignment run ownership/filtering on full (universeId, entryId)

[._.]/ Adam Eivy5bdf79aef6d1
diff --git a/client/src/components/loraTraining/TrainingPanel.jsx b/client/src/components/loraTraining/TrainingPanel.jsx
index 92c874ecb8..37ad6694b9 100644
--- a/client/src/components/loraTraining/TrainingPanel.jsx
+++ b/client/src/components/loraTraining/TrainingPanel.jsx
@@ -55,15 +55,15 @@ export default function TrainingPanel({ dataset, readiness, triggerSaving, onRun
const charEntryId = dataset.character?.entryId;
const charUniverseId = dataset.character?.universeId;
const refreshRuns = useCallback(() => {
- // Filter by the current character on the SERVER (characterId = the
- // globally-unique entryId), so the row limit applies to this character's
- // runs — not to other-character runs left over on the same dataset id after
- // a reassignment (which a client-side filter-after-limit would drop). The
- // client-side guard below is belt-and-suspenders for any run missing its
- // character snapshot.
+ // Filter by the current character on the SERVER (characterId = entryId) so
+ // the row limit applies to this character's runs — not to other-character
+ // runs left over on the same dataset id after a reassignment (which a
+ // client-side filter-after-limit would drop). The client guard then matches
+ // the full (universeId, entryId) key the dataset store uses, and tolerates
+ // a run missing its character snapshot.
listLoraTrainingRuns({ datasetId: dataset.id, characterId: charEntryId, limit: 5 }).then((runs) => {
const own = (Array.isArray(runs) ? runs : []).filter(
- (r) => !r.character || r.character.entryId === charEntryId,
+ (r) => !r.character || (r.character.entryId === charEntryId && r.character.universeId === charUniverseId),
);
setActiveRun(own.find(isActive) || null);
setLastRun(own.find((r) => !isActive(r)) || null);
diff --git a/server/services/loraTraining/index.js b/server/services/loraTraining/index.js
index 9b69a69181..8eb58410ed 100644
--- a/server/services/loraTraining/index.js
+++ b/server/services/loraTraining/index.js
@@ -261,8 +261,9 @@ export async function runTraining({ jobId, runId, pythonPath = null }) {
// rather than training the moved dataset and registering a LoRA under the
// run's now-stale character. failBeforeSpawn's flipDatasetAfterRun is
// character-guarded, so it won't disturb the reassigned dataset's state.
- // (entryId is a globally-unique UUID, so it alone identifies the character.)
- if (dataset.character?.entryId !== run.character.entryId) {
+ // Match the full (universeId, entryId) key the dataset store uses elsewhere.
+ if (dataset.character?.entryId !== run.character.entryId
+ || dataset.character?.universeId !== run.character.universeId) {
return failBeforeSpawn('Dataset was reassigned to a different character after this run was queued — cancel and retrain.');
}