emphasize that executeCode return values are discarded - #299
Open
maxwellpeterson wants to merge 1 commit into
Open
emphasize that executeCode return values are discarded#299maxwellpeterson wants to merge 1 commit into
maxwellpeterson wants to merge 1 commit into
Conversation
Preview:
|
maxwellpeterson
marked this pull request as ready for review
August 21, 2026 18:21
maxwellpeterson
force-pushed
the
mpeterson/code-tool-console-log
branch
from
August 21, 2026 18:25
d00d0e6 to
a710e39
Compare
ndisidore
reviewed
Aug 21, 2026
|
|
||
| The function also receives a \`self\` parameter which is a magic object that points back to this chat thread. Calling any method on \`self\`, like \`self.foo(123)\`, delivers a callback message to this chat and activates you to respond. \`self\` can be passed over RPC (e.g. to a subscription method) and stored in a Durable Object's KV storage for long-term callbacks. When an agent callback is received, it appears in your env under a name like \`PARAMS_1\`, with \`.args\` (the callback arguments), \`.resolve(value)\` (to return a value to the caller), and \`.reject(error)\` (to reject with an error). | ||
|
|
||
| The function's return value is discarded and will not appear in the tool result. Use console.log() for every value you need to inspect. Before the function returns, explicitly log the result of the operation when it will help confirm what happened. |
Contributor
There was a problem hiding this comment.
Possibly worth condensing to what I had originally
The exported function's return value is ignored; use \`console.log()\` to produce tool output.
either way would suggest wrapping in `console.log()` to be consistent with the rest of the block
Member
Author
There was a problem hiding this comment.
Added backtick wrappers. I prefer the current prose and feel like it matches the rest of this block better
I often see the Workshop agent try to return values from executeCode calls, only to realize afterward that return values are discarded and it should use console.log() instead. We should emphasize this behavior in the executeCode tool description so the agent gets it right the first time.
maxwellpeterson
force-pushed
the
mpeterson/code-tool-console-log
branch
from
August 21, 2026 19:11
a710e39 to
99ecb39
Compare
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.
I often see the Workshop agent try to return values from executeCode calls, only to realize afterward that return values are discarded and it should use console.log() instead. We should emphasize this behavior in the executeCode tool description so the agent gets it right the first time.
Fixes #209