Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): Address premature provider reaping by treating provider runtime output as session activity #3856

Closedozppupbg(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/3856/headopened View on GitHub

Showing 6 changed files with 40 additions and 0 deletions (loading 3).

x
0 of 6 viewed, 6 left
38 additions and 0 deletionsapps/server/src/persistence/ProviderSessionRuntime.tsModified
View file
@@ -56,6 +56,12 @@
export const DeleteProviderSessionRuntimeInput = Schema.Struct({ threadId: ThreadId });
export type DeleteProviderSessionRuntimeInput = typeof DeleteProviderSessionRuntimeInput.Type;
​
+export const TouchProviderSessionRuntimeInput = Schema.Struct({
+ threadId: ThreadId,
+ lastSeenAt: IsoDateTime,
+});
+export type TouchProviderSessionRuntimeInput = typeof TouchProviderSessionRuntimeInput.Type;
+​
/**
* ProviderSessionRuntimeRepository - Service tag for provider runtime persistence.
*/
@@ -97,6 +103,16 @@
readonly deleteByThreadId: (
input: DeleteProviderSessionRuntimeInput,
) => Effect.Effect<void, ProviderSessionRuntimeRepositoryError>;
+​
+ /**
+ * Bump `last_seen_at` for an existing runtime row.
+ *
+ * No-op when no row matches. Cheaper than `upsert` for high-frequency
+ * activity signals because it skips the SELECT and JSON re-encoding.
+ */
+ readonly touchByThreadId: (
+ input: TouchProviderSessionRuntimeInput,
+ ) => Effect.Effect<void, ProviderSessionRuntimeRepositoryError>;
>()("t3/persistence/ProviderSessionRuntime/ProviderSessionRuntimeRepository") {}