Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): compact superseded history in the background #19435

Mergedjuliusmarmingemerged 2 commits intomain fromrefs/pull/19435/headmerged by juliusmarminge View on GitHub

Showing 9 changed files with 73 additions and 15 deletions (loading 6).

x
0 of 9 viewed, 9 left
14 additions and 3 deletionsapps/server/src/mcp/ThreadMetadataMcpService.tsModified
View file
@@ -111,7 +111,10 @@
readonly action: ThreadMetadataMcpAction;
readonly commandId: CommandId;
readonly sequence: number;
- readonly thread: OrchestrationV2AppThread;
+ readonly thread: Pick<
+ OrchestrationV2AppThread,
+ "id" | "title" | "titleRegeneration" | "linkedPullRequest" | "updatedAt"
+ >;
}): ThreadMetadataMcpUpdateResult {
return {
threadId: input.thread.id,
@@ -199,7 +202,15 @@
const metadataEvent = dispatched.storedEvents.find(
(stored) => stored.event.type === "thread.metadata-updated",
- if (metadataEvent === undefined || metadataEvent.event.type !== "thread.metadata-updated") {
+ // A retried commandId replays the stored events of the first dispatch;
+ // compaction may have deleted them by then, so answer from the projection.
+ const thread =
+ metadataEvent?.event.type === "thread.metadata-updated"
+ ? metadataEvent.event.payload
+ : yield* threadManagement
+ .getThreadShell(threadId)
+ .pipe(Effect.mapError((error) => failure("orchestration_error", errorMessage(error))));
+ if (thread === null) {
return yield* failure(
"orchestration_error",
`Thread ${threadId} metadata update completed without a resultant state.`,