Skip to content

Parse inline Ollama tool JSON into tool calls - #470

Merged
TheGreatAxios merged 2 commits into
mainfrom
cl-7186-ollama-myra-replies-with-raw-memory_search-json-instead-of-a
Aug 30, 2026
Merged

TheGreatAxios merged 2 commits into
mainfrom
cl-7186-ollama-myra-replies-with-raw-memory_search-json-instead-of-a

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Contributor

Linear: CL-7186

Live symptom: Ollama Myra replies with raw memory_search JSON instead of executing the tool.

This change parses inline Ollama tool JSON into tool calls. Targeted tests cover the parser path.

Critic reviewed with no blockers.

Full local check was blocked by an unrelated local git-hook/db env issue; targeted gates pass.

Ollama/qwen-like models emit declared tool calls as JSON in content.
The OpenAI-compatible parser only reads native tool_calls, so the
director stopped with visible JSON instead of running the tool.

@TheGreatAxios TheGreatAxios left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

critique · no blockers

Reviewed the CL-7186 adapter-layer fix against the live failure where Ollama returned visible {"name":"memory_search","parameters":{"query":"this person"}} text.

No blocking correctness findings.

Evidence:

  • Declared inline tool JSON is converted into structured inference.tool_call.start + inference.tool_call.delta events on both streaming and JSON response paths.
  • Start and delta now share the same synthetic call id, so the harness can attach arguments correctly.
  • Salvage is gated on tools declared for the request; unknown names, no-tools requests, extra-key JSON, arrays, mixed prose, and fenced JSON stay text.
  • Prompt hardening tells Myra to invoke tools only through tool calls and not to memory_search bare greetings.
  • Targeted adapter and assistant tests pass; package typecheck passes.

Local full bun run check is blocked here by unrelated local git-hook/database test issues; PR CI should be authoritative before merge.

@TheGreatAxios
TheGreatAxios merged commit c1dc490 into main Aug 30, 2026
5 checks passed
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.

1 participant