You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit b01a139
Browse filesBrowse the repository at this point in the historyBrowse files
fix: Codex HOLD findings on PR #1302 (kv-ready pending direction, cycle() stability, history race test rigor)
1. kv.ready gate direction (local.tsx, altimate-onboarding.tsx, component/prompt/index.tsx):
`hasUsableFreeDefaultGated` previously treated an unready kv as "assume usable" (`true`) — the
wrong direction. With delayed kv hydration, `--prompt` or a fast manual submit could pass
`useReady()` and submit to the implicit public Zen model before onboarding/migration ever ran.
It now reports `"pending"` (genuinely undecided), not a boolean guess either way. Every
consumer of `useReady()` except the prompt submit gate collapses `"pending"` to `false` (the
same conservative default as before kv.ready-awareness existed). The submit gate gets a new
`useReadyPending()` seam: a submit attempted while pending defers (keeps the typed prompt,
opens nothing) and is automatically retried via a `createEffect` once kv resolves either way —
sent if it turns out usable, discarded (matching the normal picker-reopen path) if not.
2. cycle() traversal stability (local.tsx): passing `{ recent: true }` (round 6, fixing a
cross-surface TUI/server default divergence) broke `cycle()`'s own navigation — reordering
`recent` on every pick meant the next press read its index off a list that had just reshuffled,
bouncing between two models instead of visiting every one. `cycle()` now captures its
traversal order once, lazily, into a separate `cycleOrder` snapshot that stays stable across a
whole cycling sequence (re-captured only if the current model falls out of it, e.g. an
unrelated explicit pick) — while still persisting every pick to the front of `recent` via
`selectModel(..., { recent: true })`, so cross-surface consistency is unaffected.
3. History startup-race test rigor (history-startup-race.test.tsx): the two round-6 regression
tests polled `loaded()` via `Bun.sleep`, which does not reliably keep the startup write "in
flight" — confirmed they passed even against the dropped-append bug they were meant to catch.
Replaced with three barrier-controlled tests using `spyOn(persistence, "readText"/"writeText")`
against manually-resolved deferred promises: append while the read is pending, append while
the rewrite's write is still gated/in-flight (FIFO ordering), and append synchronously in the
same reactive tick `loaded()` flips (the precise shape that reproduces the lazy-snapshot
duplicate bug). All three were confirmed to fail against the relevant old behavior and pass on
HEAD before being kept.
New tests: cycle-stability.test.tsx (calls the real cycle() three times, asserts the visited
sequence — verified fails against the pre-fix bounce), ready-pending.test.tsx (the defer/retry
mechanism, verified against both the "sent early" and "usable" directions).
Co-Authored-By: Claude Fable 5.1 <[email protected]>
0 commit comments