Skip to content

Ollama/hailo-ollama installs ignore target_remote: remote-node model installs pull onto the controller - #2463

Merged
jaylfc merged 3 commits into
devfrom
exec/tsk-mlogef
Aug 17, 2026
Merged

jaylfc merged 3 commits into
devfrom
exec/tsk-mlogef

Conversation

@jaylfc

@jaylfc jaylfc commented Aug 17, 2026

Copy link
Copy Markdown
Owner

CARD TITLE (intent, not commit subject): Ollama/hailo-ollama installs ignore target_remote: remote-node model installs pull onto the controller

Autonomous build of board card tsk-mlogef.

The ollama installer never received target_remote from install_app, so
remote-worker installs pulled models onto the controller's localhost daemon.
Add resolve_ollama_url(target_remote, backend_id) following the
resolve_rkllama_url convention: local targets use the existing defaults
(_default_host() for ollama, localhost:7836 for hailo-ollama with
TAOS_HAILO_OLLAMA_PORT override), remote targets build
http://<target_remote>: (11434 for ollama, 7836 for hailo-ollama).
Pass the resolved host through get_installer instead of the previous
hardcoded localhost:7836. Includes red-then-green regression tests through
the real get_installer path and a changelog fragment.

Files:
changelog.d/tsk-mlogef-remote-target-ollama.md | 2 +
tests/test_routes_store_install.py | 163 +++++++++++++++++++++++++
tinyagentos/installers/ollama_installer.py | 43 ++++++-
tinyagentos/routes/store_install.py | 3 +-
4 files changed, 209 insertions(+), 2 deletions(-)

Red proof (measured by the lead on the branch, 2026-08-17)

Behavioral red at the wiring layer — dev's store_install.py + this PR's tests:

FAILED tests/test_routes_store_install.py::TestOllamaRemoteTargetInstall::test_hailo_ollama_remote_target_hits_remote_worker
FAILED tests/test_routes_store_install.py::TestOllamaRemoteTargetInstall::test_plain_ollama_remote_target_hits_remote_worker
2 failed, 2 passed, 57 deselected

(the 2 passes are the local-target controls — no behavior change locally). Green: 61/61 on the branch.

Docs-Reviewed: routes/installer changes route installs to the node the UI already lets the user select; no end-user doc describes daemon-URL selection. docs/design/hailo-llm-backend.md §B stays accurate — TAOS_HAILO_OLLAMA_PORT is pre-existing (install-hailo.sh:74) and this PR makes the client honour what §B already promises. README install docs are backend-agnostic and unaffected.

Summary by CodeRabbit

  • New Features

    • Remote Ollama and Hailo-Ollama installations now pull models onto the selected remote worker.
    • Added automatic endpoint handling for local and remote installations.
    • Added configurable Hailo-Ollama ports, with safe fallback to the default when invalid values are provided.
  • Bug Fixes

    • Improved handling of Ollama hosts without URL schemes.
    • Preserved local installation defaults while correctly routing remote installations.

The ollama installer never received target_remote from install_app, so
remote-worker installs pulled models onto the controller's localhost daemon.
Add resolve_ollama_url(target_remote, backend_id) following the
resolve_rkllama_url convention: local targets use the existing defaults
(_default_host() for ollama, localhost:7836 for hailo-ollama with
TAOS_HAILO_OLLAMA_PORT override), remote targets build
http://<target_remote>:<port> (11434 for ollama, 7836 for hailo-ollama).
Pass the resolved host through get_installer instead of the previous
hardcoded localhost:7836.  Includes red-then-green regression tests through
the real get_installer path and a changelog fragment.
@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing

@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@jaylfc, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 16 minutes

Limit details: You’ve used all 2 included reviews currently available under your plan.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 2d97d930-6d5d-457d-ba5f-47eca0b03984

📥 Commits

Reviewing files that changed from the base of the PR and between c6f2179 and 77eb9f0.

📒 Files selected for processing (4)
  • changelog.d/tsk-mlogef-remote-target-ollama.md
  • tests/test_routes_store_install.py
  • tinyagentos/installers/ollama_installer.py
  • tinyagentos/routes/store_install.py
ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c814eb7c-7801-4ed8-a054-847b7d07ba65

📥 Commits

Reviewing files that changed from the base of the PR and between c6f2179 and 77eb9f0.

📒 Files selected for processing (4)
  • changelog.d/tsk-mlogef-remote-target-ollama.md
  • tests/test_routes_store_install.py
  • tinyagentos/installers/ollama_installer.py
  • tinyagentos/routes/store_install.py

📝 Walkthrough

Walkthrough

Ollama installation now resolves endpoints for local and remote targets. Standard Ollama and hailo-ollama use backend-specific ports, with environment overrides where supported. Route and unit tests cover endpoint selection and installer wiring.

Changes

Ollama remote target support

Layer / File(s) Summary
Backend endpoint resolution
tinyagentos/installers/ollama_installer.py
Added local and remote endpoint resolution for ollama and hailo-ollama, including scheme normalization, port defaults, and Hailo port validation.
Store-install endpoint wiring
tinyagentos/routes/store_install.py, changelog.d/tsk-mlogef-remote-target-ollama.md
The route passes the resolved endpoint to OllamaInstaller. The changelog records remote-worker model targeting.
Endpoint and route validation
tests/test_routes_store_install.py
Added tests for local defaults, remote targets, environment overrides, OLLAMA_HOST precedence, and installer construction.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant StoreInstall
  participant resolve_ollama_url
  participant OllamaInstaller
  StoreInstall->>resolve_ollama_url: target_remote and backend_id
  resolve_ollama_url-->>StoreInstall: resolved endpoint
  StoreInstall->>OllamaInstaller: construct installer with endpoint
Loading

Suggested reviewers: hognek

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main fix: remote Ollama and Hailo-Ollama installs incorrectly pull models onto the controller.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch exec/tsk-mlogef

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gitar-bot

gitar-bot Bot commented Aug 17, 2026

Copy link
Copy Markdown

Gitar is working

Gitar

@jaylfc

jaylfc commented Aug 17, 2026

Copy link
Copy Markdown
Owner Author

nemotron-super review

VERDICT: Blocking issues found.

  • tinyagentos/installers/ollama_installer.py:58: Missing validation of target_remote parameter allows potential URL injection.
  • tests/test_routes_store_install.py:1008: Missing test cases for invalid target_remote values (e.g., containing special characters, empty string after stripping).

Automated first-pass review by the nemotron-super lane. The lead still reviews before merge.

if not raw:
return _DEFAULT_HAILO_OLLAMA_PORT
try:
return int(raw)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

WARNING: _hailo_ollama_port() accepts invalid port values without range validation

The function only catches ValueError when converting the env var to int, but does not validate the port is within the valid range (1–65535). A misconfigured TAOS_HAILO_OLLAMA_PORT=0 or a very large value would be silently accepted, producing an invalid port that causes connection failures at runtime.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

return _DEFAULT_HAILO_OLLAMA_PORT


def resolve_ollama_url(target_remote: str | None, backend_id: str = "ollama") -> str:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

SUGGESTION: Docstring misleadingly claims all local targets use "localhost"

The docstring states "the controller's own daemon (localhost)", but for the plain ollama backend the function returns _default_host(), which can return a non-localhost URL when OLLAMA_HOST is set. The docstring should clarify that only hailo-ollama hardcodes localhost, while plain ollama honours OLLAMA_HOST.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

port = _hailo_ollama_port()
if not target_remote or target_remote == "local":
return f"http://localhost:{port}"
return f"http://{target_remote}:{port}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

SUGGESTION: target_remote is not sanitized before being interpolated into the URL

On lines 77 and 81, target_remote is used directly in an f-string to build a URL without validating or sanitizing it. A value containing special characters (e.g. spaces, slashes, or ://) would produce a malformed URL. Consider validating that target_remote matches an expected hostname/IP pattern, or at minimum rejecting strings containing ://, /, or whitespace.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

@kilo-code-bot

kilo-code-bot Bot commented Aug 17, 2026

Copy link
Copy Markdown

Code Review Summary

Status: 3 Issues Found | Recommendation: Address before merge

Overview

Severity Count
WARNING 1
SUGGESTION 2
Issue Details (click to expand)

WARNING

File Line Issue
tinyagentos/installers/ollama_installer.py 53 _hailo_ollama_port() accepts invalid port values without range validation

SUGGESTION

File Line Issue
tinyagentos/installers/ollama_installer.py 62 Docstring misleadingly claims all local targets use "localhost"
tinyagentos/installers/ollama_installer.py 77 target_remote is not sanitized before being interpolated into the URL
Files Reviewed (1 file)
  • tinyagentos/installers/ollama_installer.py - 3 issues

Fix these issues in Kilo Cloud

Previous Review Summaries (2 snapshots, latest commit de1030c)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit de1030c)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (0 files)

No code changed since the previous review (latest commit is an empty CI merge-ref refresh). Previous findings remain on unchanged lines and are not re-reported here.

Previous review (commit 1429425)

Status: 3 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 2
Issue Details (click to expand)

WARNING

File Line Issue
tinyagentos/installers/ollama_installer.py 53 _hailo_ollama_port() accepts invalid port values without range validation

SUGGESTION

File Line Issue
tinyagentos/installers/ollama_installer.py 62 Docstring misleadingly claims all local targets use "localhost"
tinyagentos/installers/ollama_installer.py 77 target_remote is not sanitized before being interpolated into the URL
Files Reviewed (3 files)
  • tinyagentos/installers/ollama_installer.py - 3 issues
  • tinyagentos/routes/store_install.py
  • tests/test_routes_store_install.py

Fix these issues in Kilo Cloud


Reviewed by step-3.7-flash · Input: 122.8K · Output: 23.4K · Cached: 603.4K

@jaylfc

jaylfc commented Aug 17, 2026

Copy link
Copy Markdown
Owner Author

Reviewed vs card tsk-mlogef + nemotron/Kilo. APPROVED with dispositions; doc-gate satisfied via body trailer; one class card cut.

Contract: delivered. resolve_ollama_url(target_remote, backend_id) mirrors the resolve_rkllama_url convention exactly (local → _default_host()/localhost:7836, remote → http://<host>:<port>, TAOS_HAILO_OLLAMA_PORT honoured — the env var is pre-existing and §B-documented, this PR makes the client honour it). Wiring passes the resolved host through the REAL get_installer path for both backends; OllamaInstaller.__init__ defaults to _default_host() so explicit-local is behavior-identical (control verified).

Red proof (was missing from the body — measured by me, now appended there): dev's wiring + this PR's tests = both remote-target tests FAIL (install captured localhost), both local controls pass; 61/61 green on the branch. Note the pure-dev red is a collection error (the helper doesn't exist to import), so the behavioral red was run at the wiring layer — right granularity for the defect.

nemotron BLOCKING (target_remote URL injection) + Kilo S77 — CONFIRMED as a real hole but PRE-EXISTING CLASS, not introduced here: resolve_rkllama_url on dev interpolates the same unvalidated string, and get_device_capability accepts unknown workers via stub capability. Measured live: attacker.example.com:9999/pull?x= flows into both helpers' URLs unchecked. Blocking THIS PR would fix one of three sites; the fix belongs at the install API boundary, once. CARDED tsk-3rontv (400 on non-registered/malformed target, red-first, sweep all interpolation sites).

Kilo W53 (port range validation) — declined: non-integer override warns and falls back, matching the install script's own ${TAOS_HAILO_OLLAMA_PORT:-7836} tolerance; range-checking an operator-set env var is churn without a failure mode observed. Kilo S62 (docstring "localhost" claim) — declined cosmetic: the docstring's Ports section already states _default_host honours OLLAMA_HOST.

Merge chain: on green (incl. bot-review-gate CR review), merge + close tsk-mlogef.

@jaylfc

jaylfc commented Aug 17, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.


Your included review limit is currently reached under our Fair Usage Limits Policy. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 47 minutes.

@jaylfc

jaylfc commented Aug 17, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown
✅ Action performed

Full review finished.

jaylfc added 2 commits August 17, 2026 06:19
Empty commit: re-mints the PR merge ref so deleted-symbols-gate re-runs
against current dev (its red was the two-snapshot false positive fixed by
#2464) and doc-gate re-runs past the Docs-Reviewed body trailer.
Docs-Reviewed: bug fix inside existing install endpoint and ollama installer; no route surface or installer-flow change; user-facing behavior recorded in changelog.d/tsk-mlogef-remote-target-ollama.md
@jaylfc
jaylfc merged commit fec0d99 into dev Aug 17, 2026
24 checks passed
@jaylfc

jaylfc commented Aug 17, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Pull request is closed.

@jaylfc

jaylfc commented Aug 17, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.


Your included review limit is currently reached under our Fair Usage Limits Policy. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 16 minutes.

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