fix(tooling): multi-PR session title parsing and prefix recovery#68
Conversation
There was a problem hiding this comment.
💡 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})' |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 👍 / 👎.
| 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 |
There was a problem hiding this comment.
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} " \ |
There was a problem hiding this comment.
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 👍 / 👎.
Summary
extract_pr_numbersforPR #944/#945slash and space-separated multi-PR titles✅PR #N: 📝PR:garbage)PR: Ntitle patterns; normalize double spaces in base textTest plan
hapi-pr-session-emoji.sh --dry-run --sweep— all 15 sessions unchangedaad7763e(✅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.