Skip to content

Plan 323 — Ollama requests use undici's own fetch; yarn start installs a changed lockfile - #129

Merged
munchist merged 1 commit into
mainfrom
aflow/323-undici-pair
Oct 17, 2026
Merged

munchist merged 1 commit into
mainfrom
aflow/323-undici-pair

Conversation

@munchist

Copy link
Copy Markdown
Contributor

What broke

After #127 and #128 were merged into live, every request to Ollama from the server and the executors failed with:

invalid onRequestStart method (UND_ERR_INVALID_ARG)

  • Root cause: live had not run yarn install since Oct 16, so undici@7 (added in Plan 323 — a long prompt on a local model no longer reads as an unreachable runtime #125) was never installed. @aflow/ai-client resolved jsdom's hoisted undici@8, and Node 22.16's built-in fetch, which bundles undici 6, refuses an Agent from another major version.
  • Symptoms:
    • The diagnosis reported Ollama "not answering", although it was running.
    • The banner offered Start Ollama. The host executor answered "already running", and the page re-read the same failing diagnosis, so it flickered with nothing changed.
    • Every agent turn failed, and the chat showed only "internal platform error".

The fix

  • localRuntimeFetch uses undici's own fetch with undici's Agent. Both come from one package, so the pair agrees whatever Node bundles or the install hoists.
    • Checked on the stale live checkout: undici@8's own pair reaches Ollama on Node 22.16.
  • A real-server test (localRuntimeFetch.test.ts) covers a request, a streamed body and the caller's signal. The adapter tests answer through a stubbed global fetch, so they can't cover the transport; they now mock the module.
  • yarn start installs when yarn.lock has changed since the last install (scripts/installState.mjs, from node_modules/.yarn-state.yml), before anything resolves a package. On live today it reports stale; on a fresh worktree, current.

Testing

  • @aflow/ai-client: 360 tests pass, including 3 new transport tests.
  • installState: 3 tests pass.
  • yarn typecheck passes.

🤖 Generated with Claude Code

…alls a changed lockfile

On the dev stack every request to Ollama failed with `invalid onRequestStart
method`: the checkout had not installed since undici@7 was added, so
@aflow/ai-client resolved jsdom's hoisted undici@8, and Node 22.16's own
fetch (its bundled undici 6) refuses an Agent from another major. The
diagnosis read the failure as a runtime not answering, the banner offered
Start Ollama for a runtime already running, and every agent turn failed.

- localRuntimeFetch calls undici's fetch with undici's Agent, one package,
  so the pair agrees whatever Node bundles or the install hoists. Proven on
  the stale checkout: undici@8's own pair reaches Ollama on Node 22.16.
  A real-server test covers a request, a streamed body and the caller's
  signal, which the adapter tests (answering through the global fetch) cannot.
- yarn start runs yarn install when yarn.lock changed after the last
  install, before anything resolves a package.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@munchist
munchist merged commit 76c3c5c into main Oct 17, 2026
3 checks passed
@munchist
munchist deleted the aflow/323-undici-pair branch October 17, 2026 16:24
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