Skip to content

Only failed or finished CI checks wake a session - #558

Merged
mcwhittemore merged 3 commits into
mainfrom
issue-519-ci-wake-rules
Nov 25, 2026
Merged

mcwhittemore merged 3 commits into
mainfrom
issue-519-ci-wake-rules

Conversation

@loopway-bot

Copy link
Copy Markdown
Contributor

Closes #519.

A thread is now told about CI only when a check finishes failing, or once when every check on the head commit has finished. Running and passing checks no longer queue anything.

What it does

  • A check run that completes with failure, timed_out, cancelled or action_required is queued, as <name> <conclusion>.
  • A commit status in failure or error is queued.
  • When no check run is in progress and no status is pending (and there is at least one), one ci_finished update is queued: CI finished: 5 passed, 1 failed. Skipped and neutral checks count as passed.
  • In-progress and passing checks and pending statuses are read but queue nothing.
  • A new head commit starts over: its checks have their own ids, and the summary id carries the commit sha.

Worth knowing

  • I did this in GitHubSource (it only emits those updates) instead of in rules.ts. So the poller's seen list holds only the updates that wake, not every check state; the issue's "recorded on the subject" is met by the polling itself, which still reads every check each time. Say if you want the quiet ones kept in seen too.
  • The summary id is ci_finished:<sha>:<passed>:<failed>. A re-run that changes the counts after the summary sends a second summary; the same counts never repeat.
  • Bumps the CLI to 2.0.3 (CI's cli-version check).

Test it locally

npm run build && npm test && npm run typecheck && npm run lint && npm run format:check

New tests are in packages/cli/test/github.test.ts, under "CI": every failing conclusion wakes, running/passing/skipped don't, the all-done summary (with a failing status and a pending one), no checks yet, each result once, and a new head commit resetting. They use the fake GitHub.

To try it live, follow the steps in #519. The record will be in verifications/<this PR>.md on the branch.

🤖 Generated with Claude Code

@loopway-bot

Copy link
Copy Markdown
Contributor Author

PR #558 is open and its automated checks pass (259 tests, typecheck, lint, format). I can't run the live steps from #519. They need a PR in craftmilldev/loopway-sandbox with a failing and a passing job, and create_pr refuses the sandbox: "dev does not read craftmilldev/loopway-sandbox". AGENTS.md says to open nothing with gh. Which should I do? (a) You open the sandbox PR (branch ci519-wake with the workflow; I can push it again) and I run the steps against it. (b) You allow create_pr on the sandbox for this bot. (c) I record steps 1–4 as "not checked" in the verification file and leave the live run to you.

Reply here to answer: loopway-bot is waiting.

@loopway-bot

Copy link
Copy Markdown
Contributor Author

Blocked: verifications/558.md doesn't exist yet, and #519's Done when asks for it to record steps 1–4. The code side looks right.

What I ran

On review-558 (head of issue-519-ci-wake-rules): npm run build && npm test && npm run typecheck && npm run lint && npm run format:check. Everything passed, with 41 + 259 tests. CI is green (test, cli-version, label). No live steps were rerun, because there's no record to check them against.

Must fix

  1. The verification is missing. Run Only failed or finished CI checks wake a session #519's How to test it steps 1–4 on craftmilldev/loopway-sandbox from npm run init-scratch -- --reset: a two-job workflow (one passes, one fails after a sleep), a PR, the pending count staying flat while the jobs run, one failure update, one CI finished, then a push that starts over. Record them in verifications/558.md with real log lines and sandbox issue/PR numbers. Put [#558] in their titles, close them afterwards and delete the branches.

Worth considering

  • The summary can fire early when not every check exists yet (packages/cli/src/github.ts, the running === 0 && passed + failed > 0 test). A job behind needs: isn't created as a check run until its upstream job finishes, and a second workflow can register a few seconds after the first. Take a workflow lint → test (needs: lint): a 30s poll can land after lint passes and before test exists. That sends CI finished: 1 passed, 0 failed, and then a second summary once test ends. The live run in step 1 would show it if the workflow uses needs:. A cheap guard is to also read /commits/<sha>/check-suites and hold the summary while any suite is still queued or in_progress. At minimum, say in the README that a summary can repeat.
  • The // Noise that says nothing happened to the work itself. comment (line 424) now sits above FAILED_CONCLUSIONS instead of SKIPPED_EVENTS. Move it back down.
  • On "recorded on the subject": putting the filter in GitHubSource means quiet check states never reach seen. That matches the README as written, but it's Matthew's call, as the PR says.

@github-actions github-actions Bot added the conflicts Conflicts with its base branch; set and cleared by the Label merge conflicts workflow label Nov 16, 2026
@github-actions

Copy link
Copy Markdown

This PR conflicts with its base branch. Rebase onto it, resolve the conflicts, and push.

@mcwhittemore

Copy link
Copy Markdown
Collaborator

AGENTS.md says to open nothing with gh

Can you rebase on main and use npm run sandbox?

@loopway-bot
loopway-bot force-pushed the issue-519-ci-wake-rules branch from 8da3564 to 261df3d Compare November 16, 2026 16:01
@loopway-bot

Copy link
Copy Markdown
Contributor Author

Rebased on main (the CLI version is now 2.1.1, CHANGELOG conflicts resolved), force-pushed, and reran build, test (278 in cli), typecheck, lint and format:check: all pass.

I ran steps 1–4 of #519 live in the sandbox. npm run sandbox only opens issues, so I opened [#558] issue #55 with it and the scratch dev bot opened PR #56 with three jobs (pass, slow pass, fail). While the jobs ran nothing was queued. When the failing job ended, one check_run update was queued. When all had ended, one CI finished: 2 passed, 1 failed was queued. A new push started over with the same pair. Details are in verifications/558.md.

Not run live: timed_out, cancelled, action_required and commit statuses (fake-GitHub tests only). Everything I opened in the sandbox is closed and its branch deleted.

@loopway-bot

Copy link
Copy Markdown
Contributor Author

Ready to merge. The live record I was blocked on is now in verifications/558.md, and it holds up.

What I ran

Earlier points

  • Must fix 1 (missing verification) is fixed.
  • The optional points weren't taken up, which is fine:
    • The // Noise … comment is still above FAILED_CONCLUSIONS (packages/cli/src/github.ts).
    • The early-summary case is still open. The sandbox workflow had no needs: between jobs, so the live run couldn't show it. If a summary repeating is acceptable, merge as is. If not, a follow-up can hold the summary while /commits/<sha>/check-suites shows a suite that is still queued or in_progress.

@github-actions github-actions Bot removed the conflicts Conflicts with its base branch; set and cleared by the Label merge conflicts workflow label Nov 16, 2026
@github-actions

Copy link
Copy Markdown

This PR conflicts with its base branch. Rebase onto it, resolve the conflicts, and push.

@github-actions github-actions Bot added the conflicts Conflicts with its base branch; set and cleared by the Label merge conflicts workflow label Nov 25, 2026
loopway-bot and others added 3 commits November 25, 2026 09:23
Check runs and statuses are still read every poll, but only a check that
finished failing, or the moment every check on the head commit has finished
(one summary), becomes an update. A new head commit starts over.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@loopway-bot

Copy link
Copy Markdown
Contributor Author

main moved and the PR conflicted again, so I rebased it and force-pushed. Only CHANGELOG.md conflicted. main took 2.1.1, so this change is now 2.1.2 (CLI version and changelog entry). After the rebase, build, test (281 in cli), typecheck, lint and format:check all pass.

The live run in verifications/558.md was on the build from before this rebase (2.1.1). I did not rerun it. The CI code did not change.

@loopway-bot

Copy link
Copy Markdown
Contributor Author

Correction to my last comment: the rebase is done locally, but the force-push was denied, so it is not on the branch yet. The branch on GitHub still has the old history and still conflicts on CHANGELOG.md. The local rebase passes all five checks (281 tests in cli) and bumps the CLI to 2.1.2. Please tell me to go ahead with git push --force-with-lease on issue-519-ci-wake-rules, or allow it in the permission settings. I won't retry until then.

@loopway-bot
loopway-bot force-pushed the issue-519-ci-wake-rules branch from c55ec2a to 609a2d9 Compare November 25, 2026 14:24
@loopway-bot

Copy link
Copy Markdown
Contributor Author

You asked me in chat to resolve the conflicts. I pushed the rebase with git push --force-with-lease, so the branch now matches the local rebase and should no longer conflict. The only conflict was in CHANGELOG.md: main took 2.1.1, so this change is now 2.1.2 (CLI version and changelog entry). Build, test (281 in cli), typecheck, lint and format:check passed on it before the push. The live run in verifications/558.md was on the 2.1.1 build before this rebase. I did not rerun it, because the CI code did not change.

@github-actions github-actions Bot removed the conflicts Conflicts with its base branch; set and cleared by the Label merge conflicts workflow label Nov 25, 2026
@mcwhittemore
mcwhittemore merged commit d8f0b2e into main Nov 25, 2026
3 checks passed
@mcwhittemore
mcwhittemore deleted the issue-519-ci-wake-rules branch November 25, 2026 14:25
@loopway-bot

Copy link
Copy Markdown
Contributor Author

Ready to merge, still, on the rebased head 609a2d9.

What I ran

  • git range-diff against my last review: the CI code and its tests are unchanged, line for line. The rebase only changed the CLI version and CHANGELOG.md. The two verification commits are identical.
  • The CLI version goes from main's 2.1.1 to 2.1.2, with a matching changelog entry.
  • On the rebased branch, build, test, typecheck, lint and format:check all pass: 281 tests in cli (278 plus 3 that came in from main) and 41 in web. verifications/558.md still says 278, from the run before this rebase. The live run doesn't need repeating, because the code it exercised hasn't changed.

The earlier optional points still stand, unchanged.

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.

Only failed or finished CI checks wake a session

2 participants