Repository navigation
fix(threads): queue background-task continuations behind a running turn - #630
Merged
Merged
Conversation
nixuuu
force-pushed
the
fix/queue-task-continuations
branch
from
November 13, 2026 10:13
513615d to
8359a8d
Compare
nixuuu
force-pushed
the
fix/queue-task-continuations
branch
from
November 13, 2026 10:30
8359a8d to
4865aa6
Compare
nixuuu
marked this pull request as ready for review
November 13, 2026 11:02
nixuuu
added a commit
that referenced
this pull request
Nov 13, 2026
## Projekt workspace'u — zaakceptowany układ v2 Podgląd plików przechodzi z modala do zakładek jednego wątku. Sygnet projektu, skracany tytuł i karty dzielą rząd nagłówka, z aktywną kartą zawsze widoczną i przełącznikiem overflow. Prawy rail obsługuje jeden minimalny moduł. Bez modułu podsumowanie jest dokowane i widoczne; z modułem jest zamkniętą domyślnie kartą pływającą. Na wąskich ekranach obie powierzchnie używają arkuszy. Użytkownik zaakceptował układ v2 i udzielił jawnej zgody na implementację. Przyjęte decyzje: jeden zastępowalny czysty preview, utrwalany przez Edit/Keep tab/dwuklik, zakres cwd/worktree wątku i mobilna edycja natywna bez kolorów podczas pisania (kolory w viewerze i Preview changes). Usunięto sekcję otwartych decyzji. Dokument uwzględnia jeden przycisk menu wiersza (#608), zachowanie treści PR przy odświeżaniu (#611), bounded warming/cache transkryptu (#622/#623/#629), niezależne sortowanie sidebara (#617/#619/#626), kompaktowy tekst stanów preview (#634), poprawne stany ChoiceControl (#637), kolejkę kontynuacji (#630) i podsumowania jej wierszy (#633). Nie dodaje pełnych snapshotów ani prefetch plików podczas warming. Siedem kompletnych warstw będzie osobnym stosem z podstawą dev. Wszystkie PR implementacyjne pozostaną draftami do ukończenia i weryfikacji całości oraz wspólnego scalenia przez maintenera. Migracje muszą zachować monotoniczność względem aktualnego dev. Dokumentacyjny PR po zielonym CI jest gotowy do scalenia przez maintenera. ## Weryfikacja i ograniczenia - Rebase na dev `1626a3e6b05494e7aec77942bd818950468a3b58` bez konfliktów. - `nice -n 10 bun run format` i `nice -n 10 bun run format:check` przeszły. Konfiguracja pomija Markdown; dokument sprawdzono ręcznie. `git diff --check` bez błędów po usunięciu pustej linii końcowej. - Brak zmian kodu aplikacji i kontraktów; testy wykonania oraz pomiary budżetów należą do stosu implementacyjnego. - Samodzielna makieta v2 poza repozytorium, 32 435 bajtów, przezroczyste html/body, trzy stany × trzy szerokości × dwa motywy. Poprzednio wyrenderowana i obejrzana bez błędów konsoli. ## Copy audit (§8) Brak zmian produkcyjnych etykiet. Projekt zachowuje `Thread`, `Keep tab`, `Thread details`, `Open in tab`, `Collapse panel` / `Show panel` oraz dostępne nazwy obu kontekstów `+`. Zachowuje jeden przycisk menu wiersza i kompaktowy tekst statusów pliku. Krótkie i długie etykiety są pokazane w makiecie; rzeczywiste powierzchnie i stany będą audytowane w każdej warstwie UI.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two background-task completions could race a dispatched continuation or a provider wake-up and show a failed Work turn with
THREAD_ERROR: a turn of this thread is already running. Notes now follow the existing steer/queue policy: a running turn receives a platform steer; notes arriving while its StartTurn is dispatched wait durably for turn_started instead of creating another continuation or speculative steers. Otherwise notes queue a continuation. Notes in a batch keep(ended_at, item_id)order.Worker admission serializes StartTurn per thread without blocking control commands. Durable admission receipts prevent the same turn from executing again after restart, even with a fresh command ID. The gateway atomically requeues busy refusals with the same turn, input, note bindings, ordinal and expiry, logs the retry, and increments diagnostics metric 44. Recovery also dispatches note turns/steers committed before a gateway crash.
Related: #620, merged into
dev; this branch is rebased onto464fffffa. This builds on its task-end cancellation, ingest queue, ThreadLifecycle snapshots/deltas and Claude wake suppression, without changingcore-workers.tsor those mechanisms. The stop query inthread-lifecycle.tsadditionally interrupts dispatched queued starts before the running turn. Worker admission retains the lifecycle guard after waiting and rechecks it before provider admission; durable interrupt receipts also fence a cancelled turn after unarchive/restart. Diagnostics 41–43 remain unchanged; this adds 44. No PostgreSQL migration or protocol change is added.Validation:
4865aa66fbd88dbd10abe40369c6eb1be787d369: static checks, all four test shards throughcheck:tmp, web/Linux builds, aggregate validation and commitlint. CI run. Tests (2/4) passed after one rerun of a missed SQL lock-wait observation inthread-range-send-locks.test.ts; that test also passed in the local full run without changes.nice -n 10: install, gen:check, typecheck, lint, format:check and web build passed. The worktree is clean.check:tmp --timeout 30000: 2722 passed, 166 skipped, one failed across 509 files; temp directory clean. The unrelatedconfig-sync-projects.test.tsorigin-attachment assertion returnedattached=false. Its entire file then passed separately (12 tests, 92 assertions), with temp cleanup clean. The complete CI suite is green; no unrelated production code or test deadlines were changed.Copy audit (§8): no metric → “Turn starts requeued”, a sentence-case diagnostics counter explaining internal retries. Existing “Could not finish this turn” remains for actual failures; busy collisions no longer produce it. No controls or layout changed.