Skip to content

Share one busy-retry loop for the shell's turn-end requests - #2207

Draft
fazxes wants to merge 1 commit into
mainfrom
fazxes/share-busy-retry-loop
Draft

fazxes wants to merge 1 commit into
mainfrom
fazxes/share-busy-retry-loop

Conversation

@fazxes

@fazxes fazxes commented Nov 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • The steered command stops, the turn-end lease release and the unpublished tty close share one retryWhileBusy loop for a request the busy terminal client refuses. It owns the backoff, the exit check and the trace lines. The waits, attempt count and exit check are unchanged, and busyRetryDelayMs holds the retry plan as a pure function.
  • dropped=background_command_stop is written once per command left running: when the forced stop gives up or process exit cuts the stop short. The graceful stop's busy give-up no longer carries it, since the forced stop still runs.
  • A stop that exit cuts short now logs gave up ... reason=runtime_stopping, the same as the lease release and the unpublished close.
  • New tests: the retry plan, the give-up trace lines, and process exit during a busy retry of the lease release and of the unpublished close.

The steered stops, the turn-end lease release and the unpublished tty
close each had their own copy of the retry loop for a request the busy
terminal client refuses: the backoff, the exit check and the trace
lines. One retryWhileBusy loop now runs all three. A pure
busyRetryDelayMs gives the wait before each run, and each request keeps
only its own run in a small runner type.

The waits, the attempt count and the exit check do not change. The
trace lines keep their wording, with two fixes:

- The graceful stop's busy give-up no longer says
  dropped=background_command_stop, since the forced stop still runs.
  dropped= now appears once, from logDroppedStop, when the forced stop
  gives up or process exit cuts the stop short.
- A stop that exit cuts short logs "gave up ... reason=runtime_stopping"
  like the lease release and the unpublished close, in place of "retry
  cut short".

New tests cover the retry plan, the give-up trace lines, and process
exit during a busy retry of the lease release and of the unpublished
close, which end at once and log their dropped= line.
@fazxes fazxes added the type: maintenance Changes internal tooling, dependencies, CI, or implementation structure label Nov 22, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: maintenance Changes internal tooling, dependencies, CI, or implementation structure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant