TypeScript
fix(server): a link card the user moved past no longer blocks auto-settle (#29847)
Alex Southwellc60950044a1e
diff --git a/apps/server/src/orchestration-v2/ProjectionStore.ts b/apps/server/src/orchestration-v2/ProjectionStore.tsindex f6be46d28ae..9696286f7b4 100644--- a/apps/server/src/orchestration-v2/ProjectionStore.ts+++ b/apps/server/src/orchestration-v2/ProjectionStore.ts@@ -6496,6 +6496,16 @@ export const layer: Layer.Layer<ProjectionStoreV2, never, SqlClient.SqlClient> =INDEXED BY orchestration_v2_projection_turn_items_waiting_link_idxWHERE link.thread_id = t.thread_idAND link.type = 'link_request' AND link.status = 'waiting'+ -- linkCardStillAsks: once the user writes after the card, it stops asking.+ AND NOT EXISTS (+ SELECT 1 FROM orchestration_v2_projection_messages message+ WHERE message.thread_id = t.thread_id AND message.role = 'user'+ AND json_extract(message.payload_json, '$.createdBy') = 'user'+ AND NOT ${isIdleCompactionMessage("message")}+ AND message.updated_at > COALESCE(+ json_extract(link.payload_json, '$.startedAt'), link.updated_at+ )+ ))ORDER BY t.updated_at ASC, t.thread_id ASC`;diff --git a/apps/server/src/peer/PeerLinkRequests.test.ts b/apps/server/src/peer/PeerLinkRequests.test.tsindex ccc7a8d8bd0..c3ca78cbcb6 100644--- a/apps/server/src/peer/PeerLinkRequests.test.ts+++ b/apps/server/src/peer/PeerLinkRequests.test.ts@@ -528,6 +528,9 @@ it.live("the agent asks without waiting, and the user links the box after its tuyield* a.orchestrator.getThreadProjection(threadId),).pendingRuntimeRequest,).toBeNull();+ expect(+ (yield* a.projections.getSettlementCandidates(threadId)).map((thread) => thread.id),+ ).toEqual([threadId]);expect(yield* cardOf(a)).toMatchObject({ status: "waiting", linkStatus: "pending" });// The user's client mints a code on the box and picks more than the agent suggested.