NVIDIA / NVIDIA/NemoClaw

[Ubuntu 24.04][Agent&Skills] OpenClaw TUI strips __double_underscores__ inside code blocks — Python dunder syntax corrupted

Open
#4,849 1 comment 0 reactions 1 assignee Claimed by @wscurran View on GitHub
area: ui integration: openclaw needs: unblock NV QA platform: ubuntu
Dominant language
TypeScript
Stars
22.5k
Forks
3.1k
Avg merge
1d 1h
Merged PRs (30d)
715

Description

## Description

The OpenClaw TUI markdown renderer treats `__` (double-underscore pairs) as bold markers even inside fenced code blocks. Python code containing dunder syntax (`__name__`, `__main__`, `__init__`, etc.) is displayed with the underscores removed, corrupting the code shown to the user. Confirmed on NemoClaw v0.0.59 with both Nano Omni 30B and Ultra 550B. The API response contains the correct text — this is a client-side rendering bug.

## Environment

```text
Device: Ubuntu 24.04 server (galaxy-sku2-018, aarch64)
OS: Ubuntu 24.04.4 LTS
Architecture: aarch64
Node.js: v22.22.3
npm: 10.9.8
Docker: 29.5.2
OpenShell CLI: 0.0.44
NemoClaw: v0.0.59
OpenClaw: 2026.5.27 (27ae826)
```

## Steps to Reproduce

1. `nemoclaw onboard` with any NVIDIA Endpoints model (e.g. `nvidia/nemotron-3-nano-omni-30b-a3b-reasoning`)
2. `nemoclaw my-assistant connect && openclaw tui`
3. Send: `Write a Python function that uses if __name__ == "__main__":`
4. Observe the model response in the TUI

## Expected Result

Code block displays verbatim Python: `if __name__ == "__main__":`. Function names like `is_palindrome` display on a single line.

## Actual Result

```text
if name == "main":
def is
_palindrome(s: str) -> bool:
```

`__name__` becomes `name`, `__main__` becomes `main`. Function name `is_palindrome` splits at the underscore: `"def is"` on one line, `"_palindrome(s: str) -> bool:"` on the next.

## Logs

API-level verification confirms the raw response from `inference.local` contains the correct text:

```text
"if __name__ == \"__main__\":"
```

This confirms the corruption is in TUI rendering, not in model output.

TUI screen capture (`tmux capture-pane`):

```text
if name == "main":
def is
_palindrome(s: str) -> bool:
...
```

Root cause: The markdown renderer applies inline bold formatting (`__text__` → bold) even inside fenced code blocks. Python dunders (`__name__`, `__init__`, etc.) are treated as bold markers, stripping the `__` pairs. Single underscores in identifiers (`is_palindrome`) are treated as italic openers, causing line breaks at the underscore position. Fix: skip bold/italic parsing for tokens inside code fences and inline code spans (CommonMark spec explicitly excludes formatting inside code spans).

---
[NVB#6272825](https://nvbugspro.nvidia.com/bug/6272825)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.