diff --git a/packages/agent/CHANGELOG.md b/packages/agent/CHANGELOG.md index fb693ad8..21ea92bd 100644 --- a/packages/agent/CHANGELOG.md +++ b/packages/agent/CHANGELOG.md @@ -5,6 +5,7 @@ ### Fixed - Fixed harness split-turn compaction to serialize summary requests so single-concurrency providers are not asked to run overlapping generations ([#5536](https://github.com/earendil-works/pi/issues/5536)). +- Fixed harness session storage short entry ids to use the random tail of the generated uuidv7 instead of the timestamp prefix, which was nearly constant between calls ([#6242](https://github.com/earendil-works/pi/issues/6242)). ## [0.80.3] - 2026-06-30 diff --git a/packages/agent/src/harness/session/jsonl-storage.ts b/packages/agent/src/harness/session/jsonl-storage.ts index 4091a436..912673ff 100644 --- a/packages/agent/src/harness/session/jsonl-storage.ts +++ b/packages/agent/src/harness/session/jsonl-storage.ts @@ -34,7 +34,9 @@ function buildLabelsById(entries: SessionTreeEntry[]): Map { function generateEntryId(byId: { has(id: string): boolean }): string { for (let i = 0; i < 100; i++) { - const id = uuidv7().slice(0, 8); + // The uuidv7 prefix is timestamp-derived and nearly constant between calls, + // so short ids must come from the random tail. + const id = uuidv7().slice(-8); if (!byId.has(id)) return id; } return uuidv7(); diff --git a/packages/agent/src/harness/session/memory-storage.ts b/packages/agent/src/harness/session/memory-storage.ts index c6428cac..fba55dae 100644 --- a/packages/agent/src/harness/session/memory-storage.ts +++ b/packages/agent/src/harness/session/memory-storage.ts @@ -27,7 +27,9 @@ function buildLabelsById(entries: SessionTreeEntry[]): Map { function generateEntryId(byId: { has(id: string): boolean }): string { for (let i = 0; i < 100; i++) { - const id = uuidv7().slice(0, 8); + // The uuidv7 prefix is timestamp-derived and nearly constant between calls, + // so short ids must come from the random tail. + const id = uuidv7().slice(-8); if (!byId.has(id)) return id; } return uuidv7();