Skip to content

Commit a64e045

Browse files
fix(contracts): preserve exact transcript file identities (pingdotgg#21463)
1 parent 3ace625 commit a64e045

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

‎apps/server/src/project/AgentSessionScanner.ts‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -574,10 +574,12 @@ function transcriptIdentity(filePath: string, stats: FileSystem.File.Info) {
574574
};
575575
}
576576

577-
function sameTranscriptIdentity(
578-
left: ReturnType<typeof transcriptIdentity>,
579-
right: ReturnType<typeof transcriptIdentity>,
580-
): boolean {
577+
type TranscriptIdentity = Pick<
578+
AgentSessionImportSource,
579+
"filePath" | "size" | "mtimeMs" | "device" | "inode" | "birthtimeMs"
580+
>;
581+
582+
function sameTranscriptIdentity(left: TranscriptIdentity, right: TranscriptIdentity): boolean {
581583
return (
582584
left.filePath === right.filePath &&
583585
left.size === right.size &&

‎packages/contracts/src/agentSessions.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ export const AgentSessionImportSource = Schema.Struct({
1313
size: NonNegativeInt,
1414
mtimeMs: Schema.NullOr(Schema.Number),
1515
device: Schema.Number,
16-
inode: Schema.NullOr(Schema.Number),
16+
// A decimal string keeps file IDs above 2^53 (common on NTFS) exact. Older
17+
// records stored a number.
18+
inode: Schema.NullOr(Schema.Union([Schema.String, Schema.Number])),
1719
birthtimeMs: Schema.NullOr(Schema.Number),
1820
});
1921
export type AgentSessionImportSource = typeof AgentSessionImportSource.Type;

0 commit comments

Comments
 (0)