Skip to content

fix(koog): never put a tool call without ID or name into history - #1190

Merged
catatafishen merged 1 commit into
masterfrom
fix/koog-blank-tool-call-id
Oct 17, 2026
Merged

catatafishen merged 1 commit into
masterfrom
fix/koog-blank-tool-call-id

Conversation

@agentbridge-fixer

Copy link
Copy Markdown

Copilot returns HTTP 400 tool call must have a tool call ID and function name when any tool call in the resent history lacks an ID or name. KoogConversation.assemble() copied both straight from the stream frame, so a single malformed call mid-run poisoned every later request in the conversation.

  • Blank/null call IDs get a generated koog-<uuid>; blank names become unknown_tool.
  • executeCall now uses the same fallback ID for the tool result as for the call.

Not reproduced locally; this hardens the history against the suspected cause. If it recurs, the provider's raw frame should be logged.

Copilot rejects the whole request with HTTP 400 "tool call must have a tool call ID and function name" when any call in the resent history lacks an ID or name. assemble() copied both straight from the stream frame, so one malformed call poisoned every later request.

Blank IDs now get a generated one, blank names become unknown_tool, and the tool result uses the same ID as the call.
@codecov

codecov Bot commented Oct 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.25000% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...fishen/agentbridge/client/koog/KoogConversation.kt 81.25% 0 Missing and 3 partials ⚠️

📢 Thoughts on this report? Let us know!

@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

IDE Compatibility Matrix

✅ pass ❌ fail 🚫 unavailable ❓ no test yet

Generated from the real-IDE integration bench (:ide-integration-tests).

Tool CL IU RD
PSI / Navigation      
search_symbols ✅ ✅ 🚫
get_file_outline ✅ ✅ ❓
find_references ✅ ✅ ❓
go_to_declaration ✅ ✅ ❓
get_documentation ✅ ✅ ❓
get_symbol_info ✅ ✅ ❓
get_class_outline ❓ ❓ ❓
Code Quality      
get_highlights ✅ ✅ ✅
get_problems ✅ ✅ ✅
get_compilation_errors ✅ ✅ ✅
get_available_actions ❓ ❓ ❓
apply_action ❓ ❓ ❓
apply_quickfix ❓ ❓ ❓
format_code ❓ ❓ ❓
optimize_imports ❓ ❓ ❓
suppress_inspection ❓ ❓ ❓
Refactoring      
get_type_hierarchy 🚫 ✅ ❓
get_call_hierarchy 🚫 ✅ ❓
find_implementations 🚫 ✅ ❓
find_super_methods ❓ ❓ ❓
refactor ❓ ❓ ❓
convert_java_to_kotlin ❓ ❓ ❓
Testing      
run_tests ❓ ❓ ❓
list_tests ❓ ❓ ❓
run_configuration ❓ ❓ ❓
get_coverage ❓ ❓ ❓
Debug      
debug_session_start ❓ ❓ ❓
breakpoint_manage ❓ ❓ ❓
debug_evaluate ❓ ❓ ❓
debug_snapshot ❓ ❓ ❓
debug_inspect_frame ❓ ❓ ❓
debug_variable_detail ❓ ❓ ❓
debug_read_console ❓ ❓ ❓
debug_step ❓ ❓ ❓
debug_run_to_line ❓ ❓ ❓
Build      
read_build_output ❓ ❓ ❓
reload_project_model ❓ ❓ ❓

Logged IDE errors (non-gating)

Scraped from the IDE log during the run. These do not fail a matrix cell (the cell reflects the tool's MCP response) — they are listed for visibility while the bench matures.

⚠️ CL — (java.lang.InterruptedException: null)
Test: com.github.catatafishen.agentbridge.integration.GetHighlightsIntegrationTest.get_highlights returns a non-error response ⏎ You can find logs and other useful info in CI artifacts under the path getHighlights ⏎ java.lang.InterruptedException ⏎ at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:124) ⏎ at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$BuildersKt__BuildersKt(Builders.kt:87) ⏎ at kotlinx.coroutines.BuildersKt__BuildersKt.runBlockingWithParallelismCompensation(Builders.kt:63) ⏎ at kotlinx.coroutines.BuildersKt.runBlockingWithParallelismCompensation(Unknown Source) ⏎ at kotlinx.coroutines.internal.intellij.IntellijCoroutines.runBlockingWithParallelismCompensation(intellij.kt:48)
⚠️ CL — (java.lang.IllegalStateException: There is no ProgressIndicator or Job in this thread, the current job is not cancellable.)
Test: com.github.catatafishen.agentbridge.integration.GetHighlightsIntegrationTest.get_highlights returns a non-error response ⏎ You can find logs and other useful info in CI artifacts under the path getHighlights ⏎ java.lang.IllegalStateException: There is no ProgressIndicator or Job in this thread, the current job is not cancellable. ⏎ at com.intellij.openapi.progress.CoroutinesKt.runBlockingCancellable$lambda$0(coroutines.kt:153) ⏎ at com.intellij.openapi.progress.ContextKt.prepareThreadContext$lambda$0(context.kt:93) ⏎ at com.intellij.concurrency.ThreadContext.resetThreadContext(threadContext.kt:294) ⏎ at com.intellij.openapi.progress.ContextKt.prepareThreadContext(context.kt:92) ⏎ at com.intellij.openapi.progress.CoroutinesKt.runBlockingCancellable(coroutines.kt:151)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The normalization is narrow and preserves call/result pairing; additional regression coverage is a nonblocking improvement.

1 open issue
What changed in this PR

Hardens Koog conversation history against malformed tool-call metadata that can cause Copilot HTTP 400 responses.

Changes:

  • Generates IDs for null or blank call IDs and substitutes unknown_tool for blank names.
  • Uses the execution ID consistently in tool results.
File Description
plugin-core/​src/​main/​java/​com/​github/​catatafishen/​agentbridge/​client/​koog/​KoogConversation.kt Normalizes streamed tool-call metadata and aligns result IDs.

Review effort: Balanced

Comment on lines +308 to +309
id = frame.id?.takeIf { it.isNotBlank() } ?: ("koog-" + UUID.randomUUID()),
tool = frame.name.ifBlank { "unknown_tool" },
@catatafishen
catatafishen merged commit 5e9bc10 into master Oct 17, 2026
24 checks passed
@catatafishen
catatafishen deleted the fix/koog-blank-tool-call-id branch October 17, 2026 15:12

This branch was successfully deployed

1 active deployment
fuzzing — a53b87be Deployed Oct 17, 2026 by agentbridge-fixer[bot] via ClusterFuzzLite PR (address) #1641
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