Skip to content

test(tui): make mode_probe wait for the status bar before it reads the label - #40

Merged
zy1233 merged 1 commit into
mainfrom
fix/mode-probe-settle
Oct 25, 2026
Merged

zy1233 merged 1 commit into
mainfrom
fix/mode-probe-settle

Conversation

@zy1233

@zy1233 zy1233 commented Oct 25, 2026

Copy link
Copy Markdown
Owner

Summary

scripts/tui_pty/mode_probe.py read the label in the border of the prompt box (the mode, for example · always-approve) as soon as the welcome text was on the screen. The label can be drawn a few frames later. A scenario that sends no key (a flag, or a saved config.toml) could then record (none). 3 added lines in one script: the probe waits one second after the welcome text, as it already does after each key.

 obs.ready = term.wait_for(r"Thanks for trying zypi", 25)
+term.pump(1.0)   # new: the label can come a few frames after the welcome text
 for key in scenario.keys:
     term.send(key)
     term.pump(1.0)
 obs.label = status_label(term.text())

Found in V0.6 exit condition 4 (v0.5.0 against the new build, same Python agent). The tables of the two builds differed in one row, config.toml: permission_mode = always-approve: label=(none) for v0.5.0 and label=· always-approve for v0.6.0. No code that draws the label changed between the two tags (git diff v0.5.0 main -- tui/crates adds no line that names a permission mode), so the probe was the suspect. Repeat runs of that one scenario show it.

Evidence

Before (scenario config.toml: permission_mode = always-approve, one binary per row, probe unchanged):

build runs label drawn no label
v0.5.0 17 14 3
v0.6.0 17 17 0

The same v0.5.0 binary gives both answers, so the answer is not a property of the build.

After (probe with the wait): v0.5.0 shows the label in 37 of 37 runs, v0.6.0 in 13 of 13. The whole output of mode_probe.py (15 lines: 10 scenarios, 4 refused values, the settings page) is identical for the two builds; diff of the two outputs is empty.

  • ruff check . and ruff format --check . pass. scripts/tests/test_tui_pty.py: 59 passed / 8 skipped on Windows (the PTY parts skip there). The changed code is in observe(), which needs a Linux pty; the runs above (WSL, Linux) test it.

Merge Danger

Door: two-way.

Blast Radius: one manual test script (scripts/tui_pty/; no workflow runs it). No product code. A run of the probe takes about 10 s longer (1 s for each of the 10 scenarios).

…e label

mode_probe.py read the label in the border of the prompt box (the mode, for
example "· always-approve") as soon as the welcome text was on the screen. The
label can be drawn a few frames later. A scenario that sends no key (a flag, or
a saved config.toml) could then record "(none)".

Scenario "config.toml: permission_mode = always-approve", same binary, probe
unchanged: v0.5.0 showed the label in 14 of 17 runs and no label in 3; v0.6.0
showed it in 17 of 17.

The probe now waits one second after the welcome text, as it already does after
each key. With the wait, v0.5.0 showed the label in 37 of 37 runs and v0.6.0 in
13 of 13, and the output of the two builds is identical.

Found in V0.6 exit condition 4 (v0.5.0 against the new build, same agent).
@zy1233
zy1233 merged commit 75f83ae into main Oct 25, 2026
4 checks passed
@zy1233
zy1233 deleted the fix/mode-probe-settle branch October 25, 2026 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant