Skip to content

fix(tooling): multi-PR session title parsing and prefix recovery#68

Merged
heavygee merged 1 commit into
mainfrom
tooling/pr-emoji-multi-pr-fix
Jun 25, 2026
Merged

fix(tooling): multi-PR session title parsing and prefix recovery#68
heavygee merged 1 commit into
mainfrom
tooling/pr-emoji-multi-pr-fix

Conversation

@heavygee

Copy link
Copy Markdown
Owner

Summary

  • Fix extract_pr_numbers for PR #944/#945 slash and space-separated multi-PR titles
  • Strip leading status emojis before rebuilding titles (prevents stacked ✅PR #N: 📝PR: garbage)
  • Recover malformed PR: N title patterns; normalize double spaces in base text

Test plan

  • hapi-pr-session-emoji.sh --dry-run --sweep — all 15 sessions unchanged
  • Manual repair verified on aad7763e (✅PR #944/#945: multi-agent import picker)

Context

Meta PR watcher sweep was corrupting multi-PR session titles when only the first PR number was parsed. Uncommitted mirror edits were also lost on sync — this lands via fork PR per mirror-main-layout policy.

Handle PR tiann#944/tiann#945 slash and space-separated formats, malformed PR: N
titles, and strip leading emoji before rebuilding session names so sweeps
do not stack prefixes.

Co-authored-by: Cursor <cursoragent@cursor.com>
@heavygee heavygee merged commit f53f201 into main Jun 25, 2026
2 checks passed
@heavygee heavygee deleted the tooling/pr-emoji-multi-pr-fix branch June 25, 2026 16:31

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c5c532d914

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

local name="$1"
local re_multi re_peer
re_multi='[Pp][Rr][#: ]*#?([0-9]{3,4})/([0-9]{3,4})'
re_multi='[Pp][Rr][[:space:]]*#([0-9]{3,4})/#([0-9]{3,4})'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep slash parsing for PR #N/N titles

For existing session titles using the previously supported slash form PR #944/945: ..., this regex no longer matches because it now requires a # before the second PR. The sweep then falls through to the single-PR grep and classifies only #944, so the rename/ping state drops #945 from tracking; this regresses titles the old [#: ]*#?N/N pattern parsed.

Useful? React with 👍 / 👎.

if [[ "$name" =~ $re_multi ]]; then
echo "${BASH_REMATCH[1]}"; echo "${BASH_REMATCH[2]}"; return
fi
if [[ "$name" =~ [Pp][Rr]:[[:space:]]*#?([0-9]{3,4}) ]]; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include PR: N titles in sweep selection

For malformed no-hash titles like PR: 944: foo, this new parser branch is never reached in the normal --sweep path because the session list is pre-filtered by test("Peer #[0-9]|PR #|pr#|#[0-9]{3,4}"), which does not match PR: 944. As a result the advertised PR: N recovery only works outside the sweep flow; add the PR: form to the jq selector so these sessions are actually processed.

Useful? React with 👍 / 👎.

Comment on lines +172 to +174
for marker in "PR #${p1}/#${p2}:" "pr#${p1}/${p2}:" "PR #${p1}/#${p2} " "pr#${p1}/${p2} " \
"PR #${p1} #${p2}:" "pr#${p1} #${p2}:" \
"PR #${p1}: #${p2}:" "pr#${p1}: #${p2}:"; do

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Strip both PRs from space-separated titles

For newly parsed space-separated titles like PR #944 945: import picker, extract_pr_numbers returns both numbers, but this marker list only removes variants where the second number has a #. The multi-PR rename therefore becomes …PR #944/#945: 945: import picker, leaving a stray second PR in the base and continuing to corrupt the session title on sweep; add the no-# variant here to match the parser.

Useful? React with 👍 / 👎.

for marker in "PR #${pr}:" "pr#${pr}:" "PR #${pr} " "pr#${pr} " "Peer #${pr}:" "peer #${pr}:"; do
name="$(strip_leading_emojis "$name")"
for marker in "PR #${pr}:" "pr#${pr}:" "PR #${pr} " "pr#${pr} " \
"PR: ${pr}:" "PR: ${pr} " "PR:${pr}:" "PR:${pr} " \

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Strip hashed PR: titles before rebuilding

For malformed titles that include the hash, such as PR: #944: import picker, the new parser branch extracts 944, but this marker list only strips PR: 944/PR:944 without the #. Since those titles are selected by the sweep via the #[0-9] filter, they get renamed to …PR #944: PR: #944: import picker instead of being repaired; include the hashed PR: #${pr} variants here.

Useful? React with 👍 / 👎.

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.

1 participant