Repository navigation
fix: clear OSC 7501 status when a command ends - #398
Merged
Merged
Conversation
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
approved these changes
Nov 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 chatleaves 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 --versionandbub runshould otherwise leave a staledonebehind too, though I did not run the unfixed code for those.Testing
prek run -aand mypy onprogram_status.pypass.clearfor each outcome, and no output when redirected.hc get:bub chatstartedidleidleworkingdone,quit, back at the shellidle(stale)bub --help,bub --versionThe "before" column is from bub 0.6.1, whose
program_status.pyis identical tomain.Behavior change
A one-shot command's
doneorerroris now replaced byclearright 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.