Skip to content

fix: clear OSC 7501 status when a command ends - #398

Merged
frostming merged 1 commit into
bubbuild:mainfrom
qiaoborui:fix/program-status-clear
Nov 5, 2026
Merged

frostming merged 1 commit into
bubbuild:mainfrom
qiaoborui:fix/program-status-clear

Conversation

@qiaoborui

Copy link
Copy Markdown
Contributor

Bub reports a final OSC 7501 state when a command ends but never clears it. The terminal outlives the command, so the record stays after Bub exits. In Herdr, for example, quitting bub chat leaves the shell listed as an idle agent.

Commands now report their final state as before, then send state=clear. Non-TTY output still gets no sequences.

This applies to every command, because they all report through the same path. Commands such as bub --version and bub run should otherwise leave a stale done behind too, though I did not run the unfixed code for those.

Testing

  • The full pytest suite, prek run -a and mypy on program_status.py pass.
  • New tests cover the final state followed by clear for each outcome, and no output when redirected.
  • Live check in a herdr-core terminal, starting Bub from a shell and reading the record with hc get:
Step Before After
bub chat started idle idle
during a turn not rechecked working
turn finished not rechecked done
,quit, back at the shell idle (stale) cleared
bub --help, bub --version not checked cleared

The "before" column is from bub 0.6.1, whose program_status.py is identical to main.

Behavior change

A one-shot command's done or error is now replaced by clear right after it is sent. A consumer that only polls for the latest status no longer sees that outcome once the process has exited, and the exit code remains the way to get it.

Bub reported a final state on exit but never cleared it, so the shell left in
the terminal kept showing as an agent. Report the final state, then state=clear.
@frostming
frostming merged commit ecc0c6f into bubbuild:main Nov 5, 2026
6 checks passed
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.

2 participants