Repository navigation
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: ready, awaiting a maintainer decision. What this changesThis PR assigns native declaration compilers a shared Go memory target while preserving explicit caller limits. Example: Two declaration workers share 24 GiB of effective available memory without a caller GOMEMLIMIT.
Review scores
ProductKind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Complete Merge readiness⏳ Ready, awaiting maintainer decision Keep open for maintainer disposition: a later merged fix addresses declaration-compiler memory on main, but this maintainer-engaged PR proposes a different policy and has confirmed conflicts. Priority: P2 Decision needed
Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe source-build wrapper prepares tsdown worker environments; native TypeScript children inherit those environments and return declarations to the existing staging and publication owner. flowchart LR
A[Source build command] --> B[Build plan]
C[Effective memory capacity] --> B
B --> D[Worker environments]
D --> E[Native TypeScript compilers]
E --> F[Staged declaration publication]
Technical reviewBest possible solution: Have the build owner confirm supersession by the shared policy on main before requesting any conflict repair or alternative memory policy. Do we have a high-confidence way to reproduce the issue? The historical failure has concrete compiler and cgroup traces, but this read-only review did not reproduce an OOM on current main after its later repair. Is this the best way to solve the issue? The proposed worker-environment approach is supported by real build evidence, but current main's shared compiler resource owner is the preferable place for any remaining repair. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 27a0be4a75d9. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceTests +114, Other +99. Total +213 across 5 files. Added test files: 1. View PR surface stats
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (7 earlier review cycles)
Reviewed October 27, 2026, 9:16 PM ET / October 28, 2026, 01:16 UTC (Revision 8). |
|
@emes If your Ubuntu KVM guest that normally runs with 10 GiB is available, could you run the current PR head The issue's focused command is: OPENCLAW_BUILD_CACHE=0 node --import ./scripts/tsx.mjs scripts/tsdown-build.mts --config tsdown.config.ts --filter openclaw-dts-baseThe useful evidence is: actual process/cgroup limit (for example No need to rerun the entire cold |
|
@clawsweeper re-review The remaining constrained-host proof is now in the PR body and in the green, secretless 10 GiB cgroup run (uploaded |
|
🦞👀 Re-review progress:
|
|
Ran the PR head
Sampled peaks, not exact kernel high-water marks. Redacted 1 s trace excerpt attached below. Two observations from this run:
For completeness: a full cold Redacted trace excerpt (every 20th sample plus the peak sample) |
|
@emes Thanks for the exact-head run and the trace. The 10 GiB declaration group completing without OOM is useful confirmation. Your 4005 MiB observation also exposes a real tradeoff: the current default can fall below the compiler's live graph when host The parallel case needs a correction before merge. Each concurrent declaration child currently receives 60% of the same budget, so the PR's claimed 40% reserve does not hold when staged concurrency is two. I'll account for the actual staged concurrency in the per-child budget, add a focused regression for that path, and revise the memory claim and proof limits. I'll check the capacity-versus-available choice against your measurements while doing that. The single-group 10 GiB result does not prove the parallel or full cold-build path. |
|
@clawsweeper re-review The PR body now includes measured standalone wall times for both test files changed by this PR on the reviewed head Morpheus, assisting Olli with this PR. |
|
🦞👀 Re-review progress:
|
|
I tested the full cold
Both builds completed There is also a real merge conflict: main replaced the emitter's managed compiler spawn with the async TS7 API. That API has no per-child @Olli0103, could you rebase onto the async API and confirm which documented host class reaches the staged declaration phase in a full cold build? On this 10 GiB class, runtime bundling is an earlier blocker. I am handing this off rather than expanding this declaration-memory fix into runtime bundling. The caller-override, complete |
|
@obviyus let me have a look |
726dea1 to
078fe92
Compare
|
@obviyus The rebase is on Run 37273712838 completed both full cold builds in a 13 GiB no-swap cgroup: automatic target in 825.829 s, explicit Two nonempty canonical extension partitions through the same staged writer also passed with two overlapping async children, each inheriting Runtime smoke 37278655660 passed built CLI/status and isolated Gateway readiness/liveness with graceful shutdown. The earlier readiness failure was the proof script expecting The full proof workflow remains red: Maintainer handoff: please validate full check/test on the supported non-root, network-capable CI route and, if required, default-heap parallel admission on a larger host. The requested async-child, override, output and lowered-heap overlap evidence is now available for re-review. No production Gateway changes or merge were made. |
What Problem This Solves
Cold source builds can exhaust memory during native TypeScript 7 declaration emission. Node's heap setting does not bound the Go compiler child. A per-child Go target must also account for declaration groups admitted concurrently.
User Impact
Source builders get an availability-sensitive soft Go memory target for declarations. Explicit caller
GOMEMLIMITremains authoritative. There is no runtime or configuration migration.Implementation
Rebased onto
c3b2b7d3fc1a053d2f6907e55e1629c16fc53706; current candidate is078fe921e196b2255dfc228d4834fce5f5e58a97.--concurrency.GOMEMLIMITis soft and excludes non-Go memory; the remaining 40% is a sizing allowance, not a guaranteed RSS reserve. This is a declaration-memory fix, not a claim that a full cold build fits 10 GiB. Runtime-bundling concurrency remains separate in #157739, as obviyus's review identified.Evidence
git diff --checkpassed.reviewer_unavailableafter authentication failed; it did not produce a passing review.Current-head real behavior proof
Candidate
078fe921e196b2255dfc228d4834fce5f5e58a97, Linux x64, Node 24.21.0, pnpm 12.5.1, TypeScript 7.1.0-dev.20260920.1. Each cell used a disposable no-swap cgroup. The detector matched the exact installed compiler path and SHA-256, not a basename assumption. This package's executable is namedtsc; the actual declaration children used--api --async.Full proof run 37273712838, harness
1775a5b280cc88848d70593de3a2d977aededf95:pnpm build, 13 GiBpnpm build, callerGOMEMLIMIT=6GiB, 13 GiB6GiB3993MiBThe parallel cell used the same staged declaration writer and explicitly reduced Node heaps to 5120 MiB, admitting two nonempty canonical extension partitions. It observed both compiler children from 5.416 s until approximately 159 s. It is not proof of default-heap parallel admission on a larger host.
All three cells recorded zero OOM/OOM-kill deltas, zero container swap use, no timeouts and no lingering sampled workers. Compiler RSS is distinct from the soft Go target; the parallel aggregate sampled compiler RSS peaked at approximately 9.324 GiB.
Complete output comparison covered 24,654 entries across 19 roots, including 647 declaration files. File inventories and hashes matched except the two timestamp-bearing build-stamp files. Only
dist/.buildstamp'sbuiltAtanddist/.runtime-postbuildstamp'ssyncedAtwere normalized; all raw hashes and both named differences are retained incomparison.json. There were no unexplained differences. This is not a claim of raw byte-for-byte identity of timestamps.Focused run 37271810502 separately passed the base declaration group in a 10 GiB no-swap cgroup, 80.538 s, 7.558 GiB cgroup peak, observed async child
GOMEMLIMIT=6142MiB, zero OOM/OOM-kill events.Runtime-only smoke recovery 37278655660, same candidate and harness
b184981251648f2e807758f708f46a6be1a58846, passed built CLI version, built status-runtime tests, isolated loopback Gateway/readyzwithready=trueand/healthzwithok=true, then graceful shutdown. The earlier smoke asserted the wrong readiness JSON field and is retained as a failed harness attempt. The recovery did not repeat declarations or the memory proof.Full-suite limitations
The full proof workflow is failed, not an all-green validation claim. Its contained
pnpm checkandpnpm testboth reached their 2700 s deadline and were terminated. Both recorded zero OOM/OOM-kill deltas.checkalso failed the SQLite-worker guard becausergwas absent, and the max-lines guard reported a stale baseline entry. Its 104-package lock validation did not complete.testrecorded assertion failures before termination, including root-user refusal and a GitHub fetch failure in the network-disabled container. These logs do not establish that every failure is environmental or base-side; no passing full suite or exact-base reproduction is claimed.Full check/test clearance requires a suitably provisioned non-root, network-capable validation route and classification of remaining assertion failures. No full build or memory stress was run on the production Mac mini.
Historical Evidence and Remaining Limits
Run 36148840191 passed a single cold declaration group on old head
726dea10b3e54389935e0c27744d2cfc35763dd5inside a 10 GiB no-swap cgroup. That predates main's async emitter and is not current-head or full-build proof. Earlier contributor measurements and run 36108835114 are historical for the same reason.The standard runner is not a 24 GiB host. A separately labeled lowered-Node-heap parallel cell can demonstrate shared worker environments, but cannot establish default-heap parallel admission on a larger host. Current-head full
pnpm buildhas passed. Fullpnpm checkandpnpm testhave not passed on the disposable proof host; their failed logs and deadlines are described above. No unconditional 6 GiB or 10 GiB full-build claim is made.Closes #157783