Repository navigation
Commit cb9e4d7
fix: Codex re-review round 8 (cycleOrder staleness, ready-pending test coverage)
1. cycleOrder goes stale after an external recents change (local.tsx): the round-7 fix
(cycleOrder, re-captured only when the current model fell out of the snapshot) still went
stale the moment a PICKER selection reordered `recent` without also knocking the current
model out of the old snapshot. Codex's repro: [A, B, C], cycle once, then pick D and A via
the picker -> recents [A, D, C, B]; A stays present in the stale [A, B, C] snapshot the whole
time, so the round-7 check never re-fires, and D stays permanently unreachable by cycling.
Fixed with a `recentsVersion` counter (bumped by a new `setRecent` wrapper — the only path
that writes to `modelStore.recent` now) and a `cycleOrderVersion` on the cycle() closure:
cycle() re-captures whenever the live version has moved past what it last saw or resynced to,
which happens for ANY external write, picker included — while resyncing after its own write
so repeated presses with nothing else interleaved keep reusing the same stable snapshot.
Regression test: extended cycle-stability.test.tsx's existing "stable order" scenario with
Codex's exact repro (pick D and A via the picker after cycling once, assert D becomes
reachable and the re-captured order stays stable afterward). All three tests in that file now
share one mount via beforeAll/afterAll rather than each mounting independently — a second or
third independent heavy provider-tree mount in this file was found to reproducibly hang during
its own bootstrap (a test-infrastructure resource-contention issue, worse the more work a
prior mount did, unrelated to anything under test) — chaining the scenarios onto one shared,
stateful mount sidesteps it while still exercising the real cycle() end to end. Confirmed the
new assertion fails (D never reachable, times out) against the round-7-only invalidation
check, and passes on HEAD.
2. ready-pending.test.tsx exercised a hand-rolled reimplementation of the defer/retry shape
instead of production code, so reverting the real fix in component/prompt/index.tsx left it
passing regardless. Extracted `createDeferredRetry` (packages/tui/src/util/signal.ts) — a
small, generic, reactive defer-then-retry primitive — and made both prompt/index.tsx's submit
gate and the test's harness call the SAME function. Confirmed the test fails (2 of 3 cases,
exactly the ones relying on automatic retry) when `createDeferredRetry`'s retry is temporarily
broken, and passes on HEAD once restored.
Co-Authored-By: Claude Fable 5.1 <[email protected]>1 parent ce0d3af commit cb9e4d7
5 files changed
Lines changed: 206 additions & 75 deletions
File tree
- packages/tui
- src
- component/prompt
- context
- util
- test/context
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| |||
1035 | 1035 | | |
1036 | 1036 | | |
1037 | 1037 | | |
1038 | | - | |
1039 | | - | |
1040 | | - | |
1041 | | - | |
1042 | | - | |
1043 | | - | |
1044 | | - | |
1045 | | - | |
1046 | | - | |
1047 | | - | |
1048 | | - | |
1049 | | - | |
1050 | | - | |
1051 | | - | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
1052 | 1052 | | |
1053 | 1053 | | |
1054 | 1054 | | |
| |||
1100 | 1100 | | |
1101 | 1101 | | |
1102 | 1102 | | |
1103 | | - | |
| 1103 | + | |
1104 | 1104 | | |
1105 | 1105 | | |
1106 | 1106 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
432 | 432 | | |
433 | 433 | | |
434 | 434 | | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
435 | 450 | | |
436 | 451 | | |
437 | 452 | | |
| |||
476 | 491 | | |
477 | 492 | | |
478 | 493 | | |
479 | | - | |
| 494 | + | |
480 | 495 | | |
481 | 496 | | |
482 | 497 | | |
| |||
634 | 649 | | |
635 | 650 | | |
636 | 651 | | |
637 | | - | |
| 652 | + | |
638 | 653 | | |
639 | 654 | | |
640 | 655 | | |
| |||
757 | 772 | | |
758 | 773 | | |
759 | 774 | | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
760 | 780 | | |
761 | 781 | | |
762 | 782 | | |
| |||
804 | 824 | | |
805 | 825 | | |
806 | 826 | | |
807 | | - | |
808 | | - | |
809 | | - | |
810 | | - | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
811 | 842 | | |
812 | 843 | | |
813 | 844 | | |
814 | 845 | | |
815 | 846 | | |
816 | | - | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
817 | 851 | | |
818 | 852 | | |
819 | 853 | | |
| |||
822 | 856 | | |
823 | 857 | | |
824 | 858 | | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
825 | 862 | | |
826 | 863 | | |
827 | 864 | | |
| |||
937 | 974 | | |
938 | 975 | | |
939 | 976 | | |
940 | | - | |
| 977 | + | |
941 | 978 | | |
942 | 979 | | |
943 | 980 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
3 | 26 | | |
4 | 27 | | |
5 | 28 | | |
| |||
0 commit comments