mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #4614] [GUI] Time Skip trials drop their poll, entry, chat pointer, model choice and ended promise #5111
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#5111
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/4614
Author: @codingkoala
Created: 10/29/2026
Status: 🔄 Open
Base:
main← Head:gui-timeskip-trial-cleanup📝 Commits (1)
891d70aapps/host: a Time-skip trial drops its poll, entry, chat pointer, model choice and ended promise📊 Changes
2 files changed (+30 additions, -5 deletions)
View changed files
📝
apps/host/server/index.mjs(+26 -4)📝
apps/host/server/timeskip.mjs(+4 -1)📄 Description
Problem and result
Four things are keyed on a Time-skip trial's run id and none of them is released (#4611):
endedOf(apps/host/server/timeskip.mjs:297) held the run's end promise for the host's whole life:ended.thencleanedliveonly. Measured on46c152a— after a run completes,live: 0,endedOf: 1. With this change:live: 0,endedOf: 0.whenEndedbehaves as before:stop()takes the promise (endedOf.get(id) ?? Promise.resolve(),timeskip.mjs:410) before the settle handler runs, and a settled promise is what that fallback returns anyway.timeskipChoices(apps/host/server/index.mjs:782) had nodeleteand noclearanywhere in the tree (agrepoverapps/hostfinds only the declaration, theseton start, and onegetat the revision route): one entry per trial ever started, never read again. Now the newest 60 are kept, the same bound the request board and the Time-skip listing use (serving.mjs MAX_REQUESTS,monitor.mjs HISTORY,timeskip.mjs MAX_LISTED). AMapiterates in insertion order, so the oldest goes first.watchTrial'sif (!run)branch (index.mjs:803) cleared only its timer, sotrials,trialByChatand the model choice stayed until the host restarted when the run's record disappeared (folder removed, orrun.jsonunparseable). The user-visible part:/api/chat/stop(index.mjs:1974) resolved that chat to the dead run id,timeskip.stop()answeredfalsefor an id that is not a run, andagent.stop(sessionId)was never reached — the chat's Stop button reportedended: 'time-skip'and did not stop the assistant's turn. After the change the pointer is gone and Stop falls through toagent.stop.503 Load a model first.Related discussion
#4611 (opened as the scope thread for the 60 bound). Focused fix, two files, +30/−5. I also read #4529 and PR #4570 (
killTreeon Linux/macOS) and PR #4442 (stop()raises when the folder is not gone): different problems, no overlap with these lines.Approach
One
dropTrial(id, timer)covers every way out of a trial — the vanished record, the terminal phase, and Stop — so the four maps cannot drift apart again, which is how this happened in the first place.stopTrialkeeps itscontroller.abort()andchatStore.removeById()before it. Nothing else changes: the terminal-phase cleanup is the same set it already dropped, plus the model choice that nothing reads after a run finishes.Validation
Measured on commit
46c152a, Ubuntu 26.04.1 LTS (kernel 7.0.0-38, x86_64), RTX 4070 SUPER, 62 GB RAM, Node v22.22.1, Python 3.14.4. The card is irrelevant: App Host JavaScript only. Every line number in this body is on the base46c152a.Passed:
node --check apps/host/server/index.mjs,node --check apps/host/server/timeskip.mjs— no syntax error.node --test apps/host/tests/tune-and-timeskip-routes.test.mjs→ 7 pass, 0 fail (the Time-skip run-list and apply routes, and test 7 "an HTTP caller cannot supply an arbitrary revision command"). No test in the repository calls/api/internal/timeskip-revise— that route's behaviour below is read from the code, not exercised.node --test apps/host/tests/timeskip-real.test.mjs tests/timeskip-fork.test.mjs tests/timeskip-compare-server.test.mjs→ 13 pass, 1 fail, 4 skipped; the one failure is pre-existing and listed under Failed.node --test apps/host/tests/host-lifecycle.test.mjs→ 4 pass, 0 fail (run against the final state of the change); that suite bootsserver/index.mjsitself, so the edited file loads, answers/api/healthand shuts down with its parent — no runtime error at load or at exit. It does not reach any Time-skip route.endedOfprobe from #4611, run the same way against46c152a(endedOf: 1after completion) and against this change (endedOf: 0), withlist(),whenEnded()andstop()unchanged on both sides.watchTrialhad polled twice,46c152aheldendedOfandtimeskipChoicesat 1, 2, … 12 — one entry per trial, never released — while this change held both at 0 after every run, withtrials,trialByChatandliveat 0 and host RSS 92 → 86 MB on both (the leftovers are too small to see in RSS; the maps are the instrument). The harness lives outside the repository: it inserts a debug route for the duration of a run, removes it infinally, and the tree was byte-identical to its source commit after each variant.Failed:
apps/host/tests/timeskip-real.test.mjstest 6 ("Stop ends the job and everything it started…") — the grandchild assertion, which is #4529 (PR #4570 fixes it). Pre-existing: the unmodified46c152atree fails the same assertion, measured in the same session on the same three files. In that failing run the two preceding assertions still pass (the copies are deleted,phase === 'cancelled'), so Stop's bookkeeping and the file removal are not what breaks.apps/host/tests/qa1-storage.test.mjs"item 8" (the app-version line) — fails on the base revision too, unrelated to these files.timeskip-real,timeskip-fork,timeskip-compare-server): base46c152a→ 12 pass / 2 fail / 4 skipped (tests 4 and 6 oftimeskip-real); this change → 13 pass / 1 fail / 4 skipped (test 6 only). Base test 4 ("a run starts without the caller waiting … applies the chosen revision") failed there and passes with the change: it is flaky on this box in my runs, not something I can attribute to this diff, and I am reporting it rather than dropping it.Not run:
npm testin full andtsc --noEmit:apps/hosthas nonode_moduleshere, so it needsnpm ci. I ran the suites that matter for these files directly withnode --test.apps/host/package.jsonsaysengines.node >= 24.12.0, and this box has v22.22.1. Nothing in this change depends on the version; the #4529 failure may be environment-dependent (that report reproduces it on Node 26.12.1), so I am not attributing it to Node.Limits
stopTrial(something removing the Time-skip state folder, or arun.jsontouched by something else —timeskip.mjs:30-42already says a parse failure means something else touched the file).trials,trialByChatandtimeskipChoicesare private to the module's closure, so an assertion would need a test-only accessor. The closest observable iswhenEnded, which PR #4570 already asserts after Stop. Say the word and I will add the accessor, or move the drop intotimeskip.mjswhere the existing test can see it.dropTrial(), so that trial stays watched (its record still exists, sostatus()is notnull). Today's line it replaces behaves the same, and I would rather keep the chat's Stop retryable than silently drop it — this is a note, not a change.stoppedset (timeskip.mjs:298) is deliberately kept until the host restarts, so its entries are left alone.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.