Skip to content

code_execution parser rejects generated code embedding shell/CSS/markdown in String.raw/template literals (6 parse-time failures) #23

Description

@Broccolito

Summary

The code_execution / execute_code sandbox rejects the model-generated JS/TS at parse time ("Parse error: SyntaxError…") whenever the code embeds shell, CSS, or markdown inside a String.raw template literal or an object literal. The tool call never runs — it is thrown out before execution — so the agent silently loses a whole step and has to retry. This was the single most common tool-call failure in the audited transcripts (6 occurrences, all in the "starsign master" session), and it repeatedly blocked the website-build and skill-creation work.

How it was found

Auditing three exported session transcripts (knowledge conversation, testing conversation 2, starsign master conversation) for tool-call failures. This issue collects the parse-time rejections.

Every occurrence (session: starsign master conversation)

# Exact error Triggering construct in the generated code
1 Parse error: SyntaxError: expected token '}', got ':' in template literal at line 11, col 16 A bash parameter-expansion "${!v:-}" written **inside a String.raw\…`template literal** (a shellfor v in …; do … ${!v:-} …heredoc). The JS parser tries to interpret${…}as a JS template substitution and chokes on the bash:`.
2 Parse error: SyntaxError: expected one of ',' or '}', got 'prefers' in object literal at line 136, col 112 CSS @media (prefers-color-scheme: dark) text sitting where the parser expected a JS object literal.
3 Parse error: SyntaxError: unterminated string literal Multi-line Python heredoc with embedded quotes inside String.raw.
4 Parse error: SyntaxError: unterminated string literal Same class — heredoc/quoting inside a String.raw block.
5 Parse error: SyntaxError: expected one of ';' or 'line terminator', got 'value' in lexical declaration binding list at line 399, col 87 Large String.raw payload with stray tokens confusing the const … = … binding parse.
6 Parse error: SyntaxError: expected one of ';' or 'line terminator', got 'index' in lexical declaration binding list at line 51, col 15 A String.raw work-summary payload containing an unescaped path fragment (a/Users/wanjun/Desktop/starsign master) parsed as code.

Each of these returned [tool_error kind=tool_failure retryable=false] before any code executed.

Why this is a product bug (not just model error)

String.raw\…` exists precisely so authors can embed arbitrary text (shell, CSS, regex, markdown) without escaping. The recurring failure mode is that **${…}sequences and stray tokens insideString.rawtemplate literals are still being interpreted by the JS/TS parser** instead of treated as raw text, so any shell heredoc using${VAR}/${!v:-}or any embedded CSS/markdown breaks the parse. Becauseretryable=false`, the harness gives up rather than falling back.

Suggested investigation

  • Confirm how the execute_code parser handles ${…} and back-tick content inside String.raw — raw template literals should not have their ${} substitutions validated as JS.
  • Consider a safer inbound-code path for large embedded blobs (e.g. accept the shell/heredoc body as a normal string argument rather than re-parsing it), or a clearer error that points at the offending embedded construct.
  • Given how often the model reaches for shell({command: String.raw\python3 - <<'PY' … PY`})`, this pattern needs to parse reliably.

Environment

  • BioRouter desktop, model gpt-5.5-2026-04-24 (Azure), code_execution extension enabled.
  • Evidence: exported starsign master conversation session transcript.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions