Repository navigation
fix(config): resolve deep config nesting on an explicit work stack - #152889
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: needs maintainer review before merge. Reviewed September 27, 2026, 6:17 AM ET / 10:17 UTC (Revision 15). ClawSweeper reviewWhat this changesThe branch makes configuration include resolution traverse nested objects and arrays on an explicit work stack and adds deep-nesting regression tests. Merge readiness✅ Ready for maintainer review Keep this PR open. Current main still walks nested configuration recursively during include resolution, and the branch addresses that distinct failure. The separate pre-scan, later load, and write limitations are tracked in related items; review found no definite defect introduced by this patch. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw parses configuration files and resolves flowchart LR
A[Parsed configuration] --> B[Include resolver]
C[Included files] --> B
B --> D{Include directive?}
D -->|Yes| E[Check path and include chain]
E --> F[Resolved configuration]
D -->|No| F
F --> G[Later config loading]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +79, Tests +67. Total +146 across 2 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Land the stack-safe include resolver as its own repair while the separately owned config pre-scan, load, and write stages are reviewed through their linked work. Do we have a high-confidence way to reproduce the issue? Yes, with high confidence from current-main source: nested objects and arrays recurse once per level in the include resolver. The contributor also records failing deep controls on a pinned main revision; this read-only review did not execute them. Is this the best way to solve the issue? Yes. Moving traversal frames into the existing resolver repairs its stack limit without imposing a new configuration depth cap or changing the documented include-chain limit. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 6e5577f6f3d1. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (14 earlier review cycles; latest 8 shown)
|
5df3d43 to
ec24316
Compare
ca74e83 to
971fe21
Compare
971fe21 to
292e084
Compare
…udget resolveConfigIncludes recurses one frame per object/array level inside a document. The $include file chain has a depth cap, but the traversal within a single file has none, so a deeply nested config (no $include required) dies with RangeError: Maximum call stack size exceeded during config load. Give the resolver a single nesting budget - shared across the include file chain so chained files cannot re-accumulate frames - and answer pathological documents with a ConfigIncludeError naming the depth and logical path instead of a stack overflow. Real-world configs sit in the tens of levels, far under the cap. Fixes openclaw#152847 Co-Authored-By: Claude <[email protected]>
… deadcode gate Co-Authored-By: Claude <[email protected]>
…-large-10 The music-generation runtime.resources test failed with a duplicate 'database is not open' hook error on identical code that passed the same shard three hours earlier; no production file in this PR touches that suite. Co-Authored-By: Claude <[email protected]>
The include resolver walked containers recursively, so deeply nested config documents died with RangeError instead of loading, and the fixed 512 budget answered that with a compat regression of its own, rejecting schema-valid documents the recursive resolver had accepted (600- and 2000-level values under agents.defaults.params load on main today). Traverse on an explicit work stack instead: each container becomes a suspended generator frame resumed by the process() driver, so document depth costs heap rather than call frames. The objectDepth counter and its cap are gone; the $include file chain keeps MAX_INCLUDE_DEPTH plus cycle detection. Include events, error ordering, circular detection, and relative-path resolution against the including file are preserved. Co-Authored-By: Claude <[email protected]>
…test file The dedicated deep-config spec file pushed the config-cli tsgo shard to 701 test roots, one over its 700 cap, breaking the shard partition check. Fold the five deep-nesting cases into includes.top-level-key.test.ts, which already owns the resolver mock helpers, so the shard returns to its budget without losing coverage. Co-Authored-By: Claude <[email protected]>
…-large-12 Co-Authored-By: Claude <[email protected]>
…-large-27 sessions-reset-subagent-cleanup leaked-residual-roots assertion is unrelated to this config-include change (touches src/config only). Co-Authored-By: Claude <[email protected]>
292e084 to
96b6101
Compare
…#152889) thanks @ruel225 Resolve deeply nested configuration with an explicit work stack while preserving include handling and error behavior. CI and ClawSweeper passed on the merged head. Source autoreview and scoped proof remain valid for the unchanged reviewed patch. Co-authored-by: ruel225 <[email protected]> Co-authored-by: Claude <[email protected]> Co-authored-by: Altay <[email protected]>
What Problem This Solves
Fixes #152847: deeply nested configuration can fail during include resolution with a stack overflow, even without an include directive.
User Impact
Deep configuration values remain accepted without a new nesting cap. Include-file chain limits, cycle detection, path restrictions, and sibling overrides remain enforced.
Why This Change Was Made
Store suspended traversal frames on the heap and carry each include's relative path and ancestry with it. Linked logical paths avoid copying the entire path at every nested value.
Evidence
RangeErroron pinned main1d109710cd982f2201dc2712060c0362a9263fee; the shallow sibling-override control passed.e74d9945f3a70846277fa06f1469c9ad47728e22, 75 tests passed in 7.51 seconds on personal Cloudflare:node scripts/run-vitest.mjs src/config/includes.review.test.ts src/config/includes.top-level-key.test.ts src/config/includes.test.ts --maxWorkers=1. This covers the identical independent controls, authored 100,000-level object/array regressions, and existing include behavior.includes.review.test.tswas a temporary independent fixture.18b0130a21b9b9aa6856b419ca0d22897f960c25; the QA catalog reference check also passed in 5.14 seconds.oxfmt --checkandgit diff --checkpassed on the changed files.Production CLI observations
The contributor recorded isolated
pnpm openclaw config getruns at5df3d43d34dwith synthetic config state. A minimal config returned its model; existing configs with 600-level and 2,000-level values underagents.defaults.paramsreturned the expected leaves with exit code 0. The 600-level case preserves a configuration accepted before this repair. Separate detector, cloning, and serialization stages can still limit deeper end-to-end operations.