Skip to content

fix(widgets): sanitize and escape subprocess output to prevent MarkupError crash - #19

Merged
castrojo merged 10 commits into
mainfrom
feat/amd-rocm-ai-screen
Jun 30, 2026
Merged

fix(widgets): sanitize and escape subprocess output to prevent MarkupError crash#19
castrojo merged 10 commits into
mainfrom
feat/amd-rocm-ai-screen

Conversation

@castrojo

Copy link
Copy Markdown
Contributor

Addresses dakota #1119. Escapes dynamic content and strips ANSI escape sequences in OpsBar, and disables markup for raw text Labels in OperationModal.

Jorge Castro and others added 10 commits June 22, 2026 01:04
_discover_stacks() previously returned an empty list when
/usr/share/ublue-os/{nvidia,amd}-stacks/ did not exist. This made
the Stacks tab blank on dev machines and on any system where the
image has not yet installed the stacks into /usr/share.

Now falls back to the bundled stacks/ directory inside the package
(stacks/amd/ or stacks/nvidia/) so the catalog is always populated.

Assisted-by: Claude Sonnet 4.6 via GitHub Copilot
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Ollama on Linux has known issues. RamaLama is the OCI-native
replacement — it auto-detects ROCm, uses quay.io/ramalama/ramalama,
exposes an OpenAI-compatible API on port 8080, and serves
llama3.2:3b by default (4 GB VRAM, same slot order 10).

Assisted-by: Claude Sonnet 4.6 via GitHub Copilot
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Replace GpuCard (5-row AdwPreferencesGroup) with GpuStatusBar —
  a single compact line: vendor · VRAM · kfd status · render group status
- Add render group check (_check_render_group) shown inline in status bar
- Add STACK_ARCH field (strix-halo) to Llama Strix and Llama Vulkan;
  arch badge shown in list and detail pane title
- Add STACK_LONG_DESC to all 6 AMD stacks; detail pane shows full
  description instead of the truncated one-liner
- Remove action hints from detail pane body — footer carries them
- Collapse detail pane meta to one line: category · VRAM · disk · status
- Parse arch and long_description in _discover_stacks()
- No buttons anywhere in the AI screen

Assisted-by: Claude Sonnet 4.6 via GitHub Copilot
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
When deploying a KFD/ROCm stack (detected via AddDevice=/dev/kfd in
the container file), check if the user is in the render group. If not,
run pkexec usermod -aG render as the first step in OperationModal.

- requires_kfd field on AIStack — auto-detected from container file
- Preflight runs silently if user is already in render group (no extra step)
- Group change is best-effort: deploy continues even if pkexec is cancelled
- Note surfaced to user: change takes effect on next login

No buttons. No separate modal. Fits naturally into the existing
OperationModal progress flow.

Assisted-by: Claude Sonnet 4.6 via GitHub Copilot
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…dlets

_copy_quadlets() was doing a plain file copy, leaving literal
${ROCM_VERSION} and ${NGC_MONTH} in deployed quadlet files.
podman would then fail to pull images with those strings in the tag.

Now reads stacks/amd/rocm-version and stacks/nvidia/ngc-month,
substitutes before writing to ~/.config/containers/systemd/.
File permissions are preserved via shutil.copystat.

rocm-version: 7.2.4
ngc-month:    25.06

Assisted-by: Claude Sonnet 4.6 via GitHub Copilot
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…op Ollama

Toggle model:
- [s] now runs remove_stack_steps: stop + disable + delete quadlet
  files + daemon-reload. Stack returns to AVAILABLE after removal.
- action_stop_stack renamed to action_remove_stack; binding label
  updated from 'Stop' to 'Remove'
- Confirmation modal explains workspace data is preserved

GPU status bar:
- AMD line now appends 'ROCm X.Y.Z' from stacks/amd/rocm-version

Stack-env variable substitution:
- _copy_quadlets now reads the stack's own stack.env alongside the
  global rocm-version/ngc-month files and substitutes all ${VAR}
  patterns — covers LLAMA_MODEL, VLLM_MODEL, etc.

Registry:
- Removed Ollama from AI_TOOL_REGISTRY (stack dropped, CLI not recommended)

Assisted-by: Claude Sonnet 4.6 via GitHub Copilot
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Covers all patterns established in this session:
- AMD deployment model (kernel on host, ROCm in containers)
- Bundled fallback via importlib.resources
- rocm-version file, all variable substitution layers
- AIStack dataclass with arch, long_description, requires_kfd fields
- GpuStatusBar (single-line, no AdwPreferencesGroup)
- Toggle lifecycle (Deploy/Remove, no persistent-stopped state)
- Render group preflight in deploy flow
- No buttons, no Ollama
- Updated common-mistakes and verification checklist

Assisted-by: Claude Sonnet 4.6 via GitHub Copilot
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…login

The previous wording said the fix was 'transparent to the user' and applied
at deploy time. The code reports 'effective on next login' (ai.py:607-613)
and does not refresh the current session's groups, so current-session deploys
can still fail if render access is required.

Assisted-by: Claude Sonnet 4.6 via pi
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…Error crash

Escape dynamic content/subprocess output and strip ANSI escape sequences in OpsBar, and disable markup for raw text Labels in OperationModal.

Assisted-by: Gemini 3.5 Flash via Copilot CLI
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…GID check

- Escape completed ticker steps using escape() in OpsBar to prevent MarkupError crash
- Explicitly disable markup (markup=False) in ConfirmModal, InputModal, OperationLogModal, and HelpModal to prevent MarkupError crashes on brackets
- Fix false positive render: not in group warning by returning True when render group is absent on host

Assisted-by: Gemini 3.5 Flash via Copilot CLI
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@castrojo
castrojo merged commit 0568f15 into main Jun 30, 2026
@castrojo
castrojo deleted the feat/amd-rocm-ai-screen branch June 30, 2026 04:57
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