omp packages

pi-pr-session-title0.1.0

Names PR-review sessions after the pull request's real subject, so the session list and terminal tab read "PR review 1234: <PR title>".

petec Published 1 month ago MIT ~45 downloads/mo

Built for omp

The author tagged this package oh-my-pi.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme

pi-pr-session-title

Session titles for PR reviews that say what the PR actually is.

Ask your agent to review a pull request and the auto-generated session title is a paraphrase of your own prompt — Review pull request 4271. The title model only ever sees your first message, so it cannot know the subject. This extension looks the PR up with gh and names the session from the real title instead:

before:  Review pull request 4271
after:   PR review 4271: fix(scheduler): stop retrying cancelled jobs

The session name drives the session picker and the terminal/tab title, so a stack of review tabs becomes readable at a glance.

Works with pi and with the oh-my-pi (omp) fork.

Install

# pi
pi install npm:pi-pr-session-title

# omp
omp plugin install pi-pr-session-title

Or drop extensions/pr-session-title.ts into ~/.pi/agent/extensions/ (pi) or ~/.omp/agent/extensions/ (omp).

gh must be on PATH and authenticated (gh auth status). Set PR_SESSION_TITLE_GH to point at a non-standard GitHub CLI location.

Behavior

  • Fires on the first prompt of a session that references a PR, and at most once per session.
  • Never overwrites a name you chose. A name set by /name, /rename, or another extension wins; only a model-generated title (omp's titleSource: "auto") is replaced, because that title is just a paraphrase of the same prompt.
  • Recognizes https://github.com/owner/repo/pull/123 (repo included, so cross-repo reviews resolve), pr 123, PR#123, pull request 123, pr://123, and a bare #123.
  • Resolves the PR with gh pr view <n> --json number,title, in the session's working directory, so the repo comes from your checkout's remote unless the prompt named one.
  • Names the session PR review <n>: <subject> when the prompt is about reviewing, otherwise PR <n>: <subject>. Subjects longer than 90 characters are clipped on a word boundary.
  • Any failure — no gh, not authenticated, no such PR, 8s timeout — is silent, and the harness's normal titling behavior is untouched.
  • Slash commands are ignored.

Hook points

Two, because they cover different entry paths:

Event Path Effect
input interactive TUI On omp, awaited before the auto-title check, which is skipped once the session has a name — so the model title is never even generated. On pi there is no auto-titling, so this is the only title source.
before_agent_start initial argv prompt, -p/print Emitted after omp has already dispatched auto-titling, so the rename is applied out-of-band and supersedes it. Scheduled, never awaited, so the turn is not delayed.

On omp, pi.setSessionName records a user-sourced title, which auto titles (including replan refreshes) never overwrite. On pi, session names are last-write-wins with no provenance, which is why the extension checks getSessionName() before renaming.

Uninstall / disable

pi remove npm:pi-pr-session-title
omp plugin uninstall pi-pr-session-title

For a hand-placed copy, delete the file. On pi, pi config toggles discovered extensions; on omp, settings can disable it by id:

# ~/.omp/agent/config.yml
disabledExtensions:
  - extension-module:pr-session-title

Development

npm test    # node --test, hermetic: a stub gh, no network

Tests cover PR-reference parsing, title formatting, and both handlers driven end to end against a stub gh.

License

MIT