open-code-review/internal/llmloop
chethanuk efac9ecc06
fix(llmloop): guard nil tool-call arguments map to prevent panic (#393)
* fix(llmloop): guard nil tool-call arguments map to prevent panic

Some OpenAI-compatible gateways emit "arguments": null for tool calls.
json.Unmarshal("null", &args) succeeds and sets the map to nil (JSON
null nils maps regardless of prior value), so the code_comment path
override (args["path"] = newPath) panicked with "assignment to entry
in nil map", killing the per-file subtask.

- internal/llmloop: parse arguments through a shared parseToolArgs
  helper that always returns a non-nil map, covering both the known-tool
  and dynamic-tool paths.
- internal/llm: the Anthropic history-replay path had the same hazard --
  null arguments reset the pre-initialized argsMap to nil, serializing
  tool_use input as JSON null, which the API rejects.

Fixes #382

* docs(llm): trim nil-args comment and cross-reference parseToolArgs

Review feedback on #393: the two null-arguments guards now reference
each other instead of sharing a helper; a 2-line guard does not justify
a cross-package export.
2026-07-21 13:24:50 +08:00
..
compression.go feat: add ocr scan for full-file code review (#93) 2026-06-24 22:07:25 +08:00
compression_test.go test: add unit tests for pure logic functions across 6 packages 2026-06-26 22:41:35 +08:00
init_test.go fix(session): isolate test sessions to test-sessions subdirectory 2026-06-30 13:23:21 +08:00
loop.go fix(llmloop): guard nil tool-call arguments map to prevent panic (#393) 2026-07-21 13:24:50 +08:00
loop_test.go fix(llmloop): guard nil tool-call arguments map to prevent panic (#393) 2026-07-21 13:24:50 +08:00
pool.go fix(agent): recover from panics in per-file review and comment-pool goroutines (#171) (#182) 2026-07-01 23:23:12 +08:00
pool_test.go fix(agent): recover from panics in per-file review and comment-pool goroutines (#171) (#182) 2026-07-01 23:23:12 +08:00
runner_test.go test: add coverage tests for agent, llm, llmloop, and scan packages 2026-06-27 00:15:28 +08:00