<feed xmlns='http://www.w3.org/2005/Atom'>
<title>newos4/modules/test/test-ollama-numctx.js, branch main</title>
<subtitle>newOS4 - the browser terminal that runs WebX11 user spaces</subtitle>
<id>https://newos.webx11.duckdns.org/newos4/atom?h=main</id>
<link rel='self' href='https://newos.webx11.duckdns.org/newos4/atom?h=main'/>
<link rel='alternate' type='text/html' href='https://newos.webx11.duckdns.org/newos4/'/>
<updated>2026-10-27T16:08:42+00:00</updated>
<entry>
<title>fix(newos4): send num_ctx to Ollama, and make one auto-connect failure read as one line</title>
<updated>2026-10-27T16:08:42+00:00</updated>
<author>
<name>Agando</name>
<email>roduccomm@gmail.com</email>
</author>
<published>2026-10-27T16:08:42+00:00</published>
<link rel='alternate' type='text/html' href='https://newos.webx11.duckdns.org/newos4/commit/?id=d2588d521b304d0141cfba1f5c8dd4ec50492097'/>
<id>urn:sha1:d2588d521b304d0141cfba1f5c8dd4ec50492097</id>
<content type='text'>
Two things I had flagged as "worth your attention" and one leftover nit.

- num_ctx was never sent. Ollama's server-side default context is 2k-4k depending on the build, so
  a system prompt + 20 messages + up to 24k chars of tool results could be truncated server-side,
  which is exactly the "it forgot what it just read" class of report. Every Ollama request now
  carries options.num_ctx (default 16384, overridable via webx11_ollama_numctx, floor 512); the
  OpenAI-compatible branch is untouched because num_ctx is not one of its parameters.
- Automatic connect prints one outcome instead of one line per endpoint tried (7 -&gt; 3 on a dead
  endpoint). Interactive `ollamaconnect` keeps the per-endpoint detail.
- write_file's failure message no longer echoes a trailing slash.

Verification:
- test-ollama-numctx.js (7 asserts): generate and chat payloads carry num_ctx=16384, a stored
  override is used, junk/too-small values fall back, and the /v1/chat/completions branch does not
  receive it. RED on HEAD: TypeError reading 'num_ctx' of undefined. Suite 20/20.
- Live v4.6.117, capturing the real request: {"num_ctx":16384} on /api/generate with
  model gemma4:31b-cloud, reply "OK".
- Live v4.6.118, dead endpoint (127.0.0.1:9, fallback disabled): automatic -&gt; 3 lines
  ("connecting on first use…", "Connecting to dead…", "Auto-connect failed — …"); manual
  connect() -&gt; 4 lines including "endpoint http://127.0.0.1:9 failed", so the suppression is
  conditional, not blanket.
</content>
</entry>
</feed>
