Skip to content

[codebuddy] 2.57.0 scaffold guard misses bare tool names (DSML_INVOKE_PREFIX requires the functions. prefix) - #4596 still reproduces #4852

Description

@xiaoshuai7038

Client or integration

Codex App

Area

Provider adapter

Summary

Follow-up to #4596. The CodeBuddy scaffold guard that shipped in 2.57.0 (via #4776 / 2e590fe419b) does not match the shape the routed model actually emits, so the leak reported in #4596 still reproduces on the released build.

src/adapters/codebuddy/scaffold-guard.ts (2.57.0, lines 10-11) recognises exactly two markers:

const DSML_CALLS_LINE = "<||DSML|| calls>";
const DSML_INVOKE_PREFIX = "<||DSML|| invoke name="functions.";

Refusal requires the invoke line to be followed by name="functions. - a tool name carrying the functions. namespace prefix. The model on this route does not emit that prefix. It writes the bare tool name, so every marker misses and the whole block is forwarded as assistant text.

Reproduction

With 2.57.0 running locally, post an ordinary agent-style turn to the proxy and read the returned text:

curl -s -X POST http://127.0.0.1:10100/v1/responses \
  -H 'Content-Type: application/json' \
  --data-binary @payload.json

payload.json:

{
  "model": "codebuddy-cn/deepseek-v4.1-flash",
  "stream": false,
  "instructions": "You are an autonomous coding agent working in a local git repository. You have an `exec` tool for running shell commands. When the user asks you to inspect the repository, call the exec tool; do not just describe what you would run.",
  "input": [
    {
      "role": "user",
      "content": "Run `git status --short --branch` in the current directory using your exec tool, then report the branch name. Do not explain, just call the tool."
    }
  ]
}

Reproduced twice out of two attempts, ~6 seconds each, HTTP 200. No error field, no vendor_scaffold_detected code - the guard never fired.

Version

2.57.0

Operating system

macOS 26.5.1 (Darwin 25.5.0, arm64), Node v26.5.0

Provider and model

codebuddy (provider id codebuddy-cn) / deepseek-v4.1-flash

Logs or error output

Raw routed response - this is the entire assistant output, verbatim:

<||DSML|| calls>
<||DSML|| invoke name="Bash">
<||DSML|| parameter name="command" string="true">git status --short --branch</||DSML|| parameter>
</||DSML|| invoke>
</||DSML|| calls>

The tool name the model chose is Bash, which is the only reason the guard missed. The same request produced functions.exec in the original #4596 samples, which is why the marker was written with that prefix.

Screenshots and supporting files

I drove the shipped CodeBuddyScaffoldFilter class directly (2.57.0, no local modification) with one syntactically identical block per tool name. Only the functions.-prefixed names are refused:

invoke name guard result
functions.exec refused
functions.Bash refused
functions.apply_patch refused
Bash leaked
exec leaked
shell leaked
apply_patch leaked

Also replayed through the same filter class: the two samples attached to #4596 (functions.exec, one of them split across deltas) are refused, and the block from this report (Bash) is not. The existing marker logic and the delta-boundary handling both work; the namespace prefix on the invoke target is the only gap.

  • Environment note: the package was freshly installed from npm as 2.57.0 with no local modification applied, and the proxy reported 2.57.0 on /healthz when these requests were sent.
  • DSML_CALLS_LINE itself matches fine in all cases - the block opener is identical. Only DSML_INVOKE_PREFIX is too narrow.

Checks

  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingproviderProvider adapters, OpenAI-compat presets, upstream API quirks

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions