feat(proxy): lazy memory embedder warmup + /debug/rss endpoint (memory-arch-v2) - #623
feat(proxy): lazy memory embedder warmup + /debug/rss endpoint (memory-arch-v2)#623neogenix wants to merge 3 commits into
Conversation
e6a1745 to
dc1915d
Compare
|
Thanks. The skip-warmup option and Please rebase/update against current Once the resolved branch is green, this should be worth a focused review. |
dc1915d to
c6574f0
Compare
|
Thanks for the follow-up. The latest branch is still dirty and lint is failing, so it needs another refresh before final review. Please rebase/update against current |
JerrettDavis
left a comment
There was a problem hiding this comment.
This is not merge-ready in its current state. The branch is DIRTY against current main, the checks are from June 10, and the latest CI already had a failing lint job on this head. Since this PR changes headroom/proxy/server.py and adds a debug endpoint / warmup behavior, it needs a clean current-base CI run before the behavior can be reviewed confidently.\n\nPlease merge or rebase current headroomlabs/main, remove the manual changelog edit, fix the lint failure, and rerun the focused memory-arch tests plus the normal proxy CI.
|
Conflict audit against current A current port should add a validated lazy-warmup setting to that lifecycle, ensure the status endpoint distinguishes intentionally deferred from unavailable/failed, and test first-request initialization/concurrency. Restoring the old 140-line server change or dropping the debug half would either regress current observability or alter stated scope. Deferred for that focused port. |
c6574f0 to
49c5ad1
Compare
PR governanceThis PR does not yet satisfy the required template fields:
Please update the PR body, or move the PR back to draft while it is still in progress. |
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
JerrettDavis
left a comment
There was a problem hiding this comment.
Re-review after current-main reconciliation: conflicts are resolved, the manual changelog edit is removed, formatting/lint pass, and the focused memory/startup suites pass. The port also preserves default eager warmup while making peak RSS cross-platform and avoiding forced GC from the debug endpoint.
|
A related unbounded-retention path was reproduced while auditing current
Would it make sense for this endpoint to expose bounded aggregate diagnostics such as:
Aggregate/max counts should be enough; no session identifiers or content hashes need to be exposed. This would help distinguish worker-count/session-count growth from unbounded per-session bookkeeping, and Python-heap growth from native/allocator RSS high-water behavior. |
# Conflicts: # headroom/proxy/server.py
JerrettDavis
left a comment
There was a problem hiding this comment.
Re-reviewed and maintained the latest source against current upstream main. The conflict resolution keeps /debug/rss loopback-only and preserves main's added same-origin protection on /cache/clear. I also corrected the optional POSIX resource-module typing exposed by the Windows pre-commit gate without changing runtime behavior. Exact merged-tree verification: 136 memory/debug/loopback tests passed, targeted Ruff passed, focused mypy passed, and the full merge pre-commit hooks passed. The branch is now mergeable; remote CI is running. No blocking code finding.
Description
Adds opt-in lazy loading for the memory embedder and a loopback-only RSS diagnostic endpoint. This reconciles the original memory-architecture-v2 work with the current cross-platform memory tracker and avoids forcing garbage collection from a request handler.
Closes #
Type of Change
Changes Made
HEADROOM_SKIP_MEMORY_WARMUPas an explicit opt-in; eager warmup remains the default.GET /debug/rsswith current RSS, best-effort cross-platform peak RSS, GC/object statistics, model/cache counters, and warmup status.MemoryTrackerfor current process and component statistics.resourcemodule is unavailable.gc.collect()from the endpoint.Testing
pytest)ruff check .)mypy headroom)Test Output
Focused mypy found no new error in this change after the diagnostic snapshot annotations were corrected; four pre-existing
server.pyerrors remain outside this PR.Real Behavior Proof
/debug/rssfrom loopback and a non-loopback peer; start proxies with the skip flag set to each supported truthy value and with it unset.Review Readiness
Checklist
CHANGELOG.md— it is generated by release-please from my Conventional Commit PR title (a CI guard enforces this)Screenshots (if applicable)
N/A — this changes proxy startup behavior and a JSON diagnostics endpoint; there is no graphical UI.
Additional Notes
peak_rss_mbisnullon platforms withoutresource;rss_mbremains available through the current cross-platform tracker.hnsw_elementsis currentlynullbecause current per-user vector indexes are not globally enumerable without reaching into backend-private state.