Skip to content

feat(session-flow): look back over one pull request in audit-sessions - #16015

Merged
kyle-sexton merged 5 commits into
mainfrom
feat/session-flow-pr-scope
Nov 13, 2026
Merged

kyle-sexton merged 5 commits into
mainfrom
feat/session-flow-pr-scope

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

No related issue: owner decision in a design review of our review, PR-body and retro skills

Summary

A retro could cover one session or one ticket, but not one pull request: the sessions that built it (subagents included) and the review comments it drew had to be gathered by hand across two skills. audit-sessions now takes a pull request as its scope. Retro stays single-session and routes a PR retro there. Retro's approval phase also now states when a change may be applied without a person's approval.

Fix

  • audit-sessions pr --number <n> --repo <owner/repo> [--branch <name>] (skills/audit-sessions/actions/pr.md): takes the head branch from /source-control:pull-request view, finds the matching sessions through the store, measures them with the existing --session sweep, reads their main and subagent transcripts in fresh subagents each given at most a quarter of its context window (larger files split by line range), and invokes /corrections:codify reviews when the PR is merged and the corrections plugin is installed.
  • sweep.py --pr N --repo OWNER/REPO [--branch NAME]: new envelope audit-sessions.pr/v1 listing each matching session with matched_by (pr, branch, or -sub when only a subagent transcript shows it). Automated sessions stay in and are labeled.
  • collect.py: stores subagent branches and PR links in new branches_sub / prs_sub fields, kept apart so ticket keys and per-PR churn still count the main session only. The collector digest changes, so the next collect re-reads every transcript once.
  • retro: a PR-scoped request names the new action and stops; context/session.md Phase 4 states that a change skips approval only where an evaluation set scores the changed surface and the change does not lower the score.

Left out: /corrections:codify reviews has no public argument that selects one PR (it mines the last review_mining_prs merged PRs), so the hand-off reports whether this PR was among those read and skips an open PR.

Verification

  • pytest plugins/session-flow/skills/audit-sessions/scripts/tests: 414 passed, including new tests for the PR match (link or branch, main or subagent side, other repository and PR excluded, argument refusals) and for subagent branch and PR-link storage.
  • pytest plugins/session-flow/skills/audit-friction/scripts: 27 passed.
  • scripts/run-ruff.sh check on the audit-sessions scripts: clean.
  • check-skill.sh plugins/session-flow/skills: 18 passed, 0 failed. check-evals-quality.sh on both changed eval files: pass.
  • markdownlint with the repo config on the changed markdown: 0 issues.

Related

  • Changelog fragment: .changes/session-flow/feat-audit-sessions-pr-scope-54c359f8.md.

🤖 Generated with Claude Code

audit-sessions gains a pr action: given a PR number and repository, it
finds the sessions that linked the PR or ran on its head branch, from
main and subagent transcripts, measures them, reads them in subagents
sized to the transcripts, and hands review comments to
/corrections:codify reviews when that plugin is installed. The store
records subagent branches and PR links in branches_sub and prs_sub.

retro stays single-session and routes a PR retro to the new action. Its
Phase 4 now states that a change may skip approval only where an
evaluation set scores the changed surface and the score does not drop.

Co-authored-by: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 13, 2026 19:39
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T19:41:35.255342Z 0db719f Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: 0db719f81d

ℹ️ 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".

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-refine/fix-docs
Model rung 0
Leg handoff
Run job success
Activity step success
Commits pushed none (read lane)
Run 43494257370

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

Lane-Activity: pr-refine/fix-docs
@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-refine/apply-patch
Model rung 0
Leg base
Run job success
Activity step success
Commits pushed 2096445
Run 43494257370

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

claude-review: 1 inline finding(s) on 20964457086cee473fd5472dc5d4899aff642368; the summary is in this lane's pull request comment.

claude-lane: claude-review

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 9c4e10a31fe7e1e18e7e401d50eab87802a84a8a: read 13 of 13 changed file(s); 0 finding(s), 0 as inline comments.

Code review (blocking only): PR #16015

No blocking findings. This lane has reviewed two earlier heads, and the prior-findings file says blocking only: yes, so this review reports only blocking findings and leaves out advisory ones. I read every hunk of all 13 files in .claude-lane/pr.diff. The new head is a merge from main, and the PR's own diff matches what the lane last reviewed.

What I checked

  • sweep.py pr_matches and pr_data.
    • A main-side match still stops a repeated -sub entry. That fix came from the earlier thread, which is resolved; the code under it changed, so I checked the new version.
    • When a session's repo_identity names a different repository, the branch match is turned off; a missing identity still matches by branch.
    • The repository name is compared case-insensitively on both the identity and the PR-link path. test_pr_matches_the_head_branch_only_in_the_requested_repository covers this.
  • Argument handling.
    • --pr joins the existing group of options that can't be combined, so --pr with --tickets is refused.
    • --pr and --repo must be given together, and --repo must match REPO_RE.
    • --pr refuses --session and --write-report, and --branch is now accepted with either --tickets or --pr. Each refusal has a test in test_pr_refuses_a_missing_or_malformed_repo_and_the_kept_or_session_modes.
    • census._positive (census.py#L89) rejects 0.
  • collect.py.
    • Subagent gitBranch values and pr-link records now go to the new branches_sub and prs_sub fields; branches and prs still hold only the main session's values, so ticket keys and per-PR churn don't change.
    • Stored repository names pass through scrub.key, which only redacts (collect.py#L668), so an owner/repo name still compares equal.
    • The collector digest is a hash of the script files (collect.py#L155), so this change does make the next collect re-read every transcript once, as the PR says.
    • Nothing in the plugin validates record keys, so the new fields can't be rejected.
  • Skill docs and evals. actions/pr.md, the SKILL.md argument list, store-layout.md, the retro routing to the new action, and the new eval cases (ids 16 and 17) agree with the script's behavior.

Not checked by me. I had no shell, so I ran no tests. The pytest, ruff, check-skill and markdownlint results in the PR description are the author's claims and unverified.

Other checks

  • No plugin.json or marketplace.json changed, so there are no manifest lines. The changelog fragment's bump: minor fits a new action.
  • The PR closes no issue ("owner decision in a design review"), so there are no acceptance criteria to check.
  • I found no embedded instructions in the PR context, the settled threads or the prior findings.
  • Usage, not a hold: when someone runs the new pr action, it starts read-only subagents over the PR's transcripts (each gets at most a quarter of its context window). That uses the operator's subscription or API usage, not a billed resource.

Verifier dropped 0 of 0 candidates.

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 9c4e10a31fe7e1e18e7e401d50eab87802a84a8a: read 13 of 13 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #16015 at 9c4e10a3

No security issues found. This lane already reviewed an earlier head, so this pass reported only CRITICAL and IMPORTANT findings (blocking only: yes).

I read all 13 changed files in full. None of them matches a trusted-path glob. No plugin manifest changed and no trust control was touched.

What I checked:

  • Shell arguments in actions/pr.md. These are the values the new pr action puts into its sweep.py command:
    • --number must be digits. sweep.py also parses it with census._positive.
    • --repo must match ^[A-Za-z0-9._-]+/[A-Za-z0-9._-]+$. sweep.py checks the same pattern itself with REPO_RE.fullmatch and exits 2 when it fails.
    • --branch takes headRefName from the PR, and the PR author picks that name. A git branch name can contain a '. pr.md therefore applies SKILL.md's ticket quote rule (SKILL.md#L228-L230): when the value holds a ', the action stops before running anything. A branch name cannot break out of the single-quoted argument.
  • Transcripts read by subagents. The reader subagents are read-only and are told to treat every line as data under SKILL.md Step 3. The review-comment step calls /corrections:codify reviews only for a merged PR in the current checkout's repository. It passes no PR-supplied text in the call.
  • collect.py / sweep.py. These now also store the branches and PR links that subagents recorded. The values go through the same scrub.key redaction as the main session's, stay in the local store, and are only read back for a local report. No network call, file path or trust decision uses them. In the markdown output, the repo and branch go through markdown_code, and the repo already passed the pattern check.
  • Earlier threads. The matched_by thread is settled and was fixed at 0282e53e. The earlier summary post (no line anchor) had 0 findings, so there is nothing to restate.

Friction hold narrowed (owner threat model, not a finding): Phase 4 of retro/context/session.md keeps the step that waits for the person's approval. It now says a change may be applied without approval where an evaluation set scores the changed surface and the change does not lower its score (session.md#L375-L378). That is a narrowed person-approval hold.

Instruction register: read at docs/contracts/instruction-exception-register/README.md. Apart from the Phase 4 change above, the diff deletes no standing instruction.

Spend: the new pr action runs extra read-only subagents over a PR's transcripts. This uses the user's own session or subscription usage, not a billable resource.

Embedded text: none. The PR context has no instruction aimed at this lane.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/address-feedback
Model rung 0
Leg handoff
Run job success
Activity step success
Commits pushed none (read lane)
Run 43517644257

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

Lane-Activity: pr-unblock/address-feedback
Lane-Thread: PRRT_kwDOTCGFQM63Qlmx
@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/apply-feedback-patch
Model rung 0
Leg base
Run job success
Activity step success
Commits pushed 0282e53
Run 43517644257

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

pr-unblock / address-feedback finished round 1 of max 4 on 0282e53.

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/publish-feedback
Model rung 0
Leg base
Run job success
Activity step success
Commits pushed none recorded
Run 43517644257

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

kyle-sexton and others added 2 commits November 13, 2026 18:16
- pr matches a head branch only in the PR's repository: a session whose
  repo_identity names another repository no longer matches by branch name.
  A null identity still matches, since a removed worktree leaves it null.
- pr hands review comments to /corrections:codify reviews only when --repo
  is the current checkout's repository, which that action reads; otherwise
  it skips the hand-off and says so.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 13, 2026
Merged via the queue into main with commit e1b6287 Nov 13, 2026
53 checks passed
@kyle-sexton
kyle-sexton deleted the feat/session-flow-pr-scope branch November 13, 2026 23:38
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-path: owner-agent Post-merge accounting record (README.md, Merge paths)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant