Skip to content

feat(pr-management): wire live session feed, action toggling, and review-flow integration (part 3 of #1887) - #1992

Merged
potiuk merged 3 commits into
apache:mainfrom
Kaap10:feat/pr-management-findings-pane-pr3
Nov 4, 2026
Merged

potiuk merged 3 commits into
apache:mainfrom
Kaap10:feat/pr-management-findings-pane-pr3

Conversation

@Kaap10

@Kaap10 Kaap10 commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This is PR-3 (Part 3 of 3) completing Issue #1887 (and part of #1497) for the magpie-pr-management Claude Code mod. Building on the data models in PR-1 (#1920) and the presentational Pane component in PR-2 (#1954), this PR wires the live session feed, interactive action toggling, and vendor-neutral skill flow integration:

  • Live session feed (Fail-open): Intercepts pr-management code-review disposition --findings <file> via tool.call on Bash. Reads and parses the live drafted findings into reviewFindingsState. Unconditionally invokes next(e) so tool execution is never blocked or gated. When findings are empty ([]), or when reading the findings file fails, resets the state atom to null to avoid stale findings sticking across sessions.
  • Zero-token curation command: Registers the /magpie-findings slash command for inspecting and curating review findings directly from the prompt (status, all, none, keep <indices>, drop <indices>, edit <idx> <note>). Shows both inline comments (1..N) and general observations (g1..M).
  • Edited findings serialization (not wired yet): serializeFindingsForRender removes base.suggestion and sets base.explanation = f.body for an edited finding. Nothing outside the tests calls it yet, so the pane does not change what is posted.
  • Interactive UI controls & disambiguated indexing: Attaches interactive Button elements with direct clicks and ui.press event handling (toggle-<N>, toggle-general-<N>, accept-all, skip-all, prev-finding, next-finding). Disambiguates 1-based indexing so inline actions map strictly to anchored findings (1..anchored.length), returns -1 on out-of-range indices without arbitrary whole-list fallbacks, and supports g<N> / G<N> for general observations.
  • Skill workflow documentation: Documents the interactive pane mod in review-flow.md Step 7a as an interactive visual overview during review triage, with semantic line breaks (one sentence per line) while upholding strict vendor neutrality: Codex, Antigravity, Cursor, and headless CI continue using the standard sequential text picker prompt.

Type of change

  • Skill change (.claude/skills/<name>/) — eval fixtures updated below
  • Tool / bridge contract (tools/<system>/*.md)
  • Python package (tools/*/ with pyproject.toml)
  • Groovy reference impl
  • Cross-cutting (RFC, AGENTS.md, sandbox, privacy-LLM)
  • Documentation (docs/, README.md, CONTRIBUTING.md)
  • Project template (projects/_template/)
  • CI / dev loop (prek, workflows, validators)
  • Other: Claude Code mod plugin hooks & tests (plugins/magpie-pr-management/hooks/)

Test plan

  • claude plugin test plugins/magpie-pr-management passes all 61 unit, integration, and E2E simulation tests (0 failures).
  • claude plugin validate --strict plugins/magpie-pr-management passes static analysis with 0 errors and 0 warnings.
  • pytest tools/pr-management/tests/code_review passes all 211 Python code-review tests.
  • Full end-to-end simulation test verifies the complete lifecycle: Step 6 disposition feed hydration -> Step 7a Pane rendering -> UI press inline action toggle -> /magpie-findings edit finding curation -> formatKeepAnswer keep string generation -> clean PR atom reset.
  • Line endings verified strictly LF (CRLF: 0) across all touched files.

RFC-AI-0004 compliance

  • HITL — The interactive pane and /magpie-findings command purely curate drafted findings for the maintainer; posting still requires explicit confirmation in Step 7b and Step 8.
  • Sandbox — tool.call interceptor is fail-open and operates exclusively on local session paths via $.fs.read.
  • Vendor neutrality — The mod is strictly additive; non-mod harnesses (Codex, Antigravity, Cursor, headless CI) seamlessly retain the standard text picker prompt in review-flow.md Step 7a.
  • Conversational + correctable — Maintainers can adjust, edit, or reset finding actions at any point before running render.
  • Write-access discipline — No autonomous GitHub writes or review postings.
  • Privacy LLM — Zero tokens consumed by the interactive pane UI and /magpie-findings slash command.

Linked issues

Closes #1887
Part of #1497

Notes for reviewers (optional)

Directly addresses review feedback from maintainer @potiuk on PR #1992:

  1. Clarified in review-flow.md that the pane serves as an interactive visual overview during review triage, and dropped the claim regarding automated keep translation to render.
  2. Removed all undocumented hotkey mentions (1–9, a, n, k, j) across docs and docstrings.
  3. Updated handleBashToolCall to reset state to null on failed read or empty file content, preventing stale findings leakage.
  4. Fixed index resolution in resolveFindingIndex to return -1 on out-of-range inline indices without whole-list fallbacks, added g1..gM numbering for general observations, and updated /magpie-findings status to list both inline and general observations.
  5. In serializeFindingsForRender, deleted base.suggestion when action === 'edit'.
  6. Formatted added documentation in review-flow.md with semantic line breaks (one sentence per line).

…iew-flow integration (part 3 of apache#1887)

Complete PR-3 for the interactive review findings pane Claude Code mod (closing apache#1887, part of apache#1497).

- Feed live session review findings via `tool.call` on Bash, intercepting code-review Step 6 (`disposition --findings <file>`) in a fail-open contract
- Reset `reviewFindingsState` atom to `null` when a review findings file carries no findings
- Provide zero-token `/magpie-findings` slash command for terminal-first findings inspection and curation (`status`, `all`, `none`, `keep`, `drop`, `edit`)
- Implement pure state mutators for deterministic finding action cycling (`accept` -> `skip` -> `edit` -> `accept`), selection navigation, and bulk updates
- Connect edited finding notes to `serializeFindingsForRender`, ensuring maintainer edits override stale raw explanations in `render --findings`
- Support interactive `Button` elements with direct clicks, keyboard hotkeys (`1`–`9`, `a`, `n`, `k`, `j`), and `ui.press` event handling, with fallback to clean `Text` rows
- Disambiguate 1-based indexing so inline actions map to anchored findings without key collisions against general observations
- Integrate the mod into `review-flow.md` Step 7a while upholding strict vendor neutrality for Codex, Antigravity, Cursor, and headless CI
- Add unit, integration, and full lifecycle simulation tests (60 pass, 0 fail)
@Kaap10

Kaap10 commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

up fo review :)

@potiuk potiuk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The state handling is careful and well tested, but the pane's choices never reach render, so a comment skipped or edited in the pane is still posted unchanged, and that needs fixing before this lands.

Curated actions reach render (plugins/magpie-pr-management/skills/code-review/review-flow.md:326)

The curated actions deterministically translate to the --keep argument passed to render.

The curated actions deterministically translate to the `--keep` argument passed to `render`.

Nothing connects the pane to render. serializeFindingsForRender is called only from tests, the mod never writes a file, and formatKeepAnswer only appears in the text /magpie-findings prints, which is described as zero-token, so the agent never sees it. Step 7b runs render --findings <file> on the original file with the --keep the agent got from the text picker. So a maintainer who skips a comment in the pane still sees it posted, and an edit is lost. That is worse than having no pane, because the maintainer believes the review was curated. Please close the loop: for example, write the serialized findings and keep answer to a file beside the findings file, and have Step 7a and 7b read it when present. If that belongs in a later PR, this PR should say the pane is display-only for now and drop this sentence.

Flagged by both the primary and adversarial reviewers.

Smaller observations

  • general — The two new paragraphs in review-flow.md hold several sentences per line.
  • See inline comments on plugins/magpie-pr-management/hooks/review-findings.ts:985, plugins/magpie-pr-management/hooks/review-findings.ts:1140, plugins/magpie-pr-management/hooks/review-findings.ts:660, plugins/magpie-pr-management/hooks/review-findings.ts:813.

This review was drafted by an AI-assisted tool and
confirmed by an Apache Magpie maintainer. After you've
addressed the points above and pushed an update, an Apache Magpie
maintainer — a real person — will take the next look
at the PR. The findings cite the project's review criteria;
if you think one of them is mis-applied, please reply on the
PR and a maintainer will weigh in.

More on how Apache Magpie handles maintainer review:
Contributing guide.

… and indexing

Address maintainer review feedback on PR apache#1992:
- Drop keep translation claim and hotkeys from review-flow.md; clarify display-only visual overview during review triage with one sentence per line.
- Delete base.suggestion when action is edit in serializeFindingsForRender.
- In resolveFindingIndex, return -1 for out-of-range inline comments, add g1..gM numbering for general observations, and update status display.
- In handleBashToolCall, reset state to null on read failure or empty findings content.
@Kaap10
Kaap10 force-pushed the feat/pr-management-findings-pane-pr3 branch from d5c1d78 to bd765eb Compare November 4, 2026 15:17
@github-actions github-actions Bot added family:pr-management pr-management-* skills capability:review Deep per-item code review or contributor mentoring labels Nov 4, 2026
…sted

Only the answer typed at the picker reaches render, so a note from
/magpie-findings edit has to be entered again there.

Generated-by: Claude Opus 5
Claude-Session: https://claude.ai/code/session_01NyQq9RhAeBonGTieer5Lu4

@potiuk potiuk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, this addresses the review: the stale-state reset, the g1..gM numbering, the removed hotkey references and the dropped render sentence all hold up in the code.

I pushed one small commit rather than asking for another round, so please pull before pushing again.

ed049d6 adds a sentence to review-flow.md Step 7a. The pane and /magpie-findings do not change what is posted, because only the answer typed at the picker reaches render, so a note from /magpie-findings edit has to be entered again there with E <n>.

Three things can follow in a later PR:

  • serializeFindingsForRender still has no caller outside the tests, so an edit does not reach render yet. Connecting it, for example with a file beside the findings file that Step 7b reads, would make the pane a real curation step.
  • Skipping a general finding in the pane changes nothing, because the keep answer only covers inline comments.
  • register's doc comment now sits above handleUiPress, about 360 lines from the function.

This review was drafted by an AI-assisted tool and
confirmed by an Apache Magpie maintainer. The maintainer
approving this PR has read the findings and signed off. If
something feels off, please reply on the PR and a maintainer
will follow up.

More on how Apache Magpie handles maintainer review:
Contributing guide.

@potiuk
potiuk enabled auto-merge (squash) November 4, 2026 22:06
@potiuk
potiuk merged commit 50ee9f0 into apache:main Nov 4, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

capability:review Deep per-item code review or contributor mentoring family:pr-management pr-management-* skills

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(pr-management): add interactive review findings pane Claude Code mod (part of #1497)

2 participants