mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #4611] [GUI] Time Skip trials are never forgotten: entries grow with every trial, and a chat's Stop stops working #2091
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#2091
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?
Originally created by @codingkoala on GitHub (Oct 29, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4611
Area
[GUI] (the desktop app)
Desktop app, Terminal or source?
Source (START-HERE.bat, setup.sh or a build) — a checkout of
mainat46c152a. Only the App Host is involved: no engine, no model run, no GPU work.What happened
Line numbers are on
46c152a(the base of the pull request).Four things are keyed on a Time-skip trial's run id, and none of them is released:
timeskipChoices(apps/host/server/index.mjs:782) gets one entry for every trial started with a saved API model (index.mjs:1171,seton start). There is nodeleteand noclearof that map anywhere in the tree —grepoverapps/hostfinds only the declaration, theset, and oneget(index.mjs:1205). The entry is read only while the job posts revision requests, so a finished trial's entry is never read again and never dropped. One small object per trial, for the life of the host.endedOf(apps/host/server/timeskip.mjs:297,setat:484) keeps the run's end promise forever.:485used to bevoid ended.then(() => live.delete(id))— onlylivewas cleaned,endedOfwas not. It reproduces: after a run completes,liveis empty andendedOfstill holds the entry.watchTrial(index.mjs:803) takes a branch with no cleanup at all:status()returnsnullwhen the run's record is gone — its folder was removed, orrun.jsoncannot be parsed (timeskip.mjs:30-42says a parse failure means something else touched the file). So the trial's entry intrials(which holdscontrollerand the step closure), the chat's pointer intrialByChatand the model choice stay until the host restarts.The consequence of 3 is user-visible, and it is the reason I am filing this rather than reporting byte counts:
/api/chat/stop(index.mjs:1974) resolves a chat to its trial withtrialByChat. With a stale pointer it takes the time-skip branch,timeskip.stop()answersfalsefor an id that is not a run (timeskip.mjs:406), andagent.stop(b.sessionId)is never reached. So the Stop button of that chat does not stop the assistant's turn — it returns{ "stopped": false, "ended": "time-skip" }— until the host restarts.The size of the growth is small: a
timeskipChoicesentry is two short strings, and a settled promise is a small object.timeskip.mjs:298says the same kind of retention is deliberate forstopped("kept here (until the host restarts)"), so this may well be the same intent, unapplied. What makes it worth a thread is that the desktop App Host stays up for days or weeks, and 3 breaks a control the person can press.What I did: let a Time-skip trial run to completion, then read the four maps and the
/api/chat/stoppath. What I got: the end promise stayed after the job ended, and three of the four maps have nodeleteanywhere. What I expected: a trial this host has finished should not be remembered by anything.Smallest steps or command that reproduce it
a) The end promise (point 2), one run. A local copy of
timeskip.mjswith one debug accessor added to the returned object —_maps: () => ({ endedOf, live })— driving a real run through the real CLI (python3 strata.py timeskip run --workspace … --prompt … --attempts 1 --revise-command …). This accessor is not part of the proposed change and is not in the pull request; both copies were run on this machine, Node v22.22.1.Base revision (
46c152a, no fix):The same script against the proposed change:
b) A 12-trial soak through the real host (points 1 and 2). The harness (
/tmp/opencode/soak/soak.mjson my machine, outside the repository and not part of the change) inserts two things for the duration of one run — a_maps()accessor intimeskip.mjsand aGET /api/_debug/mapsroute inindex.mjsreturning the five sizes — boots the realserver/index.mjs, posts/api/timeskip/starttwelve times (legacy branch, aremoteModelsotimeskipChoicesis written, a fake revision command so no model is needed) and samples each map twice: at the run's terminal phase, and again after 4.6 s, i.e. two ticks ofwatchTrial's 2-second poll — the steady state a long-lived host sits in. It aborts before producing any number if the debug route is not reachable, removes both insertions infinally, and afterwards the tree is byte-identical to the base commit (git diff HEADempty). Two earlier attempts answeredNo route for GET /api/_debug/maps: that was a bug in my harness (the line went afterif (path === '/api/health') {, inside that block), not in the app — the abort-if-unreachable check came from it, and no number from those attempts is used.Twelve trials, all
completed, ~406 ms each, Ubuntu 26.04.1, Node v22.22.1. Steady-state sizes after runs 1, 4, 8 and 12:endedOfbasetimeskipChoicesbaseendedOfchangetimeskipChoiceschangetrials,trialByChat,live(both)On the base each trial adds one entry to both maps and nothing ever removes them; with the change both stay at 0.
liveis 0 on the base already — the oldended.thencleanedliveand notendedOf, which is exactly the asymmetry of point 2.Two things this soak does not show:
topis not the instrument for this. The growth is in the maps, over the days or weeks a desktop host stays up.trialsandtrialByChatreturn to 0 on the base too: the terminal-phase branch dropped them before this change as well. Their leak is point 3's other branch (record gone), which a normal run never reaches — points 3 and 4 stay code reading.Commands as run, on my machine (the harness touches the two files and restores them; check
git diff HEADis empty afterwards):Points 3 and 4 are established by reading the source (the branch has no cleanup; the route's branch order is visible): in the soak the run's record never disappears, so
status()never returnsnull.Reproduction status
Reproduced locally — point 1 (
timeskipChoices) and point 2 (endedOf): a 12-trial soak through the real host, numbers below.Points 3 and 4: Unconfirmed static analysis (I read code or ran a scanner; I did not see them fail). In that same soak
trialsandtrialByChatreturn to 0 on the base revision too, because the terminal-phase branch already dropped them; what point 3 describes is the other branch, where the run's record is gone, and a normal run never takes it.Strata version
Source checkout, commit
46c152a(the tree's version line says app 0.2.7, engine 0.1.52).Graphics card, memory and system
RTX 4070 SUPER 12 GB · 62 GB RAM · Ubuntu 26.04.1 LTS, kernel 7.0.0-38 x86_64 · Node v22.22.1 · Python 3.14.4. The card is irrelevant here: everything above is App Host bookkeeping in plain JavaScript.
Expected behaviour
A trial this host has finished, or whose record is gone, should not keep a poll running, an entry in
trials/trialByChat, a model choice or an end promise./api/chat/stopshould stop the chat's turn when there is no trial to stop.Proposed behaviour
One
dropTrial(id, timer)covering every way out ofwatchTrialandstopTrial(poll,trials,trialByChat,timeskipChoices),ended.thenreleasingendedOfas well aslive, and a newest-60 bound ontimeskipChoicesin the house style (serving.mjs MAX_REQUESTS = 60,monitor.mjs HISTORY = 60,timeskip.mjs MAX_LISTED = 60). The revision route already degrades when there is no entry: it falls back to the loaded local instance, and otherwise answers503 Load a model first(index.mjs:1205). No test in the repository calls that route, so this part is read from the code.Opened as pull request #4614: two files, +30/−5, no new tests (the maps are private to the closure). The soak above lives outside the repository: it is evidence for this report, not a test in the tree.
Related threads (read before filing; none covers this)
killTreeends a tree only on Windows. That is the failure I hit intests/timeskip-real.test.mjs("the revision command (a grandchild of the job) was ended too") — I am not reporting it, and my numbers below list it as the pre-existing failure so nobody reads it as caused by this change.stop()raises when the run's folder is not really gone. If it lands first, a Stop that cannot delete the folder leaves the trial watched (its record still exists, sostatus()is notnull); that keeps the chat's Stop retryable, which I would rather keep than silently drop.Validation
Passed (measured on
46c152a, this machine, Node v22.22.1):node --check apps/host/server/index.mjsandnode --check apps/host/server/timeskip.mjs.node --test apps/host/tests/tune-and-timeskip-routes.test.mjs→ 7 pass, 0 fail (the run-list and apply routes, and test 7 "an HTTP caller cannot supply an arbitrary revision command").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 listed below).node --test apps/host/tests/host-lifecycle.test.mjs→ 4 pass, 0 fail; that suite bootsserver/index.mjsitself, so the edited file loads, answers/api/healthand shuts down with its parent. It does not reach any Time-skip route.endedOfprobe above, run against46c152a(keeps 1 entry after the run) and against the change (0).completedeach time, the debug route answered on every run, and after each variant the tree was byte-identical to its source commit (git diff HEADempty). After restoring the change:node --test tests/tune-and-timeskip-routes.test.mjs→ 7 pass, 0 fail.Failed (pre-existing, measured on unmodified
46c152ain the same session):tests/timeskip-real.test.mjstest 6 — the grandchild assertion, which is #4529 (PR #4570 fixes it).tests/qa1-storage.test.mjs"item 8" — the app-version line; fails on the base revision too, unrelated to these files.46c152a→ 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 failed there and passes with the change: it is flaky on this box in my runs, and I am reporting it rather than dropping it.Not run:
npm testin full andtsc --noEmit:apps/hosthas nonode_moduleshere, so it needsnpm ci.engines.node >= 24.12.0line inapps/host/package.json; the grandchild failure may be environment-dependent — #4529 reproduces it on Node 26.12.1, so I read it as a real platform difference and not as Node-version noise.Limits
stopTriallooks rare (a person or a program removing the Time-skip state folder, or arun.jsontouched by something else).whenEnded, which PR #4570 already asserts after Stop. A maintainer who wants a check could expose a test-only accessor, or move the drop intotimeskip.mjswhere the existing test can see it.@github-actions[bot] commented on GitHub (Oct 29, 2026):
Thanks for the issue. To keep the tracker readable, every item needs an area prefix in the title and the parts of the issue form filled in. This one is missing:
Edit the issue (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment
/reopen.Details: CONTRIBUTING.md
@github-actions[bot] commented on GitHub (Oct 29, 2026):
Thanks, this follows the format now.