Skip to content

[bug] Entity Loom update commits fail after finalized chats.db strips platform column #16

Description

@lyrishark

Issue Draft: Entity Loom cannot commit updates after finalization strips platform column

Repository: PsycherosAI/Psycheros

Suggested title:

[bug] Entity Loom update commits fail after finalized chats.db strips platform column

What package is affected?

  • packages/psycheros (the harness daemon)
  • packages/entity-core (MCP identity/memory server)
  • packages/entity-loom (import wizard)
  • packages/launcher (installer/dashboard)
  • Cross-cutting / unclear

What happened?

After a package has been finalized, Entity Loom strips the platform column from
chats.db for Psycheros compatibility. If the user later resumes that package
and commits an updated thread reimport through staging, commit can fail with:

table conversations has no column named platform

Observed with a finalized Windows package whose conversations table had only:

id, title, created_at, updated_at

The updated thread export parsed correctly and staged correctly, but commit
failed when writing to chats.db.

What did you expect?

Entity Loom should support both conversation table shapes:

  • Active/importing schema with platform
  • Finalized Psycheros-compatible schema without platform

Committing a changed same-ID reimport into a finalized package should update the
conversation row and replace its messages without requiring a package rebuild.

Likely cause

packages/entity-loom/src/writers/db-writer.ts assumes conversations.platform
exists when writing conversations:

INSERT INTO conversations (id, title, created_at, updated_at, platform)

That is not true after stripPlatformColumn() has finalized a package.

There are two related schema assumptions:

  • getConversationPlatform() queries SELECT platform ... even when the
    column has already been stripped.
  • stripPlatformColumn() can be called on an already-stripped database and
    should no-op cleanly.

Proposed solution

Make DBWriter detect the current conversations schema before platform-aware
operations:

  1. Add a small hasConversationColumn(name) helper using
    PRAGMA table_info(conversations).
  2. In writeConversation(), use the existing platform-aware upsert only when
    platform exists.
  3. Otherwise, upsert only id, title, created_at, and updated_at.
  4. In getConversationPlatform(), return null when the column does not
    exist.
  5. In stripPlatformColumn(), return early when platform is already absent.

Local patch touches:

  • packages/entity-loom/src/writers/db-writer.ts

Local verification

Patched the revamp repo and installed local source:

H:\Psycheros Program Files\entity-loom-v0.3.5

Verified:

deno task check
deno test src/

Tested against a throwaway copy of a finalized chats.db; writing the updated
thread changed the stored message count from 1 to 31 while preserving the
platformless conversation schema.

Then restarted the installed Entity Loom server, resumed the existing package,
re-ran the live parse/populate/commit path, and verified the live package:

{
  "conversation_id": "6a2889f8-7b64-83ea-87f8-270fbdf487bc",
  "updated_at": "2026-06-13T19:10:00.810Z",
  "message_count": 31,
  "conversation_columns": ["id", "title", "created_at", "updated_at"]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions