fix(examples): replace CommonJS require.main guard with ESM equivalent - #168
Draft
ling-senpeng13 wants to merge 1 commit into
Draft
fix(examples): replace CommonJS require.main guard with ESM equivalent#168ling-senpeng13 wants to merge 1 commit into
ling-senpeng13 wants to merge 1 commit into
Conversation
63-deploy.ts and 63d-serve-from-package.ts guarded main() with 'require.main === module', which throws ReferenceError in ES module scope — crashing both on direct execution and, transitively, 63c and 63e which import agents from them. Replace with the import.meta.url comparison so the guard keeps preventing main() from running on import.
ling-senpeng13
marked this pull request as ready for review
August 17, 2026 23:35
ling-senpeng13
marked this pull request as draft
August 18, 2026 00:25
Contributor
|
I have investigated Delete followings
For others
|
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.
63-deploy.tsand63d-serve-from-package.tsguardmain()withif (require.main === module)so that63c-run-by-name.ts/63e-run-monitoring.tscan import their agents without triggering a run. But the examples execute as ES modules, whererequiredoesn't exist — so both files crashed withReferenceError: require is not definedon direct execution and on import, breaking all four examples.Replaced with the ESM equivalent:
Verified against conductor-oss 3.32.0-rc18: all five 63-family examples complete — 63/63b/63d run directly, 63c and 63e import from the guarded files and execute exactly one agent run each (guard confirmed to block
main()on import).