Repository navigation
perf(tooling): stream native declaration outputs - #160207
vincentkoc wants to merge 1 commit into
Conversation
|
Codex review: blocked before merge. Reviewed September 28, 2026, 2:50 AM ET / 06:50 UTC (Revision 2). ClawSweeper reviewWhat this changesThe branch stages native TypeScript declaration output through a filesystem callback, then loads the sealed text for SDK preparation and package builds. Merge readiness⛔ Blocked before merge - 6 items remain Keep this targeted optimization open. Current main still collects native declaration output in memory, and the branch offers a distinct staged-output path. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw tooling compiles TypeScript declarations from project files and compiler settings. SDK preparation and package builds consume the resulting declarations and own final artifact publication. flowchart LR
A[Project files and settings] --> B[Native compiler]
B --> C[Output path check]
C --> D[Private staging]
D --> E[Compiler exit and input seal]
E --> F[Declaration text map]
F --> G[SDK and package builds]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceTests +105, Other +23. Total +128 across 4 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the single compiler and private staging boundary, correct the tooling guide, qualify a matched cold SDK workload and test-file cost, then review the retargeted branch after its prerequisite lands. Do we have a high-confidence way to reproduce the issue? No high-confidence reproduction of the host-memory failure and recovery is available here. Source confirms current main's whole-output collection, while the reported constrained full SDK run still exits 137. Is this the best way to solve the issue? Yes for the identified retention path: callback staging is a focused change that preserves the compiler and final publication owner. Its effect on the constrained SDK workload still needs measurement. Full review comments:
Overall correctness: patch is correct AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against e7d6bd8fab28. LabelsLabel changes: No label changes. Label justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
Outcome
Closed without landing: the full SDK comparison did not justify this optimization.
Matched ABBA runs on one Linux worker, identical pinned install and 7 GiB kernel scopes: baseline 90.849/101.085 seconds and 6,894,493,696/6,752,440,320 peak bytes; callback emission 107.297/100.952 seconds and 6,784,827,392/6,727,839,744 peak bytes. Average peak fell about 1%; average runtime rose about 8.5%. Every run completed with zero kernel OOM events and 11,165 declaration files.
Byte hashes differed. The reverse pair localized 23 differing files; inspected samples include declarations of the modified tooling itself and property-order changes in inferred types. Full byte parity is not established, so this is not an accepted output-equivalence result. Focused native fixtures passed, but the measured full-workload benefit is too small to justify the extra staging path.
Proposed change (not landed)
Emit native declarations through the compiler's filesystem callback into the existing private staging directory. Previously
emitToStringretained every output string in Go and returned the whole collection while the semantic program was still alive.The same Program, diagnostic queries, roots and compiler options remain. Output paths are admitted before staging; callback write failures are latched until RPC completion. The native compiler exits and the existing input seal succeeds before Node materializes the returned text map. Callers retain ownership of final publication.
Pinned TypeScript supports host callback emission; emitToString collects all output.
Dependency
Stacked on #160152. Land that prerequisite and retarget to main before merging.
Validation
Candidate:
a155b907e0205936412b278caa6b760ca040f309.Exact-head remote native proof passed: 27 tests across declaration-boundary and package-preparation suites (35.32 seconds; six existing conditional cases skipped), plus the cold sibling-output ownership case (2.59 seconds). Scripts typecheck, production typed lint, formatting and whitespace passed. Independent P0–P2 review found no actionable defects.
A separate full SDK preparation attempt exited 137 with a 3.5 GiB semantic limit. This patch does not solve that workload sizing issue.
Tests compare real callback and in-memory emission bytes, including BOM and maps; verify staged reads occur after native exit; inject a write failure and check cleanup/preservation; retain the existing config and sibling-output mutation hooks.
Production +49/-26 lines; tests +119/-14 lines. The added writer boundary removes whole-output retention during the compiler lifetime without publishing partial outputs.