Skip to content

Report program status from preflight, login, downloads and push - #1041

Merged
mcncl merged 2 commits into
mainfrom
pb-3957-osc-7501-slice-2
Oct 16, 2026
Merged

mcncl merged 2 commits into
mainfrom
pb-3957-osc-7501-slice-2

Conversation

@wolfeidau

@wolfeidau wolfeidau commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Description

Follow-up to #1040, which added OSC 7501 program status reporting for spinners, prompts and bk build watch. This extends it to the remaining long-running commands, so a terminal can show what they are doing and how they ended.

Each command now leaves a final record: done on success, error with the message on failure, or idle when the user cancels. The spec says a program should report done or error just before it exits, so the user finds the result when they come back.

Changes

  • programstatus.Finish(err, msg) maps an outcome to the final report. A user cancel (context.Canceled) is idle; timeouts are failures.
  • bk preflight reports each step (pushing the snapshot, creating the build, cleanup) and job progress while watching. The preflight renderer is wrapped so events become reports, and Run reports the outcome after cleanup and build cancellation.
  • bk auth login reports blocked kind=auth while waiting for the browser or the device code. The browser flow moved into runBrowserLogin, next to runDeviceLogin, so both share the final report.
  • bk artifacts download reports per-artifact progress. It, bk build download and bk package push report their outcome from Run, so build resolution failures and the --web browser step are included. No matching artifacts reports "No matching artifacts found" rather than claiming a download.
  • bk build watch now handles Ctrl-C like other commands and reports idle. Signals are only caught once the build is resolved, because the resolver's prompts read stdin without watching the context. It returns a user-aborted error (exit 130, as before) instead of the previous Canceled → nil path, so bk build watch && deploy does not deploy after an interrupt.
Command While running done message
bk preflight working per step, then job progress "Preflight passed" / "Preflight build created" (--no-watch)
bk auth login blocked kind=auth "Sign in to Buildkite in your browser" / "Enter code WXYZ-1234 to sign in to Buildkite" "Signed in to Buildkite"
bk artifacts download working "Downloading artifact 2 of 3" with progress "Downloaded artifacts from build #429"
bk build download, bk package push working from the spinner "Downloaded build #429", "Pushed pkg.txt"

Testing

  • Tests have run locally (with go test ./...)
  • Code is formatted (with go fmt ./...)

I also ran the built binary in a PTY against a fake HTTPS API for each command, with both success and failure responses, and saw the reports above. Ctrl-C during preflight and build watch reported idle and exited 130. With stdout redirected, no reports reached stdout, and preflight's TTY screen rendered the same as on main.

After review, I also checked no matching artifacts (done "No matching artifacts found", exit 0), resolution failures in both download commands (error, exit 1), bk package push --web with no browser (error, exit 1) and Ctrl-C while polling in build watch (idle, exit 130).

wolfeidau and others added 2 commits October 16, 2026 00:04
Extend OSC 7501 program status reporting to the remaining long-running
commands, each ending with done, error, or idle when the user cancels:

- bk preflight reports each step and job progress while watching
- bk auth login reports blocked on auth while waiting for the browser
  or device code
- bk artifacts download reports per-artifact progress
- bk build download and bk package push report their outcome

bk build watch now reports idle on Ctrl-C. It exits with a user-aborted
error rather than success, so a chained command does not run.

Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-e8ace642-180b-4cd2-a865-21662f7a18ca
Address review feedback on the program status reporting:

- Report the outcome of bk artifacts download, bk build download and
  bk package push from Run, so build resolution failures and the --web
  browser step are covered and only one final report is sent.
- Report "No matching artifacts found" rather than claiming a download
  when no artifacts match.
- Catch Ctrl-C in bk build watch only once the build is resolved. The
  resolver's prompts read stdin without watching the context, so a
  signal could not stop them.

Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-e8ace642-180b-4cd2-a865-21662f7a18ca
@wolfeidau
wolfeidau marked this pull request as ready for review October 16, 2026 00:27
@wolfeidau
wolfeidau requested review from a team as code owners October 16, 2026 00:27
@mcncl
mcncl merged commit 7390ef2 into main Oct 16, 2026
2 checks passed
@mcncl
mcncl deleted the pb-3957-osc-7501-slice-2 branch October 16, 2026 00:47
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