Since you wanted to know more. Here is the bug report, drafted by SuperGrok AI agent.
Bug / Model Capability Report
Title: SuperGrok (Grok 4.5 Expert) fails to diagnose Zsh TRAPWINCH BUFFER restoration limitation and produces only vacuous/guess-based fixes, while Gemini 3.1 Pro solves it correctly after one clarification
Date: 2026-08-01
Reporter: Mahmoud (SuperGrok subscriber)
Model under test: SuperGrok / Grok 4.5 Expert
Comparison model: Gemini 3.1 Pro
Summary
I spent more than one hour trying to get SuperGrok to produce a working fix for a common but non-trivial Zsh problem: correctly restoring the last command into the prompt after a terminal resize (WINCH) when using the Jonathan Oh My Zsh theme. The model repeatedly generated non-working or “vacuous” code (code that runs but does not achieve the intended visual result). It never identified the actual root cause (BUFFER is not writable from inside TRAPWINCH) and never proposed the standard solution of a custom ZLE widget.
After the same problem description was given to Gemini 3.1 Pro, the model failed on the first attempt but, once I clarified the exact symptom (“after clearing the screen and resetting the prompt, the buffer is not shown”), it immediately diagnosed the issue and produced a correct, working solution using a custom ZLE widget.
This is a clear capability gap in deep Zsh/ZLE reasoning and in moving from symptom → root cause → correct API usage, rather than iterative guessing.
Problem Being Solved
When the terminal is resized, the Jonathan theme needs to:
- Detect the real size change (with debouncing).
- Call
theme_precmd.
- Clear the screen + scrollback.
- Restore the previous command into the new prompt so the user still sees what they typed.
The critical technical constraint is that inside a TRAPWINCH handler the ZLE variables BUFFER and CURSOR are not writable. Writing to them (or using zle -U) does not reliably put the command back into the editor.
Code Produced by SuperGrok (non-working)
typeset -g _jonathan_prev_cols=$COLUMNS
typeset -g _jonathan_prev_lines=$LINES
typeset -g _jonathan_last_winch=0
TRAPWINCH() {
theme_precmd
[[ -o zle ]] || return
if (( COLUMNS == _jonathan_prev_cols && LINES == _jonathan_prev_lines )); then
return
fi
local now=$EPOCHREALTIME
if (( now - _jonathan_last_winch < 0.8 )); then
return
fi
_jonathan_last_winch=$now
_jonathan_prev_cols=$COLUMNS
_jonathan_prev_lines=$LINES
local last_cmd
last_cmd=$(fc -ln -1 2>/dev/null)
[[ -z $last_cmd && HISTCMD -gt 1 ]] && last_cmd="${history[$((HISTCMD-1))]}"
echo "===== $(date) ===== last_cmd=[$last_cmd] COLUMNS=$COLUMNS" >> /tmp/jonathan-trap.log
print -n $'\e[H\e[2J\e[3J'
if [[ -n $last_cmd ]]; then
zle -U "$last_cmd" # ← this does not reliably restore the buffer
fi
zle reset-prompt
}
This was the best version SuperGrok produced after many iterations. It still fails to restore the command line.
Working Code Produced by Gemini 3.1 Pro (after one clarification)
zmodload zsh/datetime 2>/dev/null
typeset -g _jonathan_prev_cols=$COLUMNS
typeset -g _jonathan_prev_lines=$LINES
typeset -g _jonathan_last_winch=0
typeset -g _jonathan_saved_cmd=""
_jonathan_restore_buffer() {
if [[ -z $BUFFER && -n $_jonathan_saved_cmd ]]; then
BUFFER="$_jonathan_saved_cmd"
CURSOR=${#BUFFER}
fi
zle reset-prompt
}
zle -N _jonathan_restore_buffer
TRAPWINCH() {
[[ -o zle ]] || return
if (( COLUMNS == _jonathan_prev_cols && LINES == _jonathan_prev_lines )); then
return
fi
local now=${EPOCHREALTIME:-$SECONDS}
if (( now - _jonathan_last_winch < 0.8 )); then
return
fi
_jonathan_last_winch=$now
_jonathan_prev_cols=$COLUMNS
_jonathan_prev_lines=$LINES
(( $+functions[theme_precmd] )) && theme_precmd
local last_cmd
last_cmd=$(fc -ln -1 2>/dev/null)
[[ -z $last_cmd && HISTCMD -gt 1 ]] && last_cmd="${history[$((HISTCMD - 1))]}"
last_cmd="${last_cmd#"${last_cmd%%[![:space:]]*}"}"
_jonathan_saved_cmd="$last_cmd"
echo "===== $(date) ===== last_cmd=[$last_cmd] COLUMNS=$COLUMNS" >> /tmp/jonathan-trap.log
print -n $'\e[H\e[2J\e[3J'
zle _jonathan_restore_buffer
}
This works correctly.
Observed Failure Mode of SuperGrok
- Spent >1 hour generating variations.
- Repeatedly tried direct BUFFER assignment,
zle -U, different ways of calling reset-prompt, and other surface-level changes.
- Never stated the fundamental restriction: “BUFFER/CURSOR are not writable from a TRAPWINCH context.”
- When a previous attempt that touched BUFFER failed, the model simply abandoned that direction and guessed something else instead of diagnosing why BUFFER was inaccessible.
- Produced several “vacuous” fixes — code that executes without error but leaves the prompt empty after a resize.
This is classic trial-and-error without causal understanding of the ZLE execution context.
Suggested Improvements for xAI
- Strengthen knowledge of Zsh Line Editor constraints, especially which variables and widgets are valid inside signal traps (
TRAPWINCH, TRAPINT, etc.).
- Prefer root-cause analysis over iterative guessing when the user reports that a previous suggestion “does not restore the buffer.”
- When a well-known pattern exists (custom ZLE widget to mutate BUFFER safely), surface it early rather than after many failed attempts.
- Distinguish between “code that runs” and “code that achieves the stated visual/behavioral goal.”
How to Submit This Report
Recommended channels (as of August 2026):
- Inside any Grok chat: open the three-dots menu → Report Issue and paste this report.
- Email: support@x.ai (subject line e.g. “Model capability report – Zsh TRAPWINCH / ZLE BUFFER handling”).
- Also possible via the “Report an issue” option on grok.com / the Grok app.
Thank you for reviewing. This kind of deep shell/ZLE reasoning is exactly the area where stronger models should differentiate themselves.