Summary#
Tapping the last tool-call row before the usage-limit notice to expand it freezes the app for ~5s, then Android kills it (perceived as a crash-and-close). Diagnostics shows "No startup crashes" because this is an ANR, not a JS crash.
Environment#
- App: T3 Code 2.0.0 (store build, versionCode 82)
- Device: OnePlus 7 Pro, Android 12
- Thread:
0755ce87-5570-4f81-b7ea-8366d993cd10
Repro#
- Open the thread above.
- Tap the last tool-call row before the "Usage limit reached" notice (a
command_execution running cd … && python3 - <<'PY' heredoc, ~3k chars) to expand it.
- App freezes, then closes.
Root cause#
The tapped row's collapsed label (and expanded header) render the full multi-thousand-char command single-line (WorkLogLabel clamps to numberOfLines={1}). Android touch hit-testing measures every character offset of that line on the main thread:
waa.reactTagForTouch
→ android.text.Layout.getOffsetForHorizontal
→ android.text.TextLine.measureAllOffsets → measureRun → getRunAdvance
→ …dispatchTouchEvent (touch never delivered)
A device bugreport captured 5 identical Input dispatching timed out … Waited 500xms for MotionEvent ANRs (/data/anr, 01:25–01:30) matching the taps. mqt_js was idle in every dump — the tap never reaches JS. Measured on-screen labels for the suspect row: collapsed 2,986 chars, expanded header 2,986 chars (a sibling failed command: 3,667 chars).
Ruled out: getFullDetail()/copy-text (sub-ms), markdown parsing, shiki highlighting — none of them run before the touch completes.
Suggested fix direction#
Cap every string rendered in a single-line work-log label (~200 chars + ellipsis); keep the full text in the expanded detail view and in long-press copy text.
🤖 Generated with Claude Code
Note
Grok responding on behalf of Julius.
Thanks for the detailed report and the ANR traces. I haven't reproduced this; below is what current
main(b707eeb05) shows for the code you pointed at.Collapsed and expanded row labels aren't length-capped
command_executionrow,workEntryRowLabelreturnscompactWorkEntryText(commandDisplayText(entry.command)).compactWorkEntryTextonly collapses whitespace, so a ~3k-char heredoc becomes a ~3k-char single line, with no slicing.expandedcheck, so the expanded header gets the same string. The row computes it twice,previewTextanddisplayText, and renders it inWorkLogLabel.WorkLogLabelis a<Text numberOfLines={1} ellipsizeMode="tail">. It visually clips the text, but the full string still goes to the native text layout. The same full string is also used as the row'saccessibilityLabel.MessagesTimeline.logic.ts), but CSS truncation in the DOM probably doesn't hit this cost.Expanded body
When expanded,
toolCallLineskeeps the full command on purpose. It renders as one selectable monospace<Text>inside amax-h-60ScrollView, along with the fetched output, which also isn't virtualized. That could plausibly add layout cost on expand as well. But your traces show the stall inreactTagForTouchbefore JS gets the tap, which points at the header label rather than the body.On the root cause
Your hit-testing explanation (
getOffsetForHorizontalmeasuring every offset of a very long single-line layout) looks plausible and lines up with the stacks, but it's still a hypothesis on our side. The "last row before the usage-limit notice" detail is probably incidental: it seems to just be where the long heredoc row happened to be, and the usage-limit row itself rendersrow.summary, not the command.Suggested direction
Your proposed fix seems reasonable either way:
workEntryRowLabel(or inWorkLogLabelfor every caller) to a few hundred chars plus an ellipsis.There's an existing
truncatehelper in@t3tools/shared/Stringthat could be reused.Related
I didn't find a duplicate or an open fix PR for this.