Ready status in threads

merged…
nlaz48d ago

I would like a new status on threads in the forum that shows when a thread is ready for review. It should account for all the CI jobs that might happen in a PR and then show "ready" if it passes the CI. It should show "failed" or an error state if it's not ready because the CI failed.

2 repliesoldestnewest
Osebotopus-5-548d ago

Plan: extend the existing PR sync in lib/merge.ts (which already polls GitHub for "merged") to also read CI on each open PR's head commit — both check runs (GitHub Actions, Vercel, etc.) and legacy commit statuses.

  • Two new thread statuses: ready, meaning every open PR's checks finished green, and ci_failed (shown as "CI failed"), meaning at least one check failed, errored, was cancelled or timed out. I kept this separate from the existing failed, which means Claude's run crashed.
  • While checks are still pending, the thread stays open. A new push that restarts CI moves ready/ci_failed back to open. merged still wins once every PR has landed.
  • waiting_on_human is never replaced by ready/CI failed, because Claude is still waiting for an answer.
  • It uses the same throttles as today: about 1 min on the thread page, 10 min on lists, and a forced check after each run. It adds migration 0010 for the enum values, badge styles and labels, and adds Ready / CI failed to the home status filter.
Osebotopus-5-548d agothreadide@4e82db1

Threads now get a ready badge (green) when every open PR has passed its CI, and a CI failed badge (red) when any check failed. It's pushed on thread/c412965d (no PR opened yet), and I haven't run it against a real PR. What I did run: tsc passes, and a small script confirmed the pass/fail/pending logic for check runs and commit statuses gives the expected results. I didn't run the app or take a screenshot.

How it works

  • It extends the existing "merged" check in lib/merge.ts. For each PR the thread opened that's still open, it reads GitHub's checks on the latest commit: check runs (GitHub Actions, Vercel and other GitHub Apps) plus the older commit statuses.
  • CI failed: any check failed, errored, timed out, was cancelled, or failed to start. This is a separate status from the existing failed, which still means Claude's run crashed. If a check is re-run and passes, the newer result replaces the failure.
  • ready: every check finished green; skipped and neutral checks count as passing.
  • Pending CI: a thread already marked ready or CI failed goes back to open, so a new push correctly clears the old verdict. Other statuses aren't changed while CI is still running.
  • merged still wins once every PR has landed. A thread that's waiting on a human answer only changes to merged, never to ready or CI failed — green CI doesn't answer Claude's question.
  • A repo with no CI at all shows ready once the PR has been quiet for 2 minutes. The delay is there because GitHub may not have registered the checks right after a push.

When it updates: there's no webhook, so it uses the same checks as "merged": when someone opens the thread (at most once a minute), from the thread lists (every 10 minutes, a few threads per view), and right after each run. That means a thread no one views keeps its old badge until someone looks at it or a list re-checks it. When the status changes, the badge updates live through the existing status event.

Other changes

  • Migration 0010_ci_status adds the two new statuses. As with every migration, it only takes effect when this merges and production redeploys.
  • The home page status filter now has Ready and CI failed options.
  • I added a --ready green colour token, so green joins purple and amber as the only colours in the palette.

Decision for you: should a repo with no CI ever show ready? If you'd rather it stay open, it's a one-line change.