Repository navigation
fix(memory): reduce constrained Gateway startup pressure - #197801
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: stale review; fresh review needed. Summary Next step Review history (1 earlier review cycle)
|
|
886ef57 to
ea56dc2
Compare
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…7801) * fix(memory): reclaim constrained process headroom earlier * docs(memory): clarify constrained process retirement threshold * fix(gateway): narrow reply runtime prewarm imports * fix(memory): retain early reclamation with narrow startup imports * fix(memory): defer unused Gateway reply and CLI runtimes * test(gateway): preserve reply helpers in startup mocks * fix(memory): serialize startup publication reads * test(gateway): remove redundant shared reply mocks * fix(memory): defer Gateway secret providers until needed * test(gateway): document provider import isolation * fix(memory): defer disk scan ownership imports until needed * fix(memory): defer agent runtime imports until first use * fix(memory): keep CLI inspection and cleanup demand-loaded * fix(cli): preserve lightweight service inspection boundaries * fix(gateway): defer optional work under memory pressure * test(gateway): report unexpected startup cleanup failures * fix(gateway): load skill archive runtimes on demand * fix(gateway): defer cron agent execution runtimes * fix(gateway): defer exec reviewer completion runtime * fix(ci): include identity protocol in PR wrapper closure * fix(build): compact runtime source without losing module origins * fix(build): skip declaration chunks when compacting module labels * fix(workers): collect small heaps after first idle period * revert: drop unproven first-idle worker collection * perf(skills): defer status readers during discovery * fix: load cron readers only for cron state queries * fix: load the OpenAI SDK only for model requests
* test(qa): find built Gateway chunks by exported bindings The Telegram model-picker replacement proof located its hashed dist chunks by whitespace-sensitive export text. #197801 (d8eca04) switched the build to compact codegen, so chunks now read `export{startGatewayServer,truncateCloseReason}` and the markers no longer match: the case failed with "Could not resolve built prepared-model-runtime- module" before starting a Gateway. Parse the candidate chunks and match the names the bootstrap script imports, so formatting, export order and unrelated exports no longer decide which module is found. Product behavior is unchanged; the case passes again with its assertions untouched. * test(qa): read the whole current turn in timeout-recovery mock The mock provider in the timeout-recovery subagent proof treated the last Responses input item as the current turn. #198100 (bf0b800) pins the system prompt on every route and appends prompt updates after the turn's input, so the completion event was no longer last. The mock answered the delivery turn as a plain retry and the reply sequence assertion failed, although the Gateway still delivered the child completion once. Read everything after the previous assistant reply, the same rule #198177 applied to the other subagent prompt tests. Assertions are unchanged.
* test(qa): find built Gateway chunks by exported bindings The Telegram model-picker replacement proof located its hashed dist chunks by whitespace-sensitive export text. openclaw#197801 (2721e3d) switched the build to compact codegen, so chunks now read `export{startGatewayServer,truncateCloseReason}` and the markers no longer match: the case failed with "Could not resolve built prepared-model-runtime- module" before starting a Gateway. Parse the candidate chunks and match the names the bootstrap script imports, so formatting, export order and unrelated exports no longer decide which module is found. Product behavior is unchanged; the case passes again with its assertions untouched. * test(qa): read the whole current turn in timeout-recovery mock The mock provider in the timeout-recovery subagent proof treated the last Responses input item as the current turn. openclaw#198100 (709602d) pins the system prompt on every route and appends prompt updates after the turn's input, so the completion event was no longer last. The mock answered the delivery turn as a plain retry and the reply sequence assertion failed, although the Gateway still delivered the child completion once. Read everything after the previous assistant reply, the same rule openclaw#198177 applied to the other subagent prompt tests. Assertions are unchanged.
11.10 builds with minify codegen (openclaw/openclaw#197801): no whitespace inside code, one-line //! module labels instead of //#region pairs, short local names. Every patch keeps its 11.9 behaviour and its exact-once anchors; the anchors now match both the spaced (<= 2026.11.9) and compacted shapes, or a 2026.11.10 branch does. 11.10 is cut from main, not from the 11.x line: release-gated name tables carry explicit 11.10 entries. The chain passes all 24 patch and test steps on 2026.11.10 and on 2026.11.9. Ported by Codex (gpt-6.2-astra); spawn-target-owned-mcp's compact branch by ALINA. Co-Authored-By: Claude Opus 5.5 <[email protected]>
11.10 builds with minify codegen (openclaw/openclaw#197801): no whitespace inside code, one-line //! module labels instead of //#region pairs, short local names. Every patch keeps its 11.9 behaviour and its exact-once anchors; the anchors now match both the spaced (<= 2026.11.9) and compacted shapes, or a 2026.11.10 branch does. 11.10 is cut from main, not from the 11.x line: release-gated name tables carry explicit 11.10 entries. The chain passes all 24 patch and test steps on 2026.11.10 and on 2026.11.9. Ported by Codex (gpt-6.2-astra); spawn-target-owned-mcp's compact branch by ALINA. Co-Authored-By: Claude Opus 5.5 <[email protected]>
What Problem This Solves
Memory-constrained Gateways load unused runtimes during startup and can run out of memory before their first agent reply.
User Impact
Defer optional execution and skill-status runtimes until their owning operation needs them, and emit smaller runtime JavaScript while preserving names, module provenance, update recovery and standalone code generation.
This is an incremental startup-memory improvement, not Cardputer qualification. The 768 MiB service still OOMs before its first reply; the original issue remains open for follow-up.
Why This Change Was Made
No new configuration, dependency, persistence contract or cleanup owner is added. Net runtime production growth is 60 lines; net test/helper growth is 400 lines against the 400-line allowance, without allocation credit or an allocation file.
Evidence
Current candidate:
333572898b080f5c6082d7da8d1a42b49eae1ef2, based ond90d52cc. Current-head native packaging, ARM construction and image qualification pass. The original-cap runtime still fails as detailed below.d90d52cc..33357289inspected all 88 files and found no actionable correctness or security regressions. Current-head native packaging passes (241.35s, 11 joined commands), ARM64 construction passes (59.59s, 21 joined commands), and immutable-image/native-module checks pass (10 joined commands). The source checkout is clean.ca062042, with main parenta83f7437. The admission and invalid-profile assertions inherit #197978: the unchanged logger now createsstateDir/logs; test data and the logger are identical to the actual main parent. Stored config, database and credential hashes remain unchanged.python. Landing uses the native attributed-CI exception under the operator's standing instruction, with these failures retained rather than marked green.Physical-device readiness still requires a real OpenAI
CARDPUTER_GATEWAY_OKresponse and 60-second healthy soak, with a 1 GiB outer limit, 768 MiB service limit, one CPU, original 256 MiB old-space / 4 MiB semi-space flags, zero swap/OOM/restarts, and outer peak at most 928 MiB. Larger diagnostic runs do not satisfy that gate.Related: #192547