Repository navigation
fix(server): stop a Pi approval from outliving its session - #16854
Adamulek123 wants to merge 4 commits into
Conversation
Pi kept session approvals across thread switches and rollback, so a permission granted in one thread could silently authorize a later thread. Clear approvals and cancel pending prompts at session boundaries, reject late cancelled-prompt responses, and check the bound session at turn finalize. Key approvals by every payload field except the request id in canonical order, with wire-level regression coverage for all boundaries. Model: gpt-6.1-sol (Codex)
The audit found that the expanded approval key cannot distinguish real Pi confirm payloads, and the metadata test fabricated an unsupported field. Restore the original title/message key, remove that case and its redundant wire assertion, and preserve the runtime_request.updated assertions. Defer the transport send to test cancellation during thread replacement and empty rollback. Both cases fail when the adapter's late-response guard is removed. Reuse successful settle-probe state during finalization, and test same-session reuse, foreign-session invalidation, and failed-probe fallback. Keep the existing authorization fix, boundary clearing, pending-prompt cancellation, and late-response guard. Leave user-visible prompt text and state lookups on finalization paths without a successful probe alone. Model: gpt-6.1-sol (Codex)
Model: gpt-6.1-sol (Codex harness)
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — The PR fixes session-scoped Pi approvals and adds strong race and failure-path coverage, but it changes authorization behavior on existing server request paths. Because it can determine whether extension work proceeds silently or requires renewed confirmation, the approval boundary merits human review. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughPiAdapterV2 now checks cached session approvals against Pi session state during turn finalization. Thread registration and rollback clear approvals and cancel pending prompts. Runtime-request handling stops if a prompt is removed while its response is sending. ChangesPi session approval lifecycle
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to No actionable regression attributable to this change was established. The PR is mergeable after normal checks. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change narrows approval reuse across sessions, with no demonstrated new authorization bypass. Remaining uncertainty concerns whether delayed approval responses are safely rejected after cancellation. Retained concerns Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Keep upstream migration IDs 59 and 60; move YSK to 61 and repair historical fork ledgers atomically after applying missing schema changes. Adapt selected upstream fixes for Pi approvals, MCP images, workspace discovery, provider worker starvation, concurrent worktree launches, primary runtime ownership, session refresh, DPoP URLs and embedded-render scrolling. Preserve fork lifecycle and notice behavior, and close the approval and authentication gaps found in review. Adapted from pingdotgg#16854, pingdotgg#15879, pingdotgg#17190, pingdotgg#16790, pingdotgg#17197, pingdotgg#17172, pingdotgg#17075, pingdotgg#17037, pingdotgg#17065. Co-authored-by: Adamulek123 <adam.bogucki2018@gmail.com> Co-authored-by: anntnzrb <anntnzrb@proton.me> Co-authored-by: Wout Stiens <71498452+StiensWout@users.noreply.github.com> Co-authored-by: Lakshmi Tanmay <lakshmi@voltcrash.com> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Co-authored-by: Jake Leventhal <jakeleventhal@me.com> Co-authored-by: Malte Sussdorff <malte.sussdorff@cognovis.de> Co-authored-by: sheehanmunim <sheehanmunim@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Dara Adedeji <daraadedeji07@gmail.com> Co-authored-by: Joseph Vidal <josephv4000@gmail.com>
Pi kept session-wide approval grants when the same connection switched to another native Pi session. A matching confirmation in that new session could reuse the earlier grant silently. Clear grants and cancel pending prompts at session registration and rollback boundaries. Ignore late responses to cancelled prompts, and clear grants when turn finalization reports a different or unreadable session identity. Reuse a successful settle probe's state response; keep the existing title/message approval key.
The shared server behavior applies to web, desktop, and mobile.
Scope and approval
Submitted for consideration under the focused obvious-bug exception. A grant for one native Pi session could silently approve an identical prompt after switching sessions. Revoking grants at those boundaries and when session identity cannot be verified fixes that single defect. Only the Pi adapter and its tests change; approval matching within a verified unchanged session stays the same.
No prior maintainer approval is claimed. Macroscope requires human review because this touches the approval boundary. CodeRabbit approval and passing CI do not replace that review.
Verification
The simple/pi replay failed on Windows in the earlier verification at both this branch and its actual base commit, with escaped command arguments that do not match the fixture. No live Pi or client pass was run, and native slash-command session switching was not verified. Identical title/message prompts still share grants within one native session.
Implemented with gpt-6.1-sol through the Codex harness.