ui-server: run-session's error-result test waits only 200 one-millisecond ticks for the first prompt

Aperta Adatta ai principianti
#4,066 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Refactoring
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
bun, typescript
Ambito
testing

Direzione di ricerca

Leggi prima l'helper until in packages/ui-server/tests/run-session.test.ts:80-86: esegue polling con 200 setTimeout da un millisecondo, che è il budget che si esaurisce sotto carico. Poi guarda il caso che fallisce in run-session.test.ts:452-458 per vedere cosa attende e se il prompt espone una promise che può essere attesa al suo posto. Sostituisci il conteggio dei tick con una scadenza wall-clock o quella promise, mantenendo un percorso di fallimento per un prompt che non arriva mai. Fatto significa che bun run test packages/ui-server/tests/run-session.test.ts passa 20 esecuzioni consecutive sotto un ciclo di CPU-burn e continua a fallire quando il primo prompt viene soppresso.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

agent-ready area: ui-server priority: p3 type: test

Context

runSession > an error result fails its turn and is cleared before the next queued turn (packages/ui-server/tests/run-session.test.ts:452-458) waits for the backend's first prompt with until (run-session.test.ts:80-86). until polls 200 times with a 1 ms setTimeout, so its whole budget is roughly 200 ms of timer ticks.

Observed once locally, 2026-11-15, during a 124-file bun run test of ui-server files running alongside other worktrees' suites. It failed with error: condition was not reached at run-session.test.ts:458. The same file passes alone (16/16) on the same tree, and the change under test there (#3733) does not touch runSession. This is a timing budget under CPU load, not a product failure.

Scope

  • Give the wait a budget that does not depend on how quickly 1 ms timers fire under load, for example a deadline in wall time or awaiting the prompt's own promise.

Out of scope

  • runSession behaviour.

Acceptance criteria

  • The test passes under a CPU-burn loop across 20 consecutive runs, and still fails if the first prompt never arrives.

Verification

bun run test packages/ui-server/tests/run-session.test.ts, under load.

Contract impact

None.

2026-11-16 triage at main 3b104890f8: Verified until (packages/ui-server/tests/run-session.test.ts:80-86) and the prompt wait in the named case. This is a scoped test synchronization repair: wait on the observable prompt or a finite elapsed deadline, record the chosen bound, and retain a prompt-never-arrives negative control within the test’s existing outer timeout. Preserve all run-session outcome/queue assertions and meaningful cleanup. No production or UX choice is open. Preserve p3, add agent-ready, and keep standalone because the matching keyless epic #736 already has 100 direct children.

Lingua principale
TypeScript
Stelle
4
Fork
0
Merge medio
6h 5m
PR unite (30g)
730

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di schlessera/brain-kit

Tutte le issue di schlessera/brain-kit

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.