Skip to content

fix(cli): report interrupted runs in deploy status and telemetry - #425

Merged
wyattjoh merged 5 commits into
mainfrom
wyattjoh/interrupt-report-gaps
Aug 18, 2026
Merged

fix(cli): report interrupted runs in deploy status and telemetry#425
wyattjoh merged 5 commits into
mainfrom
wyattjoh/interrupt-report-gaps

Conversation

@wyattjoh

@wyattjoh wyattjoh commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Two reporting gaps left open by #420, both on the Ctrl-C path.

clerk deploy status prints nothing at all when an interrupt lands before its wait loop starts. Only the wait was covered by the interrupt catch that #420 added, so an interrupt during application resolution, the preflight DNS check, or the state read escaped uncovered, and runProgram returns early without rendering anything. The catch now spans the whole command and emits whatever has been established: a full report once the live state resolves, and a state: "interrupted" report before that. The latter asserts nothing about the deploy, so agent-mode stdout stays parseable without claiming there is no production instance — the question an interrupted run never got to answer.

An interrupted run also sent no telemetry event at all. finalizeAndSendTelemetry cleared the module context at entry, so a Ctrl-C mid-POST left the shutdown flush with nothing to report and the outcome: "abort" event was never sent. The context is now held until a send actually lands, which is enough on its own to keep a run to one event: a normal flush still running when the shutdown flush starts can no longer land, because its POST is composed with the interrupt signal that has already been aborted, and one that landed before the interrupt has already recorded itself. The shutdown flush therefore never waits on the normal one, whose remaining config and Git reads observe no signal and could otherwise burn its entire 250ms budget.

One case is left alone deliberately: a Ctrl-C in the bookkeeping tail after the POST has landed still records the success. That event cannot be retracted, and sending a second would double-count the run.

Test plan

  • bun run format:check
  • bun run lint
  • bun run typecheck
  • bun run test — 2650 pass, 0 fail

- Emit an interrupted report when status reads are aborted
- Preserve the last completed poll in interrupted wait reports
- Add coverage and document the interrupted status state
- Keep context after aborted normal flushes
- Coordinate flushes to emit at most one event
- Add coverage for interrupted telemetry runs
- Wrap context resolution in interrupt handling
- Test interrupted agent-mode status reporting
- Allow shutdown telemetry flushes to proceed independently
- Add coverage for slow normal flushes that ignore interrupts
@changeset-bot

changeset-bot Bot commented Aug 18, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4048636

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
clerk Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@wyattjoh

Copy link
Copy Markdown
Contributor Author

Stack: wyattjoh/interrupt-report-gaps

Part of a stacked-prs chain. Do not merge manually.

@wyattjoh wyattjoh changed the title fix(deploy): report status on interrupt fix(cli): report interrupted runs in deploy status and telemetry Aug 18, 2026
@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7c6cca87-fdac-44f9-a545-b78f96ac1af4

📥 Commits

Reviewing files that changed from the base of the PR and between d495e99 and 4048636.

📒 Files selected for processing (7)
  • .changeset/interrupt-report-gaps.md
  • packages/cli-core/src/commands/deploy/README.md
  • packages/cli-core/src/commands/deploy/status-command.test.ts
  • packages/cli-core/src/commands/deploy/status-command.ts
  • packages/cli-core/src/commands/deploy/status.ts
  • packages/cli-core/src/lib/telemetry.test.ts
  • packages/cli-core/src/lib/telemetry.ts
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • clerk/clerk_go (manual)
  • clerk/dashboard (manual)
  • clerk/accounts (manual)
  • clerk/backoffice (manual)
  • clerk/clerk (manual)
  • clerk/clerk-docs (manual)
  • clerk/cloudflare-workers (manual)
  • clerk/javascript (auto-detected)

Included review availability: 9 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 10 reviews per hour.


📝 Walkthrough

Walkthrough

clerk deploy status now handles Ctrl-C across application resolution, preflight, state retrieval, and polling. It reports an interrupted state when deployment state is unavailable and preserves the latest completed poll when possible. Human output shows the next action for incomplete reports. Telemetry retains interrupted command context for shutdown retry and prevents duplicate events. Documentation and a patch changeset describe the behavior.

Estimated code review effort: 4 (Complex) | ~45 minutes

Merge Risk: ⚪ Minimal · up to 40486

This change improves interrupted deploy status reporting and telemetry without any supplied merge-blocking risk; it is merge-ready after normal checks and review.

Possibly related PRs

  • clerk/cli#420: Both changes update deploy status interruption handling, partial state preservation, and interrupted reporting.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main changes to interrupted deploy status reporting and telemetry.
Description check ✅ Passed The description directly explains the interrupt handling, deploy status reporting, telemetry behavior, tests, and validation for this changeset.
Docstring Coverage ✅ Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Comment @coderabbitai help to get the list of available commands.

@wyattjoh
wyattjoh merged commit 95dfeaf into main Aug 18, 2026
11 checks passed
@wyattjoh
wyattjoh deleted the wyattjoh/interrupt-report-gaps branch August 18, 2026 21:05
rafa-thayto added a commit that referenced this pull request Aug 18, 2026
…sing on main

Main's #425 added the interrupted deploy-status report and a Ctrl-C
mid-wait test before this branch's proxyUrl field existed; give the
interrupted report a null proxyUrl and expect the proxy component in the
merged test.
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