[PR #1493] [Engine] Add opt-in memory relief and supervised tool resource leases #3488

Open
opened 2026-11-07 14:41:49 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/1493
Author: @midhatn
Created: 10/8/2026
Status: 🔄 Open

Base: main ← Head: codex/adaptive-background-draft


📝 Commits (10+)

  • 9fe6721 Port opt-in live memory controls from PR #726
  • a1f003d Harden live-memory port and add shadow co-adaptive policy research
  • 1ab0323 Add native capacity feedback and measured adaptive routing gates
  • b20e1e4 fix: separate running VRAM targets from fitting reserves
  • 9d8848d docs: record adaptive memory and agent acceptance limits
  • f154e3e feat: yield at native safe points for bounded background control
  • ef13aba perf: sample Windows workload counters in one bounded snapshot
  • 15e7234 feat: park active text requests under sustained memory pressure
  • a67718d docs: publish scoped adaptive acceptance and implementation provenance
  • a3b0eca Merge remote-tracking branch 'origin/main' into codex/adaptive-background-draft

📊 Changes

122 files changed (+23872 additions, -180 deletions)

View changed files

➕ .github/workflows/ci.yml (+81 -0)
📝 CMakeLists.txt (+34 -0)
➕ bench/results/2026-10-05-live-memory-integration/README.md (+105 -0)
➕ bench/results/2026-10-05-live-memory-integration/measurements.json (+699 -0)
➕ bench/results/2026-10-08-adaptive-background/README.md (+326 -0)
➕ bench/results/2026-10-08-adaptive-background/foreground_work.cpp (+67 -0)
➕ bench/results/2026-10-08-adaptive-background/near64k_fixture.py (+49 -0)
➕ bench/results/2026-10-08-adaptive-background/request-fixtures.json (+42 -0)
➕ bench/results/2026-10-08-adaptive-background/results.json (+782 -0)
➕ bench/results/2026-10-08-adaptive-background/runtime-settings.json (+29 -0)
➕ bench/results/2026-10-08-adaptive-background/unique_sorted_checks.cpp (+27 -0)
➕ bench/results/2026-10-08-adaptive-background/vision-fixture.png (+0 -0)
➕ bench/results/2026-10-08-idle-pressure/README.md (+110 -0)
➕ bench/results/2026-10-08-idle-pressure/results.json (+169 -0)
➕ bench/results/2026-10-09-supervisor-handoff/README.md (+163 -0)
➕ bench/results/2026-10-09-supervisor-handoff/supervisor-result.json (+123 -0)
➕ bench/results/2026-10-10-pressure-prefill/hermes-pressure-prefill-attempt01-audit.json (+59 -0)
➕ bench/results/2026-10-10-pressure-prefill/pressure-prefill-component-results.json (+269 -0)
➕ bench/results/2026-10-10-resident-handoff/README.md (+320 -0)
➕ bench/results/2026-10-10-resident-handoff/component-results.json (+453 -0)

...and 80 more files

📄 Description

Problem and result

Local agents need memory for compilers and GPU tools between model calls. This opt-in draft lets a supervisor declare that work, request resident relief or confirmed inference unload, and return after a fresh capacity check. Sustained external pressure can also trigger relief. Uncertain execution or teardown keeps the ownership barrier in place instead of repeating a tool or regrowing inference over it.

This remains a draft. Current head is 06ba725d8b9bb42b457302f71dd85204e9760c32, incorporating upstream v0.2.3.1 without rewriting the earlier public history. The earlier native executable qualification below applies to a69684f1; b580e627 recorded that result, and 06ba725d adds the Python routing correction described below. Native sources are unchanged. Reopening after the tracker reset did not mark the feature ready for review.

This continues #1493 following the tracker-reset invitation. The reset was not a technical rejection or approval of the scope; no separate maintainer scope agreement is recorded here. The allocator foundation is medking82's #726. The engine-independent Hermes terminal authorization seam is Hermes #135418. The separate Windows token-default correction is #3399.

Approach

Reuse the existing live RAM blocks, GPU VMM cache, acknowledged memory protocol and server lifecycle/FIFO. An authenticated loopback lease separates admission, execution, renewal and release; a supervisor grants tool profiles and runtime-identified workers share one broker. Physical RAM, commit headroom and native GPU headroom are checked separately. The feature is opt-in; unsupported combinations refuse startup rather than bypassing adaptive ownership. Capacity is observed, not reserved by the OS.

The upstream merge retains current vision diagnostics, tool-picture handling, drafting configuration and web API-key behavior while preserving adaptive admission and confirmed process shutdown. Startup validation uses effective user arguments. Protocol and limits and implementation provenance retain behavior and attribution. The private disk checkpoint bank and the newer local Python scheduling experiment are excluded.

Validation

Passed:

  • Head 06ba725d: correct delivery of the coadaptive route through the existing native request serializer's strata_tune.pcie_frac field. Explicit nested values, including zero, take precedence and other tuning values remain intact. The new actual-Service/serializer regression fails on preceding public b580e627 (three tests, four failed subtest/assertion results). After the nine-line production correction, all 46 focused routing/coadaptive tests pass. These are CPU/fake-engine checks, not new model or native-build qualification. The independent Windows token-rights fix #3399 and the larger scheduling/learner experiment remain excluded.

  • Exact source a69684f1f2609da46c82f9719d5159f5f9b307dc: Windows CUDA 13.4, MSVC 14.44.35207, architecture 89, portable Release build. All 183 build steps completed with one worker in 961.907s. All 13 native utility, protocol and parity programs exited zero, including live_memory_test --protocol-only. No model was started. Configure, build, tests and outer worker exited zero; all 1,638 retained process handles signaled exit and owned cleanup was verified. The strata.exe SHA-256 is 744205e4e024b5cbba19e4b560678ffe21e6899e59050929f7af51557f3c6198.

  • Resolved upstream merge e1242813 (upstream 7ddc17a3, source tree b37e52d2): 14 focused server/web modules, 188 collected, 187 passed, one optional jsonschema skip, in 39.078s including wrapper overhead. A separate terminal drafting run passed 40 tests in 7.746s. The current report lists commands, module counts, exact identities, cleanup scope and the compact native receipt.

  • Earlier v0.2.2 source 037314f9 plus the five-line test-only synchronization committed as e39dbb99: python -B -m unittest serve.test_idle_parking_service -v, 42 passed in 4.920s. The client could receive its response before the server's finally released preparation ownership; the bounded wait preserves the original assertions. This focused pass does not replace the failed complete run below.

Historical v0.1.45 results remain in the original revision-specific report. They are not counted as current-head passes.

Failed:

  • The complete server run on v0.2.2 source 037314f9 executed 1,402 tests with two failures, one error and 21 skips. One failure was the corrected idle fixture ordering. The remaining failure/error reproduce on exact unmodified upstream v0.2.2 after adopt_user_defaults(): readable child identity and its ownership record fail. The same three selected lifeline tests pass on plain upstream and with only default-token DACL FA changed to GA. This is tracked separately in #3399; the patch is not folded into this PR. The original complete run remains failed.
  • Two preliminary merge-validation harness runs stopped at child-handle observation after upstream token adoption denied the required observer rights. Their owned jobs emptied; neither is counted as a pass. The final module-isolated checks and the narrower terminal cleanup scope are recorded separately in the report.

Not run:

  • HIP, SYCL and Metal build/hardware qualification. The successful CUDA compile and CPU/protocol checks do not substitute for other backends or live GPU cache resizing under a model.
  • A public-only real-model lease/compiler/reload workflow, arbitrary detached-tool containment, visible Desktop/media acceptance and complete normal-history continuation. Private combined-runtime results contain additional code and do not qualify this PR.
  • A new complete server-suite pass after the fixture correction, or current-head CI results inferred from historical runs.

Limits

All touched-backend builds remain required before requesting review; this PR stays draft while those checks and scope review are unfinished. It targets a single engine; finite execution workspace and races with unrelated allocations remain. There is no universal no-OOM, uninterrupted-progress, foreground-performance or speedup claim. Prepared with Codex; contributor responsibility, authorship and license notices are retained.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/1493 **Author:** [@midhatn](https://github.com/midhatn) **Created:** 10/8/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `codex/adaptive-background-draft` --- ### 📝 Commits (10+) - [`9fe6721`](https://github.com/Niko1221/Strata/commit/9fe672186f21c9d87904c691d12a3de1ded64b20) Port opt-in live memory controls from PR #726 - [`a1f003d`](https://github.com/Niko1221/Strata/commit/a1f003dea61174ab8def538ec76f431edce80e15) Harden live-memory port and add shadow co-adaptive policy research - [`1ab0323`](https://github.com/Niko1221/Strata/commit/1ab032311617996c4b378cbe8d9dd779c5d552cc) Add native capacity feedback and measured adaptive routing gates - [`b20e1e4`](https://github.com/Niko1221/Strata/commit/b20e1e489db23ea90c15b2f4a2ab8e798d13bb24) fix: separate running VRAM targets from fitting reserves - [`9d8848d`](https://github.com/Niko1221/Strata/commit/9d8848d9b7e28dcc77bc3bcda6a3b670b264d5d7) docs: record adaptive memory and agent acceptance limits - [`f154e3e`](https://github.com/Niko1221/Strata/commit/f154e3e23c37376a03ddda41ec6d8cf04683e7c7) feat: yield at native safe points for bounded background control - [`ef13aba`](https://github.com/Niko1221/Strata/commit/ef13aba3be5264895f01ebeba8b5890d30397b28) perf: sample Windows workload counters in one bounded snapshot - [`15e7234`](https://github.com/Niko1221/Strata/commit/15e7234eda2c96175bd581928dea4237d67adbea) feat: park active text requests under sustained memory pressure - [`a67718d`](https://github.com/Niko1221/Strata/commit/a67718d728e21fac48cc21596667f7a4f5975831) docs: publish scoped adaptive acceptance and implementation provenance - [`a3b0eca`](https://github.com/Niko1221/Strata/commit/a3b0eca2fc8ea210c8d408e932a936d52da228f6) Merge remote-tracking branch 'origin/main' into codex/adaptive-background-draft ### 📊 Changes **122 files changed** (+23872 additions, -180 deletions) <details> <summary>View changed files</summary> ➕ `.github/workflows/ci.yml` (+81 -0) 📝 `CMakeLists.txt` (+34 -0) ➕ `bench/results/2026-10-05-live-memory-integration/README.md` (+105 -0) ➕ `bench/results/2026-10-05-live-memory-integration/measurements.json` (+699 -0) ➕ `bench/results/2026-10-08-adaptive-background/README.md` (+326 -0) ➕ `bench/results/2026-10-08-adaptive-background/foreground_work.cpp` (+67 -0) ➕ `bench/results/2026-10-08-adaptive-background/near64k_fixture.py` (+49 -0) ➕ `bench/results/2026-10-08-adaptive-background/request-fixtures.json` (+42 -0) ➕ `bench/results/2026-10-08-adaptive-background/results.json` (+782 -0) ➕ `bench/results/2026-10-08-adaptive-background/runtime-settings.json` (+29 -0) ➕ `bench/results/2026-10-08-adaptive-background/unique_sorted_checks.cpp` (+27 -0) ➕ `bench/results/2026-10-08-adaptive-background/vision-fixture.png` (+0 -0) ➕ `bench/results/2026-10-08-idle-pressure/README.md` (+110 -0) ➕ `bench/results/2026-10-08-idle-pressure/results.json` (+169 -0) ➕ `bench/results/2026-10-09-supervisor-handoff/README.md` (+163 -0) ➕ `bench/results/2026-10-09-supervisor-handoff/supervisor-result.json` (+123 -0) ➕ `bench/results/2026-10-10-pressure-prefill/hermes-pressure-prefill-attempt01-audit.json` (+59 -0) ➕ `bench/results/2026-10-10-pressure-prefill/pressure-prefill-component-results.json` (+269 -0) ➕ `bench/results/2026-10-10-resident-handoff/README.md` (+320 -0) ➕ `bench/results/2026-10-10-resident-handoff/component-results.json` (+453 -0) _...and 80 more files_ </details> ### 📄 Description ## Problem and result Local agents need memory for compilers and GPU tools between model calls. This opt-in draft lets a supervisor declare that work, request resident relief or confirmed inference unload, and return after a fresh capacity check. Sustained external pressure can also trigger relief. Uncertain execution or teardown keeps the ownership barrier in place instead of repeating a tool or regrowing inference over it. **This remains a draft. Current head is `06ba725d8b9bb42b457302f71dd85204e9760c32`, incorporating upstream v0.2.3.1 without rewriting the earlier public history.** The earlier native executable qualification below applies to `a69684f1`; `b580e627` recorded that result, and `06ba725d` adds the Python routing correction described below. Native sources are unchanged. Reopening after the tracker reset did not mark the feature ready for review. ## Related discussion This continues #1493 following the [tracker-reset invitation](https://github.com/Niko1221/Strata/pull/1493#issuecomment-6272336034). The reset was not a technical rejection or approval of the scope; no separate maintainer scope agreement is recorded here. The allocator foundation is medking82's #726. The engine-independent Hermes terminal authorization seam is [Hermes #135418](https://github.com/NousResearch/hermes-agent/pull/135418). The separate Windows token-default correction is #3399. ## Approach Reuse the existing live RAM blocks, GPU VMM cache, acknowledged memory protocol and server lifecycle/FIFO. An authenticated loopback lease separates admission, execution, renewal and release; a supervisor grants tool profiles and runtime-identified workers share one broker. Physical RAM, commit headroom and native GPU headroom are checked separately. The feature is opt-in; unsupported combinations refuse startup rather than bypassing adaptive ownership. Capacity is observed, not reserved by the OS. The upstream merge retains current vision diagnostics, tool-picture handling, drafting configuration and web API-key behavior while preserving adaptive admission and confirmed process shutdown. Startup validation uses effective user arguments. [Protocol and limits](https://github.com/midhatn/Strata/blob/b580e6270c0e8d2756b0ca9e15cbed4e57ba21ab/docs/TOOL_RESOURCE_LEASES.md) and [implementation provenance](https://github.com/midhatn/Strata/blob/b580e6270c0e8d2756b0ca9e15cbed4e57ba21ab/docs/ADAPTIVE_PROVENANCE.md) retain behavior and attribution. The private disk checkpoint bank and the newer local Python scheduling experiment are excluded. ## Validation **Passed:** - Head `06ba725d`: correct delivery of the coadaptive route through the existing native request serializer's `strata_tune.pcie_frac` field. Explicit nested values, including zero, take precedence and other tuning values remain intact. The new actual-Service/serializer regression fails on preceding public `b580e627` (three tests, four failed subtest/assertion results). After the nine-line production correction, all **46 focused routing/coadaptive tests pass**. These are CPU/fake-engine checks, not new model or native-build qualification. The independent Windows token-rights fix #3399 and the larger scheduling/learner experiment remain excluded. - Exact source `a69684f1f2609da46c82f9719d5159f5f9b307dc`: Windows CUDA 13.4, MSVC 14.44.35207, architecture 89, portable Release build. All 183 build steps completed with one worker in 961.907s. All 13 native utility, protocol and parity programs exited zero, including `live_memory_test --protocol-only`. No model was started. Configure, build, tests and outer worker exited zero; all 1,638 retained process handles signaled exit and owned cleanup was verified. The `strata.exe` SHA-256 is `744205e4e024b5cbba19e4b560678ffe21e6899e59050929f7af51557f3c6198`. - Resolved upstream merge `e1242813` (upstream `7ddc17a3`, source tree `b37e52d2`): 14 focused server/web modules, **188 collected, 187 passed, one optional `jsonschema` skip**, in 39.078s including wrapper overhead. A separate terminal drafting run passed **40 tests in 7.746s**. The [current report](https://github.com/midhatn/Strata/blob/b580e6270c0e8d2756b0ca9e15cbed4e57ba21ab/bench/results/2026-10-23-adaptive-022/README.md) lists commands, module counts, exact identities, cleanup scope and the [compact native receipt](https://github.com/midhatn/Strata/blob/b580e6270c0e8d2756b0ca9e15cbed4e57ba21ab/bench/results/2026-10-23-adaptive-022/native-validation.json). - Earlier v0.2.2 source `037314f9` plus the five-line test-only synchronization committed as `e39dbb99`: `python -B -m unittest serve.test_idle_parking_service -v`, **42 passed in 4.920s**. The client could receive its response before the server's `finally` released preparation ownership; the bounded wait preserves the original assertions. This focused pass does not replace the failed complete run below. Historical v0.1.45 results remain in the [original revision-specific report](https://github.com/midhatn/Strata/blob/667deb1594ffd975b83f2b8e9c2da3beaf34e439/bench/results/2026-10-18-adaptive-0145/README.md). They are not counted as current-head passes. **Failed:** - The complete server run on v0.2.2 source `037314f9` executed **1,402 tests with two failures, one error and 21 skips**. One failure was the corrected idle fixture ordering. The remaining failure/error reproduce on exact unmodified upstream v0.2.2 after `adopt_user_defaults()`: readable child identity and its ownership record fail. The same three selected lifeline tests pass on plain upstream and with only default-token DACL `FA` changed to `GA`. This is tracked separately in #3399; the patch is not folded into this PR. The original complete run remains failed. - Two preliminary merge-validation harness runs stopped at child-handle observation after upstream token adoption denied the required observer rights. Their owned jobs emptied; neither is counted as a pass. The final module-isolated checks and the narrower terminal cleanup scope are recorded separately in the report. **Not run:** - HIP, SYCL and Metal build/hardware qualification. The successful CUDA compile and CPU/protocol checks do not substitute for other backends or live GPU cache resizing under a model. - A public-only real-model lease/compiler/reload workflow, arbitrary detached-tool containment, visible Desktop/media acceptance and complete normal-history continuation. Private combined-runtime results contain additional code and do not qualify this PR. - A new complete server-suite pass after the fixture correction, or current-head CI results inferred from historical runs. ## Limits All touched-backend builds remain required before requesting review; this PR stays draft while those checks and scope review are unfinished. It targets a single engine; finite execution workspace and races with unrelated allocations remain. There is no universal no-OOM, uninterrupted-progress, foreground-performance or speedup claim. Prepared with Codex; contributor responsibility, authorship and license notices are retained. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#3488
No description provided.