Commit Graph

13 Commits

Author SHA1 Message Date
Bingxi Zhao
c50a12eb3a Merge pull request #1373 from evan188199-tech/codex/fix/ask-user-waiter-loss
fix(turns): recover replies after waiter queue loss
2026-09-23 10:23:18 +08:00
Bingxi Zhao (Frank)
da856ad670 release: v1.6.9
Ship folder-based workspaces and data migration, daily practice, redesigned
provider and model settings, and streaming conversation improvements.
Synchronize README translations and document the archive/permanent-delete
upgrade behavior in assets/releases/ver1-6-9.md.

Reduce initial JavaScript by deduplicating English resources and loading
animation features after hydration. Keep the existing route size budgets.
Update regression fixtures and browser audits for scoped URLs and the new
settings and learning interfaces.
2026-09-21 02:30:40 +08:00
evan188199-tech
fa52492b45 test(app): stabilize multiworker reply subscription (#1433)
Co-authored-by: XZH <cto@xzh.ai>
2026-09-14 01:28:36 +08:00
Bingxi Zhao (Frank)
9feec62215 fix(turns): let a session blocked by a dead turn clear itself
`_begin_turn_sync` refuses a new turn while the session owns any row in
queued/running/waiting_input. That is right while a turn is alive and
catastrophic once one is not: a single row left behind by a lost worker,
a dropped socket or a restart blocked every later message in that
session, with no way out from the UI. Reporters described it precisely —
one window, no refresh, a conversation that never accepted another word
(#1297, #1359).

v1.6.7 closed the paths that manufacture those rows, but said nothing
about the ones already there. It shipped with "existing rows still need
clearing by hand" as a known issue, because the obvious fix — a periodic
sweep — needs an age threshold or it cancels a turn between its INSERT
and its first lease renewal, the worst failure a chat product has.

Reclaiming at the point of conflict removes that hazard rather than
managing it. The only rows ever considered are ones already blocking a
real request, so there is no window to get wrong, no timer, and no
threshold to guess. On a restart the leases are gone, so the first
message the user sends clears the row and goes through — the outcome the
sweep was for, without the sweep.

Liveness is the lease, never the row's age. A turn parked on an
`ask_user` card emits no events, so `updated_at` stops advancing while a
person is simply taking their time to answer; a live worker renews its
lease every few seconds whether or not it is producing output. So "no
lease" is the one signal that separates a zombie from a slow reader, and
a turn whose lease is live still gets its conflict — pinned by a test,
because that is what keeps this from becoming a way to run two turns on
one session.

Also names the exception. Both stores raised a bare RuntimeError with
the conflict spelled in the message; `ActiveTurnConflict` subclasses it,
so every existing handler keeps working, and a caller that can do
something about a stale row no longer has to match on text.

6921 passed, 24 skipped.
2026-09-11 12:43:41 +08:00
XZH
3e6eda0968 fix(turns): recover replies after waiter queue loss 2026-09-10 12:06:16 -07:00
Bingxi Zhao (Frank)
269cee58b1 test: pin the reaper's widened status set
_reap_unowned_live_turn accepts queued, running and waiting_input —
all three are rows _begin_turn_sync counts as active — but nothing
pinned the queued case, so narrowing the set back to waiting_input
alone left the whole suite green.

Cherry-picked from the PR-review session (3844aa7a); tests only.
2026-09-11 00:18:55 +08:00
Bingxi Zhao (Frank)
491a5a15cb follow-up to #1361: reclaim turns parked in waiting_input
Two paths left a durable row that blocked its whole session, because
`_begin_turn_sync` counts `waiting_input` as active and refuses every
later message with "Session already has an active turn" (#1297, #1359).

The terminal write on cancellation CAS'd on `expected_status="running"`
alone. A turn parked on `ask_user` sits at `waiting_input`, and the
waiter's restore to `running` is fired through `asyncio.shield` — so it
races that write and loses about as often as it wins. When it lost, nothing
terminal was written, no `done` event went out, and the row stayed
`waiting_input` forever: pressing Stop on a question was enough, no restart
needed. Both states are live and owned by the same execution, so both are
valid predecessors of its terminal state; the fencing token is still what
proves ownership.

`cancel_turn` also returned False when nothing held the lease, so Stop on a
card whose worker was gone was reported as a refusal the UI could not act on
while the row kept blocking the session. It now reaps, for the same reason
`submit_user_reply` does — and the reaper is widened to every live status
and renamed, since `queued` and `running` orphans block a session exactly
as `waiting_input` ones do.

NOT covered, deliberately: nothing sweeps rows left behind by a process that
died, because `MemoryCoordinator._known_turns` is per-process and
`list_expired_turn_ids()` is empty after a restart. That needs an age
threshold to avoid reaping a turn between its INSERT and its first lease
renewal, which is not a change to make unattended. This fixes the path that
*creates* the zombies; pre-existing rows still need that sweep.

(cherry picked from commit 5f040dbc9fc8be02f2281cf91c25e86f5991fa92)
2026-09-11 00:00:42 +08:00
ZQR1101
2e71e47f64 fix(turns): reap an unowned waiting_input turn when a reply arrives (#1297) (#1361)
Co-authored-by: ZQR1101 <278034003+ZQR1101@users.noreply.github.com>
2026-09-10 23:42:22 +08:00
Amir Fathi
293fd15f41 fix(turns): log when a coordinator-routed reply finds no local waiter (#1332)
_coordinate_execution discarded the bool submit_user_reply returns, so a
reply that arrives after the turn's local queue is gone gets a false ACK
and the turn sits at waiting_input forever with no trace of why. Capture
the return value and log a warning with the command id, turn id, lease
owner and persisted status instead.

Fixes #1297
2026-09-10 23:41:59 +08:00
Bingxi Zhao (Frank)
93df3d48b7 release: v1.6.4
Ship lighter isolated runtimes, richer Books and Mastery flows,
Reading/session polish, and explicit model API capabilities.

Release notes: assets/releases/ver1-6-4.md
2026-09-03 01:38:54 +08:00
Bingxi Zhao (Frank)
6e6e56aedb release: v1.6.3
Ship the breaking front- and back-end runtime and route refactor,
learner and guardian flows, grounded reading, knowledge and parser
updates, and recoverable long-running streams.

Release notes: assets/releases/ver1-6-3.md
2026-09-02 04:09:11 +08:00
Bingxi Zhao (Frank)
fc39543bc0 feat: integrate frontend backend and canonical routes 2026-09-01 22:24:29 +08:00
Bingxi Zhao (Frank)
02ba56793e chore: checkpoint backend stabilization workspace 2026-09-01 21:28:15 +08:00