[codex] Fix native instance walk for fluent chains#4219
Merged
proggeramlug merged 1 commit intoJun 3, 2026
Conversation
2cab168 to
45b78b3
Compare
This was referenced Jun 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the local native-instance rewrite pass so non-native fluent call chains are walked linearly instead of revisiting the same property receiver at every chain level.
The OpenCode/Perry graph previously reached module collection/tree-shake and then timed out in
run_native_instance_fixupswhile processing the long yargs chain in the OpenCode overlaysrc/index.ts. The Cheerio chained-call special case recursively fixed a property receiver, then the generic fallback walked the whole callee again, making long non-native fluent chains exponential.Changes
fix_native_instance_expr_with_locals.fix_local_native_instancesover it.Validation
cargo test -p perry-hir --test cheerio_call_rewrite->2 passed; 0 failed.cargo build --release -p perry-> finished release build.Found 2760 module(s): 2760 native, 0 JavaScript, enteredGenerating code..., then hit the next compiler blocker:thread '<unknown>' has overflowed its stackduring codegen./var/folders/8q/vx4z9tqd08jd1b5_bykzbdkr0000gn/T/opentui-perry-native-Irv8KZ.Notes
This does not complete the OpenTUI/OpenCode Perry-native migration. It only moves the fluent-chain/native-fixup timeout blocker; the next blocker is a Perry codegen stack overflow before a binary is produced.