Skip to content
Sign in

pr-watcher

v0.1.0

A thin console sidebar of your open GitHub pull requests — review status, CI checks, comments from people and bots, and the chats each PR was worked on in, kept fresh by observers.

license: Apache-2.0githubpull-requestscicode-reviewchatsconsole-ui

Install

bash
iii call compose::add worker=pr-watcher

Run in your project with the iii engine running. Exact versions are immutable and digest-pinned.

pr-watcher

A thin sidebar for the iii console that lists your open GitHub pull requests and, for each one:

  • Status — draft, approved, changes requested, merge conflicts.
  • CI — the rollup and every check, failing and running ones first, each linked to its run.
  • Chats — the iii chats the PR was worked on in, with the reason each one was linked. Click one to open it.
  • Comments — the latest comments, reviews and review threads from anyone, bots included (CodeRabbit, Copilot, github-actions, …), with unresolved thread counts.

It also adds a Pull requests section to a chat's Context panel with the PRs linked to that chat.

Install

iii call compose::add worker=pr-watcher

Then open PR watcher from the console, or ask an agent to call pr-watcher::list.

What it needs

Worker Why Required
github Reads your PRs through github::api. Sign it in with gh auth login (or its GH_TOKEN setting). yes
session-manager Lists and searches your chats, and reads their transcripts. yes
ade Hosts the page. yes
configuration Keeps the worker's settings. yes
harness Its harness::on-turn-completed event refreshes the list when a chat turn ends. no
ide shell::exec runs git in a chat's working directory to see which branch it is on. no

Whose PRs? The search is is:pr is:open author:@me. GitHub resolves @me to the account whose token the github worker uses; the page header shows that login. Every page of the result is read, so there is no cap on the number of PRs.

Involved. Tick Involved beside the filter to also list other people's open PRs you are involved in: review requested, assigned, reviewed, commented on or mentioned in. Each row says why and who the author is, and a PR waiting for your review counts as needing attention. GitHub cannot search for subscriptions, so a PR you only watch (without any of the above) is not found.

How chats are linked

The worker reads the transcript of your most recent chats (1000 by default, see Settings; tool results included, incrementally after the first read) and scores every chat against every PR:

Evidence Weight
The PR was opened in the chat (its URL follows a create call) strongest
The chat references the PR's URL or owner/repo#N — weighted down when the chat references many PRs, so a chat that merely listed them links to none strong
The chat's title or description names the PR or its branch strong
The chat talks about the same change (fuzzy title match) while the PR was active supporting
The chat's working directory is a checkout of the repo on, or holding, the branch supporting only: never links a chat on its own

Each linked chat carries its score, a confidence (high, medium, low) and the reasons. Low-confidence guesses are dropped once a chat is known to be the PR's.

How it stays fresh

Nothing polls on a short timer. The worker observes what changes the answer and refreshes then:

  • a chat turn finished (harness::on-turn-completed);
  • a chat was renamed, moved or deleted (session::on-meta-updated, session::on-deleted);
  • a PR was changed through the engine (github::pr::create, merge, edit, comment, review);
  • a PR changed on GitHub itself — closed, merged, pushed to, CI finished, commented on — when the github worker's PR webhooks are set up (github::setup::webhooks-status). Each open PR then gets a watch (github::pr::watch) and its events arrive through github::pr::on-event. When webhooks are not available, nothing else changes.

Fallback: when an observer did not register, or nothing has caused a GitHub read for 5 minutes, GitHub is read anyway. The page follows pr-watcher::on-change the same way, with the same fallback. The poll only runs while a page is open (or was within the last 15 minutes).

Functions

Function What it does
pr-watcher::list { refresh?, session_id?, involved? } → { login, total, fetched_at, linking, status, prs }. Served from memory; refresh: true re-reads GitHub and repeats the chat search; session_id keeps only the PRs linked to that chat; involved: true adds other people's PRs you are involved in (each PR's roles says why).
pr-watcher::on-change Event function. Observe it instead of polling: { kind: progress | prs | links | watch, at, status }. status carries linking progress (phase, transcripts read, the chat being read), the last GitHub read and each observer's state.

Settings

In the console's Settings (the page's settings action, or the link in its status line):

Setting Default Meaning
Chats to match (max_chats) 1000 The most recent chats that are read and matched against your pull requests.

Environment variables, all optional:

Variable Default Meaning
PR_WATCHER_QUERY is:pr is:open author:@me sort:updated-desc The GitHub search. Use involves:@me or review-requested:@me to widen it.
PR_WATCHER_HOME data/pr-watcher under the project Where the chat index (a cache) is kept.

Develop

pnpm install
pnpm dev          # builds, then watches backend, UI and restarts the worker
pnpm typecheck && pnpm test
pnpm bundle       # build/pr-watcher.tar.gz, the registry artifact

To run it from a checkout in an iii project, declare it in worker-compose.yaml:

  pr-watcher:
    worker: path://../pr-watcher
    scripts:
      run: pnpm start

Release

Releases are published to the iii registry by GitHub Actions (.github/workflows/release.yml) with the registry CLI, using the repository secret REGISTRY_API_KEY (an organization API key from the registry dashboard).

  1. Bump version in package.json and merge it.
  2. Tag that commit v<version> and push the tag: git tag v0.1.0 && git push origin v0.1.0.
  3. The workflow checks, tests, bundles, starts an iii engine with the bundled worker connected (the registry reads the API reference from it), runs registry publish --dry-run, then publishes and attaches the bundle to a GitHub release. A version with a prerelease suffix (0.2.0-rc.1) is published under the registry tag next.

Run the workflow by hand (Actions → Release → Run workflow) to rehearse everything without publishing: dry_run is on by default and needs no API key. Registry versions are immutable.

License

Apache-2.0

Search the registry

Find workers, kits and executables, or jump to a page.