Repository navigation
Commit 9b2b2ef
committed
fix(sleep): keep the longer copy, not the newer one, when auto-resolving
"Keep the newer one" reads as reasonable and measures wrong. In the live queue,
of the 20 pairs at similarity >= 0.95, 11 (55%) have a newer side that is
SHORTER than the older one, by 132 characters on average; at 0.88 it is 122 of
213 (57%). A distilled, compressed copy carries a later updated_at than the
fuller original, so newer-wins archives the better record.
Typical case: the 371-character original about "开不了新对话/会话异常" against
its 307-character distilled rewrite - the rewrite is the newer one.
This matches mem0's adjudication rule: prompts.py:217 says to keep the copy
carrying the most information, not the newest. cognee does the opposite
("take the newer one"), which would cut "0:00 前必须躺下" down to a fragment.
Selection is now length first, then updated_at, then id. Equal length counts as
"comparable information", so the newer side wins there; the id tiebreak keeps a
replay from flipping sides and archiving the copy it just saved.
Tests: the longer copy survives when the shorter one is newer; equal-length
copies fall back to the newer one. Mutation-checked by restoring the newer-first
order, which turns the first case red. Disabling the updated_at tiebreak stays
green - the fixture's ids happen to sort the same way, so that rung is a
determinism guarantee rather than something the fixture exercises.1 parent 7fbd60f commit 9b2b2ef
3 files changed
Lines changed: 101 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
443 | 443 | | |
444 | 444 | | |
445 | 445 | | |
446 | | - | |
| 446 | + | |
447 | 447 | | |
448 | 448 | | |
449 | 449 | | |
| |||
474 | 474 | | |
475 | 475 | | |
476 | 476 | | |
477 | | - | |
478 | | - | |
479 | | - | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
480 | 496 | | |
481 | 497 | | |
482 | 498 | | |
483 | 499 | | |
484 | 500 | | |
485 | 501 | | |
486 | | - | |
| 502 | + | |
487 | 503 | | |
488 | 504 | | |
489 | 505 | | |
490 | 506 | | |
491 | 507 | | |
492 | | - | |
| 508 | + | |
| 509 | + | |
493 | 510 | | |
494 | 511 | | |
495 | 512 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
443 | 443 | | |
444 | 444 | | |
445 | 445 | | |
446 | | - | |
| 446 | + | |
447 | 447 | | |
448 | 448 | | |
449 | 449 | | |
| |||
474 | 474 | | |
475 | 475 | | |
476 | 476 | | |
477 | | - | |
478 | | - | |
479 | | - | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
480 | 496 | | |
481 | 497 | | |
482 | 498 | | |
483 | 499 | | |
484 | 500 | | |
485 | 501 | | |
486 | | - | |
| 502 | + | |
487 | 503 | | |
488 | 504 | | |
489 | 505 | | |
490 | 506 | | |
491 | 507 | | |
492 | | - | |
| 508 | + | |
| 509 | + | |
493 | 510 | | |
494 | 511 | | |
495 | 512 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
367 | 367 | | |
368 | 368 | | |
369 | 369 | | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
370 | 425 | | |
371 | 426 | | |
372 | 427 | | |
| |||
0 commit comments