feat(image-tool): richer model controls for agents#297
Conversation
The agent-facing image tool was prompt/size/steps/seed only. Agents couldn't choose models, tune guidance, or supply a negative prompt. For real creative workflows that's not enough. Adds: - list_image_models tool — returns installed image-gen models (joins /api/models with /api/models/loaded for an at-a-glance view of what's available and warm) - generate_image gains optional model, guidance_scale, negative_prompt params. When model is supplied, calls route via the controller's scheduler (/api/images/generate) so model→backend routing and NPU/CPU fallback still work - skill registry + skill-exec dispatch wired for both tools - Don's role brief in the dumby user-sim updated with a recommended workflow (list → pick → generate, with guidance heuristics) 11/11 new + extended tests pass.
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds a new Changes
Sequence DiagramsequenceDiagram
participant Client as Client/Agent
participant SkillRuntime as Skill Runtime
participant ImageTool as Image Tool
participant Controller as Controller
participant Backend as Image Backend
Note over Client,SkillRuntime: Controller-Based Flow
Client->>SkillRuntime: POST /api/skill-exec/image_generation/call\n(params: model?, guidance_scale, negative_prompt, prompt, seed)
SkillRuntime->>ImageTool: execute_image_generation(params)
ImageTool->>Controller: POST /api/images/generate\n(include model if provided, guidance_scale, negative_prompt, prompt, seed)
Controller->>Backend: route request to model backend
Backend-->>Controller: PNG binary
Controller-->>ImageTool: Image bytes
ImageTool-->>SkillRuntime: {success:true, image_b64:"..."}
SkillRuntime-->>Client: 200 {success:true, image_b64:"..."}
Note over Client,SkillRuntime: Fallback Flow (controller unreachable)
Client->>SkillRuntime: POST /api/skill-exec/image_generation/call\n(prompt, seed)
SkillRuntime->>ImageTool: execute_image_generation(no model)
ImageTool->>Backend: POST /v1/images/generations\n(prompt, seed[, negative_prompt])
Backend-->>ImageTool: PNG binary
ImageTool-->>SkillRuntime: {success:true, image_b64:"..."}
SkillRuntime-->>Client: 200 {success:true, image_b64:"..."}
Note over Client,SkillRuntime: List Models Flow
Client->>SkillRuntime: POST /api/skill-exec/list_image_models/call
SkillRuntime->>ImageTool: execute_list_image_models()
ImageTool->>Controller: GET /api/models
Controller-->>ImageTool: {models: [...]}
ImageTool->>Controller: GET /api/models/loaded
Controller-->>ImageTool: {loaded: [...]}
ImageTool-->>SkillRuntime: {success:true, models:[...]}
SkillRuntime-->>Client: 200 {success:true, models:[...]}
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Review rate limit: 8/10 reviews remaining, refill in 6 minutes and 24 seconds. Comment |
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (7 files)
Reviewed by grok-code-fast-1:optimized:free · 223,860 tokens |
| }, | ||
| "model": { | ||
| "type": "string", | ||
| "description": "Pick from list_image_models output. Omit to let the scheduler choose.", |
There was a problem hiding this comment.
WARNING: Misleading description for model parameter
The description states "Omit to let the scheduler choose," but omitting the model parameter actually routes to the direct backend for backward compatibility, not the scheduler. This could confuse agents relying on the schema description.
| "description": "Pick from list_image_models output. Omit to let the scheduler choose.", | |
| "description": "Specify a model from list_image_models output to route through the scheduler. Omit for direct backend call (backward compatibility).", |
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tests/e2e_user_sim/dumby/roles.md`:
- Around line 20-21: The prose line starting with "@don has access to two
image-gen tools..." breaks the markdown table; relocate that sentence so the
table remains contiguous (move it below the table, after the row containing
"linus | langroid | 🧠 | `#a855f7` | Multi-step reasoning + HTML/web") or
convert the note into a properly formatted table row or callout so it doesn't
interrupt the table rendering; ensure the original "linus | langroid | 🧠 |
`#a855f7` | Multi-step reasoning + HTML/web" row remains unchanged and the table
header/rows remain contiguous.
In `@tinyagentos/skills.py`:
- Around line 198-215: The new "list_image_models" skill is only added in
_seed_defaults when the skills table is empty, so existing DBs won't get it;
modify _seed_defaults (or add a dedicated _ensure_default_skill helper) to
perform an upsert based on the skill's unique "id" ("list_image_models") so that
if a row with that id exists it is updated and if not it is inserted; ensure the
upsert uses the same identifying fields (id) and updates properties like name,
description, tool_schema, frameworks, install_method, and install_target
(tinyagentos.tools.image_tool) so upgrades add or refresh this default skill
without requiring an empty skills table.
- Around line 181-187: The advertised JSON schema for the generate_image tool is
missing the "steps" and "seed" properties even though runtime
(tinyagentos/routes/skill_exec.py) forwards them and
tinyagentos/tools/image_tool.py supports them; update the schema for
generate_image (the dict that currently defines
"prompt","size","model","guidance_scale","negative_prompt" and "required":
["prompt"]) to add "steps" (number/integer, sensible default) and "seed"
(integer, optional) and include them in the properties so agents can discover
and pass these parameters.
In `@tinyagentos/tools/image_tool.py`:
- Around line 32-35: The "model" field description is misleading: update the
schema entries where the "model" key is defined (the "model" property in the
image tool schema around the shown blocks) to reflect actual behavior —
explicitly state that providing a model routes execution through the scheduler,
while omitting it will NOT trigger scheduler selection; change both occurrences
(the first block and the one around lines 168-170) to this corrected wording so
agents aren't misled.
- Around line 182-184: The current branch treats empty-string model values as
present because it checks only "if model is not None", causing invalid model
identifiers to be sent; change the guard to treat blank/whitespace-only strings
as absent (e.g., use a truthy check like "if model and model.strip()") so that
only non-empty models set effective_model and target_url; update usage around
effective_model, model, and controller_url in image_tool.py to follow this new
guard so the non-model fallback behavior remains intact.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 7ba74c60-630b-4424-84b3-6676cf2a015f
📒 Files selected for processing (6)
tests/e2e_user_sim/dumby/roles.mdtests/test_image_tool.pytests/test_skill_runtime.pytinyagentos/routes/skill_exec.pytinyagentos/skills.pytinyagentos/tools/image_tool.py
| @don has access to two image-gen tools: `list_image_models` (discover what's installed) and `generate_image` (text-to-image, with optional `model`, `guidance_scale`, `negative_prompt`). Recommended workflow: list → pick the model that fits the task (LCM models = fast and stylized; full SD/SDXL = slower, more photorealistic) → generate with `guidance_scale=7.5` for balanced output, raise to 10–12 if the model is ignoring details, lower to 4–6 for more artistic interpretation. | ||
| | linus | langroid | 🧠 | `#a855f7` | Multi-step reasoning + HTML/web | |
There was a problem hiding this comment.
Keep the team roster table structurally intact.
The prose note at Line 20 interrupts the markdown table, so rows starting at Line 21 may stop rendering as part of the table. Move this note below the table (after Line 23) or format it as a table row/callout.
💡 Suggested edit
-| `@don` has access to two image-gen tools: `list_image_models` (discover what's installed) and `generate_image` (text-to-image, with optional `model`, `guidance_scale`, `negative_prompt`). Recommended workflow: list → pick the model that fits the task (LCM models = fast and stylized; full SD/SDXL = slower, more photorealistic) → generate with `guidance_scale=7.5` for balanced output, raise to 10–12 if the model is ignoring details, lower to 4–6 for more artistic interpretation.
| linus | langroid | 🧠 | `#a855f7` | Multi-step reasoning + HTML/web |
| pat | pocketflow | 🌊 | `#f59e0b` | Graph/flow thinking — marketing strategy + plans |
| olive | openai-agents-sdk | 🫒 | `#06b6d4` | Final QA cross-review |
+
+@don has access to two image-gen tools: `list_image_models` (discover what's installed) and `generate_image` (text-to-image, with optional `model`, `guidance_scale`, `negative_prompt`). Recommended workflow: list → pick the model that fits the task (LCM models = fast and stylized; full SD/SDXL = slower, more photorealistic) → generate with `guidance_scale=7.5` for balanced output, raise to 10–12 if the model is ignoring details, lower to 4–6 for more artistic interpretation.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@tests/e2e_user_sim/dumby/roles.md` around lines 20 - 21, The prose line
starting with "@don has access to two image-gen tools..." breaks the markdown
table; relocate that sentence so the table remains contiguous (move it below the
table, after the row containing "linus | langroid | 🧠 | `#a855f7` | Multi-step
reasoning + HTML/web") or convert the note into a properly formatted table row
or callout so it doesn't interrupt the table rendering; ensure the original
"linus | langroid | 🧠 | `#a855f7` | Multi-step reasoning + HTML/web" row
remains unchanged and the table header/rows remain contiguous.
| "prompt": {"type": "string"}, | ||
| "size": {"type": "string", "default": "512x512"}, | ||
| "model": {"type": "string"}, | ||
| "guidance_scale": {"type": "number", "default": 7.5}, | ||
| "negative_prompt": {"type": "string", "default": ""}, | ||
| }, | ||
| "required": ["prompt"], |
There was a problem hiding this comment.
Expose steps and seed in the advertised generate_image schema.
The seeded tool schema omits steps/seed, but runtime accepts both (tinyagentos/routes/skill_exec.py forwards them and tinyagentos/tools/image_tool.py supports them). This under-advertises capabilities during tool discovery and can prevent agents from using reproducibility/step control.
🔧 Suggested schema patch
"properties": {
"prompt": {"type": "string"},
"size": {"type": "string", "default": "512x512"},
+ "steps": {"type": "integer", "default": 4, "minimum": 1, "maximum": 8},
+ "seed": {"type": "integer"},
"model": {"type": "string"},
"guidance_scale": {"type": "number", "default": 7.5},
"negative_prompt": {"type": "string", "default": ""},
},🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@tinyagentos/skills.py` around lines 181 - 187, The advertised JSON schema for
the generate_image tool is missing the "steps" and "seed" properties even though
runtime (tinyagentos/routes/skill_exec.py) forwards them and
tinyagentos/tools/image_tool.py supports them; update the schema for
generate_image (the dict that currently defines
"prompt","size","model","guidance_scale","negative_prompt" and "required":
["prompt"]) to add "steps" (number/integer, sensible default) and "seed"
(integer, optional) and include them in the properties so agents can discover
and pass these parameters.
| { | ||
| "id": "list_image_models", | ||
| "name": "List Image Models", | ||
| "category": "media", | ||
| "description": "Discover installed image-generation models", | ||
| "tool_schema": { | ||
| "name": "list_image_models", | ||
| "description": "List installed image-generation models the agent can pick from", | ||
| "input_schema": {"type": "object", "properties": {}}, | ||
| }, | ||
| "frameworks": { | ||
| "smolagents": "adapter", "openclaw": "adapter", "pocketflow": "adapter", | ||
| "langroid": "adapter", "hermes": "adapter", "agent-zero": "adapter", | ||
| "openai-agents-sdk": "adapter", "generic": "adapter", | ||
| }, | ||
| "install_method": "builtin", | ||
| "install_target": "tinyagentos.tools.image_tool", | ||
| }, |
There was a problem hiding this comment.
New default skill won’t appear for existing databases without a migration/upsert path.
list_image_models is only inserted through _seed_defaults, which currently runs only when the skills table is empty. Existing deployments with pre-seeded rows won’t receive this new skill after upgrade.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@tinyagentos/skills.py` around lines 198 - 215, The new "list_image_models"
skill is only added in _seed_defaults when the skills table is empty, so
existing DBs won't get it; modify _seed_defaults (or add a dedicated
_ensure_default_skill helper) to perform an upsert based on the skill's unique
"id" ("list_image_models") so that if a row with that id exists it is updated
and if not it is inserted; ensure the upsert uses the same identifying fields
(id) and updates properties like name, description, tool_schema, frameworks,
install_method, and install_target (tinyagentos.tools.image_tool) so upgrades
add or refresh this default skill without requiring an empty skills table.
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
tinyagentos/tools/image_tool.py (1)
182-184:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winTreat blank
modelvalues as absent.
if model is not Nonestill sends""/ whitespace-only values down the scheduler path, which will produce an invalid model identifier. Guard on a non-empty string so the legacy fallback remains reachable.🧩 Suggested fix
- if model is not None: - effective_model = model + if isinstance(model, str) and model.strip(): + effective_model = model.strip()🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tinyagentos/tools/image_tool.py` around lines 182 - 184, The current check uses "if model is not None" which still treats empty or whitespace-only strings as present; change the guard to treat blank strings as absent by checking for a non-empty, non-whitespace string (e.g., if model and model.strip():) before setting effective_model and target_url so legacy fallback remains reachable; update the block that assigns effective_model and target_url (variables: model, effective_model, controller_url, target_url) to only run when the model value is a non-empty trimmed string.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tinyagentos/tools/image_tool.py`:
- Around line 36-41: The guidance_scale schema's description uses en-dashes in
the ranges ("1–4", "10–15") which triggers lint RUF001; update the description
string in the guidance_scale object (the "guidance_scale" dict) to use plain
ASCII hyphens ("1-4", "10-15") so the help text is lint-clean while leaving all
other keys (type, default, minimum, maximum) unchanged.
---
Duplicate comments:
In `@tinyagentos/tools/image_tool.py`:
- Around line 182-184: The current check uses "if model is not None" which still
treats empty or whitespace-only strings as present; change the guard to treat
blank strings as absent by checking for a non-empty, non-whitespace string
(e.g., if model and model.strip():) before setting effective_model and
target_url so legacy fallback remains reachable; update the block that assigns
effective_model and target_url (variables: model, effective_model,
controller_url, target_url) to only run when the model value is a non-empty
trimmed string.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: ee3d0471-3b57-43cd-a95f-7d1592128ed2
📒 Files selected for processing (1)
tinyagentos/tools/image_tool.py
…lways Two hardcodings of "lcm-dreamshaper-v7" left the tool broken for anyone not on a Pi NPU. NVIDIA GPU users hitting the scheduler with no model selected would get routed to a backend that doesn't have that checkpoint installed; agents calling the tool with no model would skip the scheduler entirely and call a fixed Pi-only path. - routes/images.py: GenerateRequest.model default goes from "lcm-dreamshaper-v7" to "" so the scheduler picks based on what's installed on the host, not what's installed on a Pi. - tools/image_tool.py: execute_image_generation always tries the scheduler first, regardless of whether a model is supplied. The direct-backend fallback fires only on connect failure (e.g. an LXC agent whose localhost can't see the controller) and even then the fallback omits the model field so the local backend serves its loaded checkpoint rather than a pinned name. - Treat blank/whitespace model strings as absent (CodeRabbit catch). - Replace en-dashes with ASCII hyphens in the guidance_scale help text to clear Ruff RUF001. - Tool description for `model` updated to reflect the new behavior. - Tests updated to assert scheduler-by-default + connect-failure fallback. 23/23 image-related tests pass.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/test_image_tool.py (1)
16-19: ⚡ Quick winRemove duplicate
httpximport.
httpxis imported twice (lines 16 and 19).🧹 Suggested fix
import httpx import pytest -import httpx🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/test_image_tool.py` around lines 16 - 19, There is a duplicated import of the same module (httpx); remove the redundant import so httpx is only imported once at the top of the test module (keep a single import httpx and adjust surrounding imports if needed to preserve import order).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@tests/test_image_tool.py`:
- Around line 16-19: There is a duplicated import of the same module (httpx);
remove the redundant import so httpx is only imported once at the top of the
test module (keep a single import httpx and adjust surrounding imports if needed
to preserve import order).
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: bcbb6fa9-f1cd-45d2-8123-1bdd258c9219
📒 Files selected for processing (3)
tests/test_image_tool.pytinyagentos/routes/images.pytinyagentos/tools/image_tool.py
✅ Files skipped from review due to trivial changes (1)
- tinyagentos/routes/images.py
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
tests/test_image_tool.py (1)
263-304:⚠️ Potential issue | 🟠 Major | ⚡ Quick winFallback “must not pin model” is not actually tested (Line 263).
The test docstring says fallback must not pin a model, but the call omits
model, so the assertion is vacuous. This misses the real regression case (non-emptymodel+ controller down).Suggested fix to exercise the real requirement
@@ with patch("httpx.AsyncClient", return_value=mock_client): result = await execute_image_generation( prompt="a red barn", + model="lcm-dreamshaper-v7", backend_url="http://localhost:8080", seed=7, ) @@ # Direct fallback does NOT pin a model name. assert "model" not in captured_body🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/test_image_tool.py` around lines 263 - 304, The test currently never exercises the regression because execute_image_generation is called without a model so asserting "model" not in captured_body is vacuous; update the test_image_generation_falls_back_on_controller_unreachable test to call execute_image_generation with a non-empty model (e.g., model="gpt-image-1") so the first attempt would include a model, then keep the fake_post and captured_body logic and assert that after the controller ConnectError the fallback POST to "/v1/images/generations" does not include the "model" key in captured_body; reference the test function name test_image_generation_falls_back_on_controller_unreachable, the execute_image_generation call, and the captured_body/fake_post variables when making this change.
🧹 Nitpick comments (1)
tests/test_image_tool.py (1)
151-188: ⚡ Quick winAssert scheduler routing when
modelis provided (Line 151).This test validates payload forwarding but not the required route selection. Add a URL assertion so regressions to non-scheduler endpoints are caught.
Suggested test hardening
@@ - captured_payload: dict = {} + captured_payload: dict = {} + captured_url: dict = {} async def fake_post(url, json=None, **kwargs): + captured_url["url"] = url captured_payload.update(json or {}) return mock_resp @@ assert result["success"] is True + assert "/api/images/generate" in captured_url["url"] assert captured_payload["model"] == "lcm-dreamshaper-v7" assert captured_payload["guidance_scale"] == 10.0 assert captured_payload["negative_prompt"] == "blurry, low quality" assert captured_payload["seed"] == 42🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/test_image_tool.py` around lines 151 - 188, The test test_image_generation_forwards_new_params currently only verifies the JSON payload but not which endpoint was called; modify the fake_post async function used with AsyncClient to capture the url argument (e.g., store it in a captured_url variable) in addition to the JSON payload, then add an assertion after the call to execute_image_generation that the captured URL matches the scheduler route used when a model is provided (for example assert captured_url contains the scheduler path or expected hostname/route used by execute_image_generation), referencing the test name test_image_generation_forwards_new_params and the execute_image_generation call so the assertion prevents regressions to non-scheduler endpoints.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@tests/test_image_tool.py`:
- Around line 263-304: The test currently never exercises the regression because
execute_image_generation is called without a model so asserting "model" not in
captured_body is vacuous; update the
test_image_generation_falls_back_on_controller_unreachable test to call
execute_image_generation with a non-empty model (e.g., model="gpt-image-1") so
the first attempt would include a model, then keep the fake_post and
captured_body logic and assert that after the controller ConnectError the
fallback POST to "/v1/images/generations" does not include the "model" key in
captured_body; reference the test function name
test_image_generation_falls_back_on_controller_unreachable, the
execute_image_generation call, and the captured_body/fake_post variables when
making this change.
---
Nitpick comments:
In `@tests/test_image_tool.py`:
- Around line 151-188: The test test_image_generation_forwards_new_params
currently only verifies the JSON payload but not which endpoint was called;
modify the fake_post async function used with AsyncClient to capture the url
argument (e.g., store it in a captured_url variable) in addition to the JSON
payload, then add an assertion after the call to execute_image_generation that
the captured URL matches the scheduler route used when a model is provided (for
example assert captured_url contains the scheduler path or expected
hostname/route used by execute_image_generation), referencing the test name
test_image_generation_forwards_new_params and the execute_image_generation call
so the assertion prevents regressions to non-scheduler endpoints.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: b2db29d1-e5a4-4f71-9e5d-437cceb4d322
📒 Files selected for processing (1)
tests/test_image_tool.py
- forwards_new_params: also assert the call hits /api/images/generate (the scheduler) so a regression to a non-scheduler endpoint can't pass silently. - falls_back_on_controller_unreachable: split into two sub-cases. With a user-supplied model, both scheduler and fallback POSTs forward it (user input wins). Without one, the fallback also omits the model field — that's the heterogeneous-hardware guard. The previous single-case version passed vacuously because it never supplied a model on the first leg.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tests/test_image_tool.py`:
- Line 49: The test mocks use "backend": ["rknn-sd"] (a list) for the "variants"
entries, but the production path in tinyagentos/tools/image_tool.py checks
v.get("backend") as a string; update the mocked variants (the dicts with "id":
"rknn") so their "backend" value is a plain string "rknn-sd" (not a list) at all
three occurrences to match v.get("backend") checks and exercise the intended
code path and assertions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 2b5c6c32-0335-4c87-8479-b367608b3891
📒 Files selected for processing (1)
tests/test_image_tool.py
| "id": "lcm-dreamshaper-v7", | ||
| "name": "LCM Dreamshaper v7", | ||
| "capabilities": ["image-generation"], | ||
| "variants": [{"id": "rknn", "backend": ["rknn-sd"]}], |
There was a problem hiding this comment.
Mock variants.backend shape is inconsistent with the code path under test.
At Line 49, Line 57, and Line 103, backend is mocked as a list, but tinyagentos/tools/image_tool.py currently compares v.get("backend") directly against a string set. This can break the test path before assertions and hide the intended regression coverage.
Proposed fix
- "variants": [{"id": "rknn", "backend": ["rknn-sd"]}],
+ "variants": [{"id": "rknn", "backend": "rknn-sd"}],
...
- "variants": [{"id": "q4", "backend": ["rkllama"]}],
+ "variants": [{"id": "q4", "backend": "rkllama"}],
...
- "variants": [{"id": "fp16", "backend": ["sd-cpp"]}],
+ "variants": [{"id": "fp16", "backend": "sd-cpp"}],Also applies to: 57-57, 103-103
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@tests/test_image_tool.py` at line 49, The test mocks use "backend":
["rknn-sd"] (a list) for the "variants" entries, but the production path in
tinyagentos/tools/image_tool.py checks v.get("backend") as a string; update the
mocked variants (the dicts with "id": "rknn") so their "backend" value is a
plain string "rknn-sd" (not a list) at all three occurrences to match
v.get("backend") checks and exercise the intended code path and assertions.
Summary
Test plan
Summary by CodeRabbit
New Features
Documentation
Tests