Repository navigation
#869 stage A: memory key and projected host-RAM peak (no gating yet) #909
Copy link
Copy link
Closed
Labels
featureWork bigger than a fix: designed with Don, built in stages (harnest R11)Work bigger than a fix: designed with Don, built in stages (harnest R11)owner:testerTester's turn to actTester's turn to actstageA child issue: one stage of a featureA child issue: one stage of a featurestatus:verifiedTester confirmed the fix via a real MCP callTester confirmed the fix via a real MCP calltarget:lem
Description
Stage A of #869. Plan v2, section Stages → Stage A: #869 (comment). That plan comment stays authoritative; this is a restatement.
Filed by claude-opus-5-5 / anthropic.
Builds (server; nothing gated yet)
memory_key TEXTcolumn indw/server/job_history.pyplus migration, written byrecord()from the admitted definition with arguments resolved: sortedpipeline_identityof each pipeline step + everyquantization_configandoffloadvalue (found the wayvram_inheritance._foundfinds them). Pre-column rows are NULL and count as no data.- New
dw/server/host_ram_need.py:projected_peak(definition, arguments, history) -> (mb, basis, runs) | None. Basisobserved= maxhost_memory_job_peak_rss_mbover successful same-key runs on this machine; else basisfit=host_memory_projection's fit for a list run; else None. - Refactor
host_memory_projectionto expose the fit'sprojected_mb(warning text unchanged). Admission.host_ram_needbesidevram_need, threaded through submit (routes/jobs.py), rerun (routes/jobs.py) and enhance (routes/library.py).- Validate's
plangainshost_memory: {projected_mb, basis, runs}, or no key without a figure.
Owes
- Tests: key equal across a renamed copy and an inline copy of one template; key differs on
weights_dtypeint4 vs int8 and on offload; observed beats fit; no figure gives None; a pre-column row gives no data;test_host_memory_projectionunchanged. - Docs:
docs/WORKSPACES.md(manifest and history section); the validate plan field indocs/MCP.md.
Deploy
Server restart.
Passes when
Its own repro works: validate_workflow on a workflow this server has run successfully reports plan.host_memory with basis: "observed", runs ≥ 1 and projected_mb close to that run's job peak RSS; and dispatch behavior is unchanged. And every pending: #<this issue> case the tester writes passes.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
featureWork bigger than a fix: designed with Don, built in stages (harnest R11)Work bigger than a fix: designed with Don, built in stages (harnest R11)owner:testerTester's turn to actTester's turn to actstageA child issue: one stage of a featureA child issue: one stage of a featurestatus:verifiedTester confirmed the fix via a real MCP callTester confirmed the fix via a real MCP calltarget:lem
Activity
dkackman commentedon Oct 15, 2026
Progress (claude-opus-5-5, anthropic): branch
feat/869-a-memory-key@ 575cff2 has the code -dw/server/host_ram_need.py(memory_key, projected_peak), thememory_keyhistory column +peaks_for_key, thehost_memory_projectionrefactor (projected_mb),Admission.host_ram_needthrough submit/rerun/enhance, and validate'splan.host_memory. Tests and docs remain, then merge, deploy and hand-off.feat(server): #909 - memory key and host_memory plan tests, docs
dkackman commentedon Oct 15, 2026
Hand-off (claude-opus-5-5, anthropic): stage A of #869 is merged and deployed.
Shipped:
feat/869-a-memory-keywas merged intodevelopas d2a7504 (commits 575cff2 and the tests/docs commit). The deploy reported[deploy] deployed develop @ d2a7504a, healthy after 5s.Plan items
memory_key TEXTcolumn with a migration. Added indw/server/job_history.pyviaALTER TABLEon open.record()writes it fromjob.spec["definition"]with the caller's arguments resolved. The key covers:pipeline_identityof every pipeline step;quantization_config/offload/group_offloadvalue.dw/server/host_ram_need.py.projected_peak(definition, arguments, history)returns:observed: the maxhost_memory_job_peak_rss_mbover successful same-key runs, withruns= their count;fit, fromhost_memory_projection.projected_mb;host_memory_projectionrefactor. The newprojected_mb()andhost_memory_warningsshare_projection(). The warning text is unchanged, andtest_host_memory_projection.pyis unchanged and passes.Admission.host_ram_need. Computed when admission is ok and threaded through submit, rerun and enhance intoJobManager.submit(stored asjob.host_ram_need). Dispatch does not read it.plan.host_memory. Shape is{projected_mb, basis, runs}, with the key absent when there is no figure. It is in the OpenAPI schema as an optionalPlanHostMemory.tests/test_host_ram_need.py).minimax/reference-to-video.weights_dtypeint4 vs int8, and for offload / group_offload.JobHistory.plan.host_memory == {projected_mb, basis:"observed", runs:1}.docs/WORKSPACES.md: new Host-memory history subsection under Runs. The "Dispatch is not yet aware of host RAM (bug: two int8 H3 jobs on two cards OOM-kill the host - dispatch is VRAM-aware only, and the earlier job was the one killed #869)" sentence is left for stage B.docs/MCP.md: thevalidate_workflowrow.docs/SERVER.md: the plan fields.Deviations
group_offloadis in the key along withoffload, because H3 templates spell offload that way.record(), so the two always match.runsreported forfitcounts this workflow's history rows that carry a numeric peak.observedappears only after one fresh successful run of a workflow.ui/src/lib/generated/schema also picked up a stale docstring line from get_gallery_metadata: kept asset reports inputs: null where its source output listed its input assets #902 that was already pending on develop.No existing MCP shape changed:
host_memoryis a new optional key, so this is not a breaking change.dkackman commentedon Oct 15, 2026
Architecture review queued by the loop driver: this hand-off changed
dw/ordw_mcp/ondevelop(581bfff963..d2a7504abc: dw/host_memory_projection.py dw/server/admission.py dw/server/api_models.py dw/server/host_ram_need.py dw/server/job_history.py dw/server/job_record.py dw/server/jobs.py dw/server/routes/jobs.py ). The reviewer checks it againstdocs/ARCHITECTURE.mdbefore the tester verifies.dkackman commentedon Oct 15, 2026
Architecture review (claude-opus-5-5, anthropic): bounced. Two findings.
I read
git diff 581bfff9..d2a7504a -- dw/(#909's 575cff2 plus the tests/docs commit). I checked it againstdocs/ARCHITECTURE.mdand the checklist in item 3 ofdocs/stabilization/harness/stage-c-guardrails.md.1. Second owner: reference prefixes and variable substitution.
dw/server/host_ram_need.py_substitutedresolvesvariable:references on its own. It writes the prefix as a literal (node.startswith("variable:"),node[len("variable:"):]).dw/references.py], and every other module goes through it". It is enforced by theprefix_literals/prefix_handlingratchets. Both are0indocs/stabilization/baseline.json, andscripts/arch_metrics.pymeasures all ofdw/. This change doesn't touch the baseline, so the ratchet should now be over it.dw/variables.pyreplace_variables. The single-value form isvram_estimate._resolved, built onreferences.ref_name(VARIABLE, …), which_foundalready uses."variable:x"string, where_resolvedgives None. So the memory key can differ from whatvram_inheritancereads for the same step.variables.replace_variables, catching its refusal so the key falls back to None, or throughreferences.ref_name/references.VARIABLE. Either way, the hand-written prefix goes away and the ratchet is back at 0.2. Map: new owner without a row.
dw/server/host_ram_need.pyis a new module. It owns the run's memory key (memory_key) and the projected host-RAM peak (projected_peak, with basis observed / fit).JobHistory.peaks_for_keyandAdmission.host_ram_needare its seams.docs/ARCHITECTURE.mdwas not changed in the range, and no row names host memory. The existing projection,dw/host_memory_projection.py, has no row either.dw/server/host_ram_need.py:memory_key,projected_peak(anddw/host_memory_projection.py:projected_mb). Give it the rule, e.g.: the key is pipeline identity + quantization/offload with arguments resolved, never the workflow's name; observed is the max over successful same-key runs, ahead of the fit; it projects and never refuses. Point it at its tests intests/test_host_ram_need.py.tests/test_architecture_map.pywill check the names.Nothing else found. Nothing in the change hand-rolls what a
pyproject.tomldependency already does (hashlib/json/sqlite3are stdlib, used directly). NoCLAUDE.mdlines were added. Admission still runs once (admit_foradds the projection afteradmit, andJobManager.submitdoesn't re-check). The engine→server import direction holds:host_ram_needis underdw/server. Using the privatevram_inheritance._foundfollows the plan, and it is calling the owner, not copying it.The issue carries
stage, so it goes toowner:lead. Finding 1 is a second-owner finding, so it blocks unless Don labels the issuearch-approved. Finding 2 is fixed in the same session either way.14 remaining items
dkackman commentedon Oct 15, 2026
Answer to the C-F488 bounce (claude-opus-5-5, anthropic): no code change. Stage A did not drop or re-threshold the warning. It is correctly silent at ~61.6 GB on lem. C-F488 and M-F029 expect a warning that the #243 rule never emits for this figure. They need an amendment, which is Don's to approve.
Why there is no warning.
host_memory_warnings(dw/host_memory_projection.py) warns only when the projection exceedsCEILING_FRACTION(0.9) × the machine's total RAM. This rule has been in place since No host memory budget modeling: for_each/composed workflows can SIGKILL on RAM, not just VRAM #243 (997121b).get_memoryreportshost_memory_total_mb: 128720, so the ceiling is ~115,848 MB.[]is the intended answer, at both 5 and 12 entries.What stage A changed in that path.
_projection, whichprojected_mb(the new figure) andhost_memory_warnings(the warning) now share. The warning's checks are unchanged: the ceiling comparison,_already_survived, and the text._host_memory_warningsindw/server/routes/jobs.pyhas not changed since 964b7b7.tests/test_host_memory_projection.pyis untouched, and it passes along withtests/test_host_ram_need.py(36 passed)._projection,plan.host_memory.projected_mbis by construction the figure a warning would quote when one fires.Also: a flat 61,566 from 5 to 12 entries is either the released shape (the largest single iteration) or the resident fit with its slope clamped at 0. In neither case does the text say "extrapolated from runs of 1 and 5 entries" with growth, which is the shape C-F488 assumed.
Proposed amendment (Don to approve; the tester writes it):
plan.host_memory.basis: "fit". Itsprojected_mbmatches the warning's figure if a host-memory warning is present. Below 0.9 ×host_memory_total_mb, no warning is expected.The other pending cases passed (C-F486, C-F489, the cancel arm of C-F490) or were skipped with no finding (C-F487). With the amendment, I expect the stage to verify as deployed, @ 0dce4cb or later on develop.
Next: Don approves or rejects the amendment. If he approves, the stage goes back to the tester (
owner:tester+status:fixed-pending-verify) with nothing to rebuild.dkackman commentedon Oct 15, 2026
Ruling (Don, via claude-opus-5-5 / anthropic): the C-F488 amendment is approved as the lead proposed it. No code change.
The lead is right.
host_memory_warningshas warned only aboveCEILING_FRACTION(0.9) × total RAM since #243. On lem that ceiling is ~115.8 GB and the projection is 61.6 GB, sowarnings: []is the correct answer. Stage A only lifted the shared_projectionout; the warning path andtests/test_host_memory_projection.pyare unchanged.Amended cases (the tester writes them):
plan.host_memory.basis: "fit". Itsprojected_mbmatches the warning's figure when a host-memory warning is present. Below 0.9 ×host_memory_total_mb, no warning is expected.Optional, not a blocker: if a run's projection can go above ~116 GB on lem, use it to exercise the warning arm.
Re-verify on develop @ 0dce4cb or later. Nothing needs rebuilding. To
owner:tester+status:fixed-pending-verify.dkackman commentedon Oct 15, 2026
Verify of stage A on develop @ f1bc2e9: verified. — claude-opus-5-5 via anthropic
Re-ran against the amended expectations Don approved above.
C-F488 (amended): pass. In
acorn-wars,validate_workflow(name="acorn-wars/shots-batch", arguments={shots:[…]})with every entry{name, prompt:"a squirrel guards an acorn", num_frames:158}:valid: true,plan.host_memory = {projected_mb: 61566, basis: "fit", runs: 7},warnings: [].warnings: [].The total is 128720 MB (
host_memory_total_mbin this session's job memory events), so the ceiling is ~115.8 GB. No warning is the amended expectation, and call 2's figure is no smaller than call 1's.C-F486 (the stage's own repro): pass, re-run on this deploy.
c-f486-t2i(text-to-image, seed 42). Before the run, validate gavehost_memory {3347, observed, runs: 6}.03df89422cec: succeeded in 14 s. The largesthost_memory_job_peak_rss_mbover its memory events is P = 3222.57. There is noqueue_waitevent and nowaiting_for.{projected_mb: 3347, basis: "observed", runs: 7}. That is ≥ P and under 2×P, and runs went up by one.host_memory.offload: "model"gives nohost_memorykey,valid: true, anddiffers: ["offload"].C-F487: partly skipped, no finding, as before.
weights_dtype: "int8"is stillvalid: truewith nohost_memory, since there is no quantized run since stage A.C-F489: pass (calls 1–2 re-run as a spot check). A task-only
qr_codeworkflow givesvalid: truewith a plan and nohost_memory, and the offload variant above has none either. Call 3 passed in the previous verify.C-F490: the cancel arm passed in the previous verify, on 0dce4cb (this stage's code). I didn't re-run it here.
Dispatch: unchanged. J1 started straight away with no host-RAM wait.
Suite edits:
pending: #909from C-F486–C-F490.host_memory_total_mb. Below that, no warning, and the figure isplan.host_memory.projected_mb.