fix(skills): resolve blank-padding viewport bug in send_keys_safe and fix rc status leak

- Introduce _pane_tail content helper to filter blank-padded lines in tmux captures
- Apply _pane_tail to _pane_dialog_open, handle_startup_dialogs, and send_keys_safe
- Fix rc status expansion logic in create_session.sh instructions injection check
- Include 3-agent final prompt-lock verification reports
This commit is contained in:
2026-07-11 09:34:25 +09:00
parent e613f4aedb
commit da895fccd5
4 changed files with 191 additions and 5 deletions
+7 -3
View File
@@ -1112,6 +1112,10 @@ _sks_tmux() {
_pane_capture() { _sks_tmux capture-pane -p -t "$1" 2>/dev/null || echo ""; }
# Bottom-N *content* lines: capture-pane -p pads the viewport with trailing
# blank rows; window on non-blank lines or top-anchored dialogs are invisible.
_pane_tail() { _pane_capture "$1" | grep -v '^[[:space:]]*$' | tail -n "${2:-20}"; }
# _pane_quiescent <sess> [tries=20] [interval=0.5]
# Renderer settled = two consecutive identical non-empty captures.
# Defeats RC-A (Blessed/Ink renderer bottleneck) without a magic fixed sleep.
@@ -1131,7 +1135,7 @@ _pane_quiescent() {
# only (dialogs render near the input area; conversation text above must not
# trigger this). Tokens must NOT appear on normal idle prompt screens.
_pane_dialog_open() {
_pane_capture "$1" | tail -n 20 | grep -Eq \
_pane_tail "$1" 20 | grep -Eq \
'Do you trust the files|Yes, proceed|No, exit|Allow this|Press Enter to continue|browser to authenticate|Use arrow keys|Esc to cancel'
}
@@ -1175,7 +1179,7 @@ send_keys_safe() {
_sks_tmux send-keys -t "$sess" C-m
sleep "$try"
# Submitted = input area released the text AND rendering changed after Enter.
if ! _pane_capture "$sess" | tail -n 3 | grep -Fq "$marker" \
if ! _pane_tail "$sess" 3 | grep -Fq "$marker" \
&& [ "$(_pane_capture "$sess")" != "$pre_submit" ]; then
return 0
fi
@@ -1191,7 +1195,7 @@ send_keys_safe() {
handle_startup_dialogs() {
local sess="$1" timeout="${2:-20}" waited=0 pane
while [ "$waited" -lt "$timeout" ]; do
pane=$(_pane_capture "$sess" | tail -n 20)
pane=$(_pane_tail "$sess" 20)
if printf '%s\n' "$pane" | grep -q 'Do you trust the files'; then
_sks_tmux send-keys -t "$sess" Enter
elif printf '%s\n' "$pane" | grep -q 'Yes, proceed'; then