A desktop coding agent with free access to frontier models.
TypeScript
fix: restored chats follow the server's settings
ogsamrat282023989666
diff --git a/apps/server/src/session-uploader.ts b/apps/server/src/session-uploader.tsindex 543a551d..17ccb2c9 100644--- a/apps/server/src/session-uploader.ts+++ b/apps/server/src/session-uploader.ts@@ -5921,6 +5921,19 @@ export class SessionUploader {return ready && state.policyResolved ? state.redactionPolicy : null;}+ /**+ * The rules for a chat taken up again outside its live run (journal recovery, transcript repair): its pin+ * when the ledger has one; a chat only the server knows went up before pins (never raw); otherwise the+ * server's capture switch as answered now (null while unresolved: nothing goes up on a guess).+ */+ private async unpinnedPolicy(record: SessionLedgerRecord | undefined, serverOnly: boolean): Promise<RedactionPolicy | null> {+ if (record?.redactionPolicy === CLIENT_RAW || record?.redactionPolicy === CLIENT_V3 || record?.redactionPolicy === "legacy") return record.redactionPolicy;+ if (serverOnly) return pinnedPolicy(record, defaultRedactionPolicy());+ if (!this.settleCapturePolicy) return pinnedPolicy(record, defaultRedactionPolicy());+ const answer = await this.askCapturePolicy();+ return answer ? pinnedPolicy(record, answer) : null;+ }+/** One try at the server's capture switch (at most POLICY_SETTLE_MS): the answer, or null when unresolved. */private async askCapturePolicy(): Promise<RedactionPolicy | null> {if (!this.settleCapturePolicy) return null;@@ -7570,8 +7583,10 @@ export class SessionUploader {state.refused = [...(record.refused ?? [])];state.endedAt = record.endedAt;state.resumed = state.segment > 1;- // The chat's own rules, whatever this process's switch says now.- state.redactionPolicy = pinnedPolicy(record, state.redactionPolicy);+ // The chat's own rules, whatever this process's switch says now; without a pin, only the server's answer.+ const policy = await this.unpinnedPolicy(record, false);+ if (!policy) return false;+ state.redactionPolicy = policy;const at = new Date().toISOString();const events: TraceEvent[] = [{ at, type: "collector.repair", data: { reason: "integrity_gaps", gaps: gaps.slice(0, 200), parts: parts.length } }];parts.forEach((messages, index) => events.push({ at, type: "turn.messages", data: { messages, part: index + 1, parts: parts.length, repair: true } }));@@ -7870,8 +7885,11 @@ export class SessionUploader {state.endedAt = record?.endedAt;state.resumed = state.segment > 1;// The chat's own rules, whatever this process's switch says now (a chat the server knows but- // this ledger lost went up before pins: never raw).- state.redactionPolicy = pinnedPolicy(record ?? (server ? { segment: server.segment, nextSequence: server.sequence, lastSeenAt: "" } : undefined), state.redactionPolicy);+ // this ledger lost went up before pins: never raw). Without a pin, only the server's answer counts:+ // no answer, and the journal waits for a later start instead of going up under a guess.+ const policy = await this.unpinnedPolicy(record ?? (server ? { segment: server.segment, nextSequence: server.sequence, lastSeenAt: "" } : undefined), Boolean(server && !record));+ if (!policy) return;+ state.redactionPolicy = policy;for (const event of events) {for (const evidence of knownToolPathEvidence(event.type, event.data)) {const path = workspaceRelativePath(state.root, evidence.path.replaceAll("\\", "/"));