Skip to content

fix(typesafe): send Ollama the instructions it requires - #13

Merged
tomorrowflow merged 1 commit into
mainfrom
fix/typesafe-ollama-instructions
Oct 4, 2026
Merged

tomorrowflow merged 1 commit into
mainfrom
fix/typesafe-ollama-instructions

Conversation

@tomorrowflow

Copy link
Copy Markdown
Owner

Problem

After #12 was deployed, the first real agent call to decision_evaluate against tev1:4b returned unavailable / transport ("the selected provider could not be reached"). Ollama was reachable and healthy. The cause had two parts:

  • The decision contract makes question instructions optional, and the local adapter sends a missing value as null, which Kev accepts. Ollama's /v1/systemone rejects both a missing and a null value: 400 question "b": instructions must be a nonempty string, object, or array. Agents usually leave instructions out when the criteria already express the judgment.
  • The plugin mapped that 400 to transport, so the agent was told the server was unreachable instead of that its input was rejected.

Solution

  • When localModel is set, which means a name-routed server such as Ollama, omitted instructions are filled with a neutral judgment for each question type: choice "Select the option that best matches the state.", score "Select the level that best matches the state.", and noul "Decide whether the true description applies to the state." Supplied instructions are passed through unchanged. Without localModel (Kev), null is still sent.
  • For a local baseUrl, HTTP 400 maps to unsupported-input. Hosted Jev error mapping is unchanged.

Evidence

  • A live call through evaluate() against the real http://192.168.2.17:11434 with tev1:4b, using the exact instruction-less question shape that failed in the agent run, now answers: choice gateway 0.95, score 1.92/2, noul 0.92. Before the fix, the same request returned HTTP 400.
  • Two new tests cover the filled instructions and the local 400 → unsupported-input mapping (with hosted staying transport). Both fail without the fix and pass with it. extensions/typesafe totals 10 files and 171 tests passing. The new tests are fetch-stubbed and run in milliseconds.
  • tsgo:extensions and tsgo:extensions:test are clean, and so are oxlint, oxfmt --check and git diff --check.

🤖 Generated with Claude Code

The decision contract makes question instructions optional, and the local
adapter sends them as null, which Kev accepts. Ollama's /v1/systemone rejects
missing or null instructions with HTTP 400, so an agent's decision_evaluate
call without instructions failed, and the 400 was reported as "transport"
("the selected provider could not be reached").

For a name-routed server (localModel set), fill omitted instructions with a
neutral per-type judgment the criteria already express. A local 400 now maps
to unsupported-input. Hosted Jev and Kev keep their behavior.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@tomorrowflow
tomorrowflow merged this pull request into main Oct 4, 2026
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