fix(compute): replace print() with return in remote-compute-ssh JS examples - #2018
Merged
ewen-poch merged 1 commit intoSep 1, 2026
Merged
Conversation
…amples The skill's JavaScript examples ended cells with print(), an API the JS kernel does not define. Agents copying the pattern hit ReferenceError: print is not defined. Use explicit return instead: it unconditionally lands the value in the cell's result, while a trailing expression silently degrades to result: null when its tail no longer parses. The executable skill test used to inject a working print mock, which masked the doc/kernel mismatch. The mock now throws like the real kernel, and the test asserts the return contract instead.
This was referenced Sep 1, 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.
Problem
Agents writing Host SDK code in the notebook's JS kernel repeatedly produce
ReferenceError: print is not definedafter copying the remote-compute-ssh skill's JavaScript examples, which end cells withprint(...).The JS kernel (
resources/notebook/repl_loop.js) defines no globalprint. Verified against the real kernel:print(help)throwsReferenceError, whilereturn <expr>and a trailing expression both land the value in the cell'sresult(JSON-serialized). The trailing-expression form silently degrades toresult: nullwith no error once a statement follows it, so explicitreturnis the reliable pattern to teach — and it matches the convention used throughoutrepl-loop.integration.test.ts.The executable skill test injected a working
printmock, so the examples passed in the test environment while failing in the real kernel.Proposed change
resources/skills/remote-compute-ssh/SKILL.md: both JavaScript examples now end withreturn initial/return jobsinstead ofprint(...); the "end the cell — no waiting, no loop" intent is unchanged.src/main/compute/remote-compute-skill.test.ts: the injectedprintnow throws exactly like the real kernel, so reintroducingprint()into the doc fails the test the same way it fails in production; the test now asserts thereturncontract (the result snapshot becomes the cell's returned value).Scope and non-goals
print()call sites in this skill's JS examples and the test that executes them. The Python-kernel skills'print()usage is legitimate and untouched.host.helpchanges; those surfaces contain noprintreferences.Acceptance criteria and validation
Ran after the last material edit:
npm test -- src/main/compute/remote-compute-skill.test.ts src/main/compute/skill-doc.test.ts src/main/compute/skill-provisioning.test.ts src/main/compute/compute-service.architecture.test.ts— 20 passednpm run typecheck:node— passnpx eslint src/main/compute/remote-compute-skill.test.ts— passresources/notebook/repl_loop.jsReview focus
Whether the executable-doc mock should model the kernel's missing
printby throwing (chosen) versus dropping theprintparameter entirely (a strayprint()call would then surface as a plain ReferenceError).