MCPcopy Create free account
hub / github.com/codehamr/codehamr / TestRunRawSurfacesTruncatedToolArgs

Function TestRunRawSurfacesTruncatedToolArgs

internal/tools/bash_test.go:287–303  ·  view source on GitHub ↗

TestRunRawSurfacesTruncatedToolArgs: the _parse_error sentinel (set by llm.resolve when the server truncates an oversized tool call mid-JSON) must surface as an actionable message naming the cause + chunked recovery, not fall through the type assertions to a misleading "(empty path)" / "(empty comma

(t *testing.T)

Source from the content-addressed store, hash-verified

285// surface as an actionable message naming the cause + chunked recovery, not
286// fall through the type assertions to a misleading "(empty path)" / "(empty
287// command)". Checked for a file tool and bash to pin that the guard is generic,
288// sitting before the per-tool switch.
289func TestRunRawSurfacesTruncatedToolArgs(t *testing.T) {
290 for _, name := range []string{WriteFileName, BashName} {
291 call := chmctx.ToolCall{
292 Name: name,
293 Arguments: map[string]any{"_parse_error": "unexpected end of JSON input"},
294 }
295 got := runRaw(context.Background(), call)
296 if strings.Contains(got, "empty path") || strings.Contains(got, "empty command") {
297 t.Fatalf("%s: truncation masked as empty-arg error: %q", name, got)
298 }
299 for _, want := range []string{"not valid JSON", "truncated", "append true", "wc -c"} {
300 if !strings.Contains(got, want) {
301 t.Fatalf("%s: message missing %q: %q", name, want, got)
302 }
303 }
304 }
305}
306

Callers

nothing calls this directly

Calls 1

runRawFunction · 0.85

Tested by

no test coverage detected