fix(agent): derive short session entry ids from the uuidv7 random tail (closes #6242)

The uuidv7 prefix is timestamp-derived and nearly constant between calls, so slicing the first 8 chars degenerated short ids to full-UUID fallbacks. Regression from 80c918c2 which replaced randomUUID with uuidv7.
This commit is contained in:
Armin Ronacher
2026-07-05 23:35:53 +02:00
parent 478301342b
commit 1dac099022
3 changed files with 7 additions and 2 deletions
+1
View File
@@ -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
@@ -34,7 +34,9 @@ function buildLabelsById(entries: SessionTreeEntry[]): Map<string, string> {
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();
@@ -27,7 +27,9 @@ function buildLabelsById(entries: SessionTreeEntry[]): Map<string, string> {
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();