mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #2714] [Engine] let a coding agent's own heavy jobs have the GPU and RAM, then continue the conversation without re-reading it #1082
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#1082
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 @page1 on GitHub (Oct 16, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/2714
Area
[Engine] (speed, kernels, models, the server and API)
What do you want to do?
I run coding agents (opencode, Claude Code) against Strata on one PC. Their work often includes running a program that needs the same GPU and RAM the model holds: a simulation, a training run, an ML pipeline. What I want:
Measured on an RTX 3090 24 GB, Core Ultra 9 285K, 95 GB DDR5-6800, Windows 11, Flash-Next IQ3_S at 262K context, with a ~100K-token conversation, timed from the moment the model is asked back to the first answer of the continued conversation:
POST /load, the conversation from the disk)Giving the machine to the job: 4.2-4.5 s. In use on the whole PC before -> after: RAM 81.2 -> 28.0 GB (of 95.5; the rest is other programs), VRAM 23.2 -> 1.0 GB (of 24).
Why a fast start matters for this, and not much otherwise. For a server that stays up all day, the engine start happens about once a day, and a few seconds there are worth little. In this workflow the start is part of every iteration: the agent hands the whole machine to a job and takes it back, many times a day, and every return waits for a full engine start. Once the conversation itself comes back from the disk in a second or two, the start is most of what is left: here about 11 s of the 13 s (
POST /loadreturned after 10.9-11.0 s), and the engine start went from 17.0 s on v0.1.44.1 to 11.9 s (median of 6 starts each).How it's built locally:
POST /unload {"save": true}saves and ends the engine, and requests answer 503 untilPOST /load(xrip/Strata#2, a PR against #1937's branch);The latch is open as xrip/Strata#2 (server-side, about 115 lines with 9 tests); holds would follow on top of it. If #1937 does not land, the same can be built standalone on the session files. I'd like to know whether you want this in Strata, and in which shape.
@wandermyz commented on GitHub (Oct 18, 2026):
I've built the first half of this from outside Strata: vhotseat (#3110 , https://github.com/wandermyz/vhotseat). Strata's
before_loadrunsvhotseat gate strata. While another workload has the GPU, the gate refuses the load, so requests get a 503 and the agent's harness retries them.Wrapping a job looks a lot like your "holds", given a workload
jobwithgate: {kind: hold}in vhotseat's config:This unloads Strata (
POST /unload, after any answer it's writing), refuses every load untiltrain.pyexits, however it exits, and then lets the next request load Strata again. My own case is an agent queuing ComfyUI video renders on a 16 GB card running Flash-Next IQ3_XXS. ComfyUI asks through a custom node before each job, and Strata comes back when the agent asks its next question.It doesn't do the second half. After each job, Strata reads the conversation again. So the disk tier and
{"save": true}would make every return faster, and vhotseat could passsaveon the unload if they land.@page1 commented on GitHub (Oct 19, 2026):
@wandermyz thanks. vhotseat covering the first half from outside, with no patch to Strata, is a nice property. Two measurements from my side that may help it:
The holds I mentioned are in a review snapshot:
page1:snapshot/local-holds-2026-10-17(tools/strata_suspend.py,serve/server.py).@Niko1221 commented on GitHub (Oct 19, 2026):
Thanks for taking the time to report this.
We're resetting the tracker for 0.2.0-beta. There are more than 1,300 open issues and pull requests, too many for us to read properly, so we're closing everything that isn't being worked on right now. Closed here does not mean rejected.
To reopen it takes about two minutes:
/reopen. A check runs and either reopens the issue or lists what is still missing.The rules are in CONTRIBUTING.md.
@page1 commented on GitHub (Oct 23, 2026):
Re-tested on 0.2.2 (
011c9e60), RTX 3090 24 GB, Core Ultra 9 285K, 95 GB DDR5-6800, Windows 11, Flash-Next IQ3_S at262K context. Each run: a fresh server on a test port, a 92K-token conversation answered once, the model given away
(as for a job), 5 s, then back. "Back" is from the first call of the return (
POST /loadwhere a restore follows,otherwise the continued request, which loads the model itself) to the first answer of the continued conversation;
it includes the engine start in every row. Two runs per row, in the order cold, slot, #2672, #2672, slot, cold:
indications, not a benchmark.
POST /unload?wait=1, then the request (the whole prompt read again)POST /slots/0?action=savebefore the unload; back:POST /load,action=restore, the requestSave plus unload: 3.3-5.5 s (the successful saves 1.3-1.9 s for 1.6 GB; unload 3.3-4.4 s). RAM in use on the whole
PC 80.3-90.5 -> 26.4-32.2 GB (of 95.5; I did not measure which programs held the rest), VRAM 22.7 -> 0.0 GB.
So the second half partly exists in 0.2.2: the slot save/restore API brought a 92K conversation back without
re-reading it in 3 of 4 runs, without #1937. What it does not do yet:
engine's log says: "not enough RAM to save the session (355 MiB plus a floor of 8192 MiB needed, 5112 MiB
available)". The save answered 503, the restore found nothing (404), and the continued request read it all again
(49.6 s). Saving is the moment just before a job needs the RAM, so a refusal there costs the whole re-read.
unload itself (the
{"save": true}idea).slot_action), it is refused withparallel/--batch; I did not test that.The first half (keep the model out while a job runs). 0.2.2's
before_load+before_load_strictcan do therefusing: with a gate command that fails while a flag file exists (a stand-in for a job, not a real one), a request
was answered at once with 503 and
Retry-After: 15, and the first request after the flag was removed loaded themodel (17.4 s). The catch is on the harness side: against a fake server that answers 503 with Retry-After,
opencode 1.19.0 waited as told but stopped after 9 requests (77 s with Retry-After 15, 27 s with 5). So with a
refusing gate, a job longer than roughly that budget would end the agent's turn; I did not run that end to end.
Keeping requests waiting during a hold, instead of refusing them, would not depend on the client's retry budget.
Before writing code I'd like your direction, since both parts add server API:
process exits, with waiting requests kept alive rather than refused. Or should this stay outside Strata (as
vhotseat does, #3110)?
POST /unload {"save": true}through the existing session-file path, restored on the nextload. The refusal under tight RAM would be a separate change.
Is either something you want in Strata, and in which shape?
@page1 commented on GitHub (Oct 23, 2026):
/reopen
@github-actions[bot] commented on GitHub (Oct 23, 2026):
Not reopened yet. Still missing:
Edit the issue and comment
/reopenagain. Details: CONTRIBUTING.md@page1 commented on GitHub (Oct 23, 2026):
/reopen
@github-actions[bot] commented on GitHub (Oct 23, 2026):
Reopened, thank you. A maintainer will pick it up from here.
@page1 commented on GitHub (Oct 23, 2026):
A correction to proposal 1 above: rather than a process id that Strata watches, the hold would be a lease the
holder keeps alive. The holder registers it and renews it every few seconds (say every 10 s); without renewals it
expires (say after 45 s), and the model may load again. That avoids OS-specific process watching, works the same on
Windows and Linux and for a holder on another machine, and needs no special handling for a crash, a kill or a power
cut: the renewals just stop. The server would keep each lease's last renewal on disk, so after a restart it can wait
one expiry period for live holders to renew, and can tell a hold that ended with a release from one that expired.
The second case is the one where an agent's turn was cut off and can be resumed with a note saying so.
@page1 commented on GitHub (Oct 24, 2026):
Status of the lease idea above: I built it on my local fork and have been running it on this PC since today. It is
not on 0.2.x yet (my fork is an older line with local changes), so this is a report, not a PR.
How it works: a job's wrapper registers a lease (
POST /lease {cmd, cwd, mode}), renews it every 10 s and ends itwhen the job exits; a lease nobody renews expires after 45 s. While any lease is live the model stays unloaded,
nothing loads it (a plain
/loadgets 409;{"force": true}ends the leases), and chat requests wait (keep-aliveson a stream) instead of getting a 503. When the last lease ends, the model comes back if it was loaded before. The
leases are files written by the server only, under one lock, so several agents can take them at once.
Live checks against the real server (RTX 3090, Windows 11, Flash-Next IQ3_S), one run each:
POST /load {"force": true}during a jobEdge cases the tests turned up, which any version of this needs to handle:
even got a 503 written into an already started stream);
stays off after it;
Windows: the wrapper joins a kill-on-close job object before starting the job);
One thing that may help regardless: Claude Code sends its session id in
x-claude-code-session-id(User-Agentclaude-cli/<version>), next to opencode'sx-opencode-session-id.Not tested: Linux (there a killed wrapper's job is only cleaned up on a normal exit), multi-GPU,
--batch.If you want this in Strata, I'd port the server half to 0.2.3 as one opt-in PR (off by default, the default path
unchanged): the lease table,
/lease,/lease/<id>/renew|end,GET /leases, and requests waiting during a lease.The wrapper and the waking of cut-off agent sessions would stay outside (they are my own tooling). Or, if this
belongs outside Strata like vhotseat (#3110), the lease API is the only part that needs the server. Which would you
prefer?
@Niko1221 commented on GitHub (Nov 5, 2026):
Thanks for taking the time to report this.
Strata has changed a lot since this was opened, and 0.2.11 is out now, so many older reports no longer apply. We're closing issues older than a week that have had no new reports in the last week. Closed here does not mean rejected.
To reopen it takes about two minutes:
/reopen. A check runs and either reopens the issue or lists what is still missing.The rules are in CONTRIBUTING.md.