Skip to content

Fix gaia sd terminal preview and image viewer#346

Merged
itomek merged 3 commits intomainfrom
324-fix-issue-with-sd-agent
Feb 24, 2026
Merged

Fix gaia sd terminal preview and image viewer#346
itomek merged 3 commits intomainfrom
324-fix-issue-with-sd-agent

Conversation

@itomek-amd
Copy link
Collaborator

Summary

  • Add term-image>=0.7.0,<0.8 to install_requires so terminal image rendering is always available
  • Fix broken term-image API calls (set_render_method("auto") and set_size(columns=60, fit_to_width=True)set_size(width=60)) that caused the entire term-image path to silently fail
  • Return image_path.resolve() from _save_image() so all callers get an absolute path
  • Resolve image paths defensively in cli.py before passing to os.startfile / xdg-open
  • Remove Windows-only guard on prompt_to_open; add xdg-open dispatch for Linux in both rich and text-only console branches

Closes #324

- Add term-image>=0.7.0,<0.8 to install_requires so it is always installed
- Fix broken term-image API: remove invalid set_render_method("auto") and
  replace set_size(columns=60, fit_to_width=True) with set_size(width=60)
- Return resolved absolute path from _save_image() so viewers receive a
  path they can open regardless of CWD
- Resolve image paths defensively in cli.py before passing to os.startfile/xdg-open
- Remove Windows-only guard on prompt_to_open; add xdg-open dispatch for Linux
  in both rich and text-only console branches
- Update and extend test_sd_mixin.py to assert absolute paths are returned

Fixes #324
@itomek-amd itomek-amd linked an issue Feb 20, 2026 that may be closed by this pull request
2 tasks
@github-actions github-actions bot added dependencies Dependency updates agents Agent system changes cli CLI changes tests Test changes labels Feb 20, 2026
@kovtcharov
Copy link
Collaborator

@claude review this PR.

@github-actions
Copy link

github-actions bot commented Feb 20, 2026

Claude finished @kovtcharov's task —— View job


PR Review Complete

Overall: 🟢 Looks good to merge

This PR properly fixes the SD agent terminal preview and image viewer issues. The changes are well-structured and include appropriate test coverage.


🟢 setup.py

Adding term-image>=0.7.0,<0.8 as a required dependency is correct. This ensures terminal image rendering is always available rather than being an optional feature that silently fails.

🟢 console.py (src/gaia/agents/base/console.py)

  • Fixed term-image API calls: Removed non-existent set_render_method("auto") and corrected set_size(columns=60, fit_to_width=True)set_size(width=60). These were causing silent failures.
  • Cross-platform support: Properly added xdg-open for Linux and open for macOS in both rich and text-only console branches. The platform detection pattern is idiomatic.
  • Removed Windows-only guard: The prompt_to_open now works on all platforms, which is the expected behavior.

🟢 cli.py (src/gaia/cli.py:5229, 5272)

Defensively resolving paths with str(Path(img["image_path"]).resolve()) before passing to OS commands is a good fix. This handles edge cases where relative paths might fail with external programs.

🟢 sd/mixin.py (src/gaia/sd/mixin.py:491)

Returning image_path.resolve() from _save_image() ensures all callers consistently receive absolute paths. This is the root fix that makes the cli.py changes work correctly.

🟢 test_sd_mixin.py

Good test coverage added:

  • test_init_sd_output_dir_is_absolute - Verifies output dir is stored as absolute path
  • test_generate_image_returns_absolute_path - Verifies generated image paths are absolute
  • Updated existing assertion to use output_dir.resolve() for consistency

Summary: Clean fix addressing the root cause (relative paths, broken term-image API) with proper cross-platform support and test coverage.

@itomek itomek self-assigned this Feb 24, 2026
itomek and others added 2 commits February 24, 2026 06:43
Remove hardcoded base_url from SDToolsMixin.init_sd() so LemonadeClient
resolves the URL from the LEMONADE_BASE_URL environment variable. Also
make term-image optional (extras_require["image"]) and replace the
rich-pixels fallback with a dependency-free PIL half-block renderer.
@itomek itomek marked this pull request as ready for review February 24, 2026 15:57
@itomek itomek enabled auto-merge February 24, 2026 15:57
@itomek itomek added this pull request to the merge queue Feb 24, 2026
Merged via the queue into main with commit 8d12a4a Feb 24, 2026
81 of 85 checks passed
@itomek itomek deleted the 324-fix-issue-with-sd-agent branch February 24, 2026 16:23
@itomek itomek added this to the v0.15.4.1 milestone Feb 24, 2026
This was referenced Feb 24, 2026
github-merge-queue bot pushed a commit that referenced this pull request Feb 24, 2026
## Summary

- Add release notes for v0.15.4.1 (`docs/releases/v0.15.4.1.mdx`)
- Bump `__version__` from `0.15.4` → `0.15.4.1` in `src/gaia/version.py`
- Add `releases/v0.15.4.1` to nav and update navbar label in
`docs/docs.json`

Closes #336, #339, #344, #345, #342, #348, #346

> **Note:** Do not tag `v0.15.4.1` until after this PR merges.

---------

Co-authored-by: Tomasz Iniewicz <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent system changes cli CLI changes dependencies Dependency updates tests Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix issue with SD agent

3 participants