feat(android): syntax-highlighted code blocks in chat#100217
Conversation
|
Codex review: found issues before merge. Reviewed July 5, 2026, 7:17 PM ET / 23:17 UTC. Summary PR surface: Docs +1, Other +518. Total +519 across 8 files. Reproducibility: not applicable. as a bug reproduction: this is a feature PR. Source inspection confirms current main renders Android code blocks as plain monospace, and PR comments plus the real-behavior check report exact-head emulator proof for highlighted rendering. Review metrics: 1 noteworthy metric.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review findings
Review detailsBest possible solution: Land the Android chat highlighter after resolving the release-owned changelog decision and waiting for exact-head required checks to finish. Do we have a high-confidence way to reproduce the issue? Not applicable as a bug reproduction: this is a feature PR. Source inspection confirms current main renders Android code blocks as plain monospace, and PR comments plus the real-behavior check report exact-head emulator proof for highlighted rendering. Is this the best way to solve the issue? Yes for the Android implementation shape: the bounded in-repo tokenizer avoids a new app dependency and preserves plain rendering for unknown, partial, and oversized blocks. The unresolved part is release-note ownership, not the renderer layer. Full review comments:
Overall correctness: patch is correct AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 2525ea41fd09. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Docs +1, Other +518. Total +519 across 8 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (21 earlier review cycles; latest 8 shown)
|
ea739ed to
3edabe7
Compare
|
Fresh real-device-path visual proof on exact head
This closes the prior visual-proof gap. The existing focused tests, APK build, changed-surface checks, exact-head CI, and fresh autoreview remain green. |
|
Land-ready on exact head
|
|
Land-ready at clean exact head Proof:
No known proof gaps. Ready to merge. |
Dependency graph guard clearedThis PR no longer has blocked dependency graph changes. A future dependency graph change requires a fresh
|
|
Merged via squash.
|
What Problem This Solves
Fenced code blocks in Android chat render as flat monospace text, making code-heavy assistant replies hard to scan.
Part of #100195
Why This Change Was Made
Adds a minimal in-repo tokenizer (
apps/android/app/src/main/java/ai/openclaw/app/ui/chat/ChatCodeHighlight.kt) for kotlin/swift/typescript/javascript/python/bash/json with keyword/string/comment/number classes. An external highlighting library was evaluated and rejected: ~10 months without releases/commits, single maintainer, and no JSON support, versus ~300 lines of owned, testable code with no license-screen overhead. Token colors are newMobileColorscode-palette slots (light+dark, ≥4.5:1 contrast against the code background). Streaming stays cheap: still-open fences render plain while a message streams (gated on CommonMarkclosingFenceLength+ stream state), results are memoized per block content, and blocks over 200 lines or 20k chars fall back to plain rendering.User Impact
Assistant code blocks in chat get readable, theme-aware syntax coloring in light and dark mode. Unknown languages, streaming partial blocks, and very large blocks keep today's plain rendering. No config or behavior surface changes.
Evidence
apps/android:./gradlew :app:testPlayDebugUnitTest --tests '*ChatMarkdown*' --tests '*AndroidLicenseNotices*'— 20 tests, 0 failures (same green on:app:testThirdPartyDebugUnitTest)ChatMarkdownTest.kt: known-language tokens, theme span colors, unknown-language plain fallback, open-fence detection, line/char bounds incl. exact 200-line boundary, escaped quotes, bash comment boundaries, nested block comments, multiline template literals/shell stringsKnown gap: unit-test proof only; no emulator screenshot pass of the rendered palette yet.