Skip to content

fix: fix snake_case function names in code_execution instructions#7035

Merged
alexhancock merged 1 commit intoblock:mainfrom
rabi:fix_code_execution
Feb 6, 2026
Merged

fix: fix snake_case function names in code_execution instructions#7035
alexhancock merged 1 commit intoblock:mainfrom
rabi:fix_code_execution

Conversation

@rabi
Copy link
Contributor

@rabi rabi commented Feb 6, 2026

Summary

The execute tool description used snake_case function names (e.g., Developer.text_editor, Github.create_issue) but the TypeScript runtime expects camelCase (Developer.textEditor, Github.createIssue) since pctx_codegen converts all MCP tool names to camelCase. This causes TS2551 type errors at runtime.

Also:

  • Added explicit "Function names are always camelCase" rule with examples.
  • Added HANDLING RETURN VALUES section: many MCP tools return wrapper objects not raw arrays, causing TypeError: x.filter is not a function when LLMs assume array returns.
  • Corrected available APIs: fetch() (host-restricted) and console methods are available, not forbidden. Removed Deno-specific references.

Type of Change

  • Feature
  • Bug fix
  • Refactor / Code quality
  • Performance improvement
  • Documentation
  • Tests
  • Security fix
  • Build / Release
  • Other (specify below)

AI Assistance

  • This PR was created or reviewed with AI assistance

Testing

Tested locally with nemotron nano and the results are much better.

- Function names are always camelCase (e.g., Developer.textEditor, Github.listIssues, Github.createIssue)
- Return value from `run()` is the result, all `console.log()` output will be returned as well.
- Only functions from `list_functions()` are available - no `fetch()`, fs, or other Node/Deno APIs
- Only functions from `list_functions()` are available, plus `fetch()` (restricted to allowed hosts) and `console` methods
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we add console to list_functions instead?

i also imagine keeping

no `fetch()`, fs, or other Node/Deno APIs

as-is is ok right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think console is part of the sandbox runtime layer, not the tool/MCP layer. Adding it to list_functions would require modifying the upstream pctx_code_mode, right?

pctx mentions fetch as host restricted https://github.com/portofcontext/pctx/blob/main/crates/pctx_code_execution_runtime/src/lib.rs#L34, but yeah we can leave it as is.

The execute tool description used snake_case function names
(e.g., `Developer.text_editor`, `Github.create_issue`) but the
TypeScript runtime expects camelCase (`Developer.textEditor`,
`Github.createIssue`) since pctx_codegen converts all MCP tool names
to camelCase. This causes TS2551 type errors at runtime.

Also:
- Added explicit "Function names are always camelCase" rule with examples.
- Added HANDLING RETURN VALUES section: many MCP tools return wrapper
  objects not raw arrays, causing `TypeError: x.filter is not a function`
  when LLMs assume array returns.

Signed-off-by: rabi <ramishra@redhat.com>
@rabi rabi force-pushed the fix_code_execution branch from f467bc3 to d8a0ffe Compare February 6, 2026 16:33
@alexhancock alexhancock self-requested a review February 6, 2026 17:07
@alexhancock alexhancock added this pull request to the merge queue Feb 6, 2026
Merged via the queue into block:main with commit ca058c4 Feb 6, 2026
18 checks passed
zanesq added a commit that referenced this pull request Feb 6, 2026
* origin/main:
  Remove build-dependencies section from Cargo.toml (#6946)
  add /rp-why skill blog post (#6997)
  fix: fix snake_case function names in code_execution instructions (#7035)
  Document max_turns settings for recipes and subagents (#7044)
  feat: update Groq declarative data with Preview Models (#7023)
  fix(codex): propagate extended PATH to codex subprocess (#6874)
  Switch tetrate tool filtering back to supports_computer_use (#7024)
  feat(ui): add inline rename for chat sessions in sidebar (#6995)
  fix: handle toolnames without underscores (#7015)
  feat(claude-code): use stream-json protocol for persistent sessions (#7029)
  test(providers): add model listing to live provider suite (#7038)
  Agent added too much (#7036)
  fix(deps): bump tree-sitter to 0.26 and set sqlx default-features=false to fix RUSTSEC advisories (#7031)
  feat: add image support and improve error resilience for Codex (#7033)
  fix(providers): Azure OpenAI model listing 404 during configure (#7034)
  fix(deps): bump bat to 0.26.1 to resolve RUSTSEC-2026-0008 (#7021)
  Don't swallow Tetrate errors  (#6998)
  docs: remove hardcoded_stuff links (#7016)

# Conflicts:
#	ui/desktop/src/components/GooseSidebar/AppSidebar.tsx
kuccello pushed a commit to kuccello/goose that referenced this pull request Feb 7, 2026
tlongwell-block added a commit that referenced this pull request Feb 9, 2026
* origin/main: (55 commits)
  test(mcp): add image tool test and consolidate MCP test fixtures (#7019)
  fix: remove Option from model listing return types, propagate errors (#7074)
  fix: lazy provider creation for goose acp (#7026) (#7066)
  Smoke tests: split compaction test and use debug build (#6984)
  fix(deps): trim bat to resolve RUSTSEC-2024-0320 (#7061)
  feat: expose AGENT_SESSION_ID env var to extension child processes (#7072)
  fix: add XML tool call parsing fallback for Qwen3-coder via Ollama (#6882)
  Remove clippy too_many_lines lint and decompose long functions (#7064)
  refactor: move disable_session_naming into AgentConfig (#7062)
  Add global config switch to disable automatic session naming (#7052)
  docs: add blog post - 8 Things You Didn't Know About Code Mode (#7059)
  fix: ensure animated elements are visible when prefers-reduced-motion is enabled (#7047)
  Show recommended model on failture (#7040)
  feat(ui): add session content search via API (#7050)
  docs: fix img url (#7053)
  Desktop UI for deleting custom providers (#7042)
  Add blog post: How I Used RPI to Build an OpenClaw Alternative (#7051)
  Remove build-dependencies section from Cargo.toml (#6946)
  add /rp-why skill blog post (#6997)
  fix: fix snake_case function names in code_execution instructions (#7035)
  ...

# Conflicts:
#	scripts/test_subrecipes.sh
lifeizhou-ap added a commit that referenced this pull request Feb 9, 2026
* main: (101 commits)
  fix: lazy provider creation for goose acp (#7026) (#7066)
  Smoke tests: split compaction test and use debug build (#6984)
  fix(deps): trim bat to resolve RUSTSEC-2024-0320 (#7061)
  feat: expose AGENT_SESSION_ID env var to extension child processes (#7072)
  fix: add XML tool call parsing fallback for Qwen3-coder via Ollama (#6882)
  Remove clippy too_many_lines lint and decompose long functions (#7064)
  refactor: move disable_session_naming into AgentConfig (#7062)
  Add global config switch to disable automatic session naming (#7052)
  docs: add blog post - 8 Things You Didn't Know About Code Mode (#7059)
  fix: ensure animated elements are visible when prefers-reduced-motion is enabled (#7047)
  Show recommended model on failture (#7040)
  feat(ui): add session content search via API (#7050)
  docs: fix img url (#7053)
  Desktop UI for deleting custom providers (#7042)
  Add blog post: How I Used RPI to Build an OpenClaw Alternative (#7051)
  Remove build-dependencies section from Cargo.toml (#6946)
  add /rp-why skill blog post (#6997)
  fix: fix snake_case function names in code_execution instructions (#7035)
  Document max_turns settings for recipes and subagents (#7044)
  feat: update Groq declarative data with Preview Models (#7023)
  ...
dianed-square added a commit that referenced this pull request Feb 9, 2026
* origin/main: (141 commits)
  Add global config switch to disable automatic session naming (#7052)
  docs: add blog post - 8 Things You Didn't Know About Code Mode (#7059)
  fix: ensure animated elements are visible when prefers-reduced-motion is enabled (#7047)
  Show recommended model on failture (#7040)
  feat(ui): add session content search via API (#7050)
  docs: fix img url (#7053)
  Desktop UI for deleting custom providers (#7042)
  Add blog post: How I Used RPI to Build an OpenClaw Alternative (#7051)
  Remove build-dependencies section from Cargo.toml (#6946)
  add /rp-why skill blog post (#6997)
  fix: fix snake_case function names in code_execution instructions (#7035)
  Document max_turns settings for recipes and subagents (#7044)
  feat: update Groq declarative data with Preview Models (#7023)
  fix(codex): propagate extended PATH to codex subprocess (#6874)
  Switch tetrate tool filtering back to supports_computer_use (#7024)
  feat(ui): add inline rename for chat sessions in sidebar (#6995)
  fix: handle toolnames without underscores (#7015)
  feat(claude-code): use stream-json protocol for persistent sessions (#7029)
  test(providers): add model listing to live provider suite (#7038)
  Agent added too much (#7036)
  ...
Tyler-Hardin pushed a commit to Tyler-Hardin/goose that referenced this pull request Feb 11, 2026
Tyler-Hardin pushed a commit to Tyler-Hardin/goose that referenced this pull request Feb 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants