fix(execute): explain Node-side execute failures and keep extension builds loadable - #100
Open
safzanpirani wants to merge 2 commits into
Open
safzanpirani wants to merge 2 commits into
safzanpirani wants to merge 2 commits into
Conversation
…uilds loadable Execute code runs in Node, and agents often write it as page code. A bare `window is not defined` or `Failed to parse URL from /api/...` did not say why. Execute now adds a warning for both errors that points to page.evaluate, and the skill states the Node boundary. `execute --file` errors now include the file-system reason, as doctor already does for its read errors. `pnpm build:extension` deleted extension/dist before building, so a failed build left the unpacked extension directory empty. The extension build now writes into a staging directory under the OS temp directory and replaces extension/dist file by file. The directory and manifest stay in place, and a failed build leaves the previous output untouched.
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
This PR fixes three failures that agents hit repeatedly while using Browser Control.
window.location.hreffails withReferenceError: window is not defined, andfetch("/api/me")fails withTypeError: Failed to parse URL from /api/me, with no hint about the cause. Execute now adds a warning for both errors that points topage.evaluate. The Execute Interface section of the skill now states that execute code runs in Node.execute --fileerrors without a reason. A missing or unreadable file produced onlyread execute file /tmp/chat_.js. The message now includes the file-system reason, asdoctoralready does for its read errors. For example,read execute file /tmp/chat_.js: NotFound: FileSystem.readFile (/tmp/chat_.js).pnpm build:extensiondeletedextension/distbefore building. If esbuild failed, the unpacked extension directory stayed empty and Chromium could not load it on the next worker start. The extension build now writes into a staging directory under the OS temp directory. It then copies each file intoextension/dist, renames it into place, and removes stale entries. The directory andmanifest.jsonstay in place during the build, and a failed build leaves the previous output untouched.--outdirkeeps its existing fresh-directory rules, andbuild:cliis unchanged.Verification
pnpm run ci, theruntime:preparestep from CI, andpnpm typecheckpass locally.pnpm testpasses 971 tests in 69 files, andpnpm audit:duplicatesfinds 0 clones.test/execute-ergonomics.test.tscovers thewindowand relativefetchwarnings. It also checks that an unrelatedReferenceErrorand an in-pagepage.evaluateerror get no warning.pnpm build:extensionkept the sameextension/distinode and removed a stale file. A build with a syntax error inbackground.tsexited 1 and leftmanifest.jsonand the previousbackground.jsbyte-identical. No temp files remained indistor the staging location.execute --filewith a missing path prints the reason shown above, before any relay contact.