Skip to content

fix(fts): action-event FTS trigger DDL references wrong columns #467

Closed

Description

@Sinity

Problem

_ACTION_FTS_TRIGGER_DDL in storage/fts_lifecycle.py:114-130 defines triggers that INSERT into 8 columns (rowid, event_id, conversation_id, action_kind, tool_name, path, summary, search_text). But the actual action_events_fts table — defined in both storage/backends/schema_ddl_actions.py:47-89 and storage/fts_lifecycle_sql.py:17-27 — has only 6 columns (event_id, message_id, conversation_id, action_kind, tool_name, text).

Columns path, summary, and search_text don't exist in the FTS table.

When restore_fts_triggers_async() is called (after any pipeline run that suspends triggers via run_execution.py:325-330), SQLite raises OperationalError: table action_events_fts has no column named path. The exception is caught by the except block on line 332 and logged as non-fatal. The correct canonical triggers from schema_ddl_actions.py are never created.

Impact: After every pipeline run, action-event FTS triggers are permanently absent. New/modified action events are NOT inserted into the FTS index. Action-event search silently becomes stale until the next full polylogue run index rebuild.

Message FTS triggers are correctly defined — only action events are affected.

Affected code

  • storage/fts_lifecycle.py:114-130 — broken _ACTION_FTS_TRIGGER_DDL with 8 columns
  • storage/backends/schema_ddl_actions.py:58-88 — correct canonical triggers (6 columns)
  • pipeline/services/run_execution.py:325-330 — suspend/restore lifecycle that triggers the bug

Fix direction

Replace _ACTION_FTS_TRIGGER_DDL with the correct trigger DDL matching schema_ddl_actions.py. The trigger should map new.search_text → text column, matching the schema.

Discovered during adversarial audit 2026-04-26.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:storagetype:fix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions