fix: allow 'error' tone for task.completed activity in schema

The OrchestrationThreadActivity union only accepted tone 'info' for
task.completed, but ProviderRuntimeIngestion produces tone 'error' when
a task fails. This caused Schema.decodeUnknownSync to throw when reading
back failed task activities, crashing the snapshot query for that thread.

Add a second union member for task.completed with tone 'error' so both
successful and failed task completions validate correctly.
This commit is contained in:
Cursor Agent committed 2026-03-24 20:44:51 +00:00
1 parent 3f48ad2d1e
commit fac4623d46
1 file changed
+1
+1
View File
@@ -397,6 +397,7 @@ export const OrchestrationThreadActivity = Schema.Union([
makeThreadActivitySchema("task.started", "info", TaskStartedActivityPayload),
makeThreadActivitySchema("task.progress", "info", TaskProgressActivityPayload),
makeThreadActivitySchema("task.completed", "info", TaskCompletedActivityPayload),
makeThreadActivitySchema("task.completed", "error", TaskCompletedActivityPayload),
makeThreadActivitySchema("context-compaction", "info", ContextCompactionActivityPayload),
makeThreadActivitySchema("context-window.updated", "info", ThreadTokenUsageSnapshot),
makeThreadActivitySchema("tool.updated", "tool", ToolUpdatedActivityPayload),