Repository navigation
refactor(dashboard): route peer session_send through session_deliver.deliver - #23028
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: it is a reversible refactor with the same rows, queue entries and guards, and nothing is taken away. Notes
[DESIGN-REVIEWED] 52518e9 Description read[DESCRIPTION-READ] 0dfbc84380d8b4d6958cdf8f16b563a2d6cdb4d8e88585d5f779f0cd1aaf643c That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS The refactor is reversible and changes no behaviour, but it only half-removes its stated harm: the peer arm forks off before Notes
What this change shipsInventory (5 items) — 3 justifiedIntent: let a peer session's message reach its target through the same delivery entry point that cron, app and work-ledger messages use. REFACTOR, which works as an ADDITION to
[FIRST-PRINCIPLES-REVIEWED] 52518e9 Description read[DESCRIPTION-READ] 5ff22297c841b4e48892e6c80183e2422ec69f23b3751c3a8e6b70ab7577d1b7 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
|
Review-ready on head 52518e9: pr_status.py exits 0 (114 checks, 0 failing, readiness: passed), GPT and Opus clean on this head, Design / First Principles / UX PASS. Part of #22747 (slice B): peer |
buluoray
left a comment
There was a problem hiding this comment.
Approving at 52518e9457d837bae8a69c823a93ffee3bab4300.
Peer session_send now goes through session_deliver.deliver() with a peer origin. The audience fence, cancellation shield, post-RPC re-gate and containment stop stay in send_to_target.
What I checked:
- The outcome mapping in
_deliver_peeris complete.steer_into_running_turnreturns onlysteered/requeued/unavailable(chat_delivery.py:48-50), sounavailable→NOT_DELIVEREDloses nothing. - The new
not slot.runningearly return only covers the gap between the caller's synchronoussteer and slot.runningcheck and the steer task starting. Main gotunavailablethere and fell to the queue arm; this getsNOT_DELIVEREDand falls to the same arm. No double delivery. - The
steer=Falsearm callsenqueue_or_run_promptsynchronously, soawait deliver(...)adds no cancellation point.user_origin=Falseand the admission baseline pass through unchanged.
Tests: 600 passed across the 19 test files that touch send_to_target / session_deliver / broadcast_to_targets. Ten single-line mutations of the new guards each turn a named test red (ended-turn steer, user_origin, admission, requeued mapping, both queue_meta sites in the main arm, the orphaned-fallback outcome, the peer dispatch).
Non-blocking follow-up: setting the orphaned fallback's queue_meta to None survives. test_an_orphaned_delivery_that_comes_back_unavailable_is_queued asserts the text is queued but not its sender stamp. Same gap on main.
CI on this head: 87 success, 14 skipped, 0 failing. Opus, GPT, Design and First Principles are clean.
Problem / Motivation
Goal: A peer session's
session_sendreaches its target through the same session-sidedeliver()that cron, app and work-ledger text already use, with every guard it has today unchanged.send_to_targetstill calledsteer_into_running_turnandenqueue_or_run_promptitself, so the peer sender kept its own copy of the steer-or-queue choice. #22937 moved cron, app messages and the work-ledger wake ontosession_deliver.deliver; this is slice B of #22747.Why it matters
With two places owning the choice, a later change to how a delivery lands has to be made twice, and the peer copy is the one with the most guards around it.
Not a goal
send_to_target, around the calls.api_send_message.What changed (motivation → approach → change)
Approach: add a
peerorigin todeliver()and replace the three delivery calls insend_to_targetwith it. Everything between those calls stays where it is.dashboard/session_deliver.py:ORIGIN_PEER,peer(steer=...), aqueue_metaargument, and_deliver_peer.peer(steer=True)is the steer arm only (user_origin=False, the caller's admission); if the turn ended before it ran it returnsNOT_DELIVEREDand writes nothing, so the caller's re-gated fallback stays the one delivery.peer(steer=False)isenqueue_or_run_promptwithqueue_metaas itsextra_meta.dashboard/session_control_parts/session_messaging.py(send_to_target): the shielded steer task, the orphaned-unavailable fallback and the queue-or-run arm calldeliverwith thepeerorigin, and readDELIVERED_*outcomes instead ofSTEER_*. The non-steer call has no suspension inside, so it adds no cancellation point.monitor-architecture.md.Known limit:
send_to_targetstill chooses steer first, then queue. Its audience fence, shield and post-RPC re-gate sit between those two calls, so the choice cannot move into onedeliver()call without moving those guards too. This PR keeps them where they are;deliver()owns how each arm lands.Size: about 75 production lines in 2 files.
Backwards compatibility
Compatible: a peer send writes the same
userrow, steer row, queue entry andsendOriginstamp it wrote before, with the sameuser_origin=False. The existingtest_session_control_send.pyandtest_session_control_steer_delivery.pysuites pass unchanged except one source-scan anchor.Removes nothing: the moved calls keep their behavior; no key, route or guard goes away.
Tests
test/test_session_deliver.pyTestPeer: a steer that finds the turn ended delivers nothing (fails if the steer arm falls through to queue-or-run); idle runs auserrow and a turn with no human stamp; a running slot queues a non-steer send with itsqueue_meta; a running slot steers a send as ausersteer row (nonudge); steer outcomes map to delivery outcomes and passuser_origin=Falseand the admission.test/test_session_control_send.py:send_to_targetcallsdeliverwithpeer(steer=True), then on an unavailable steerpeer(steer=False)with the sender stamp, and the text lands on the queue.test_session_control_steer_delivery.py(source-scan anchor) andtest_slot_running_readers.py(newslot.runningreader) updated.Proof: on
origin/mainwith onlysession_deliver.pyand the new tests added, thesend_to_targetrouting test fails. Related set: 3202 passed (-n 4), including the facade and flake ratchets. No clock, sleep or network in the new tests.Manual verification
N/A — unit coverage sufficient: rows, queue entries and turns are unchanged and pinned by the existing peer suites.
Related Issues
Part of #22747
Remaining on #22747:
_fire_dashboard_nudge) ontodeliver, so the idleautomationpath stops returningNOT_DELIVERED.send_message(api_send_messageinhandlers/messaging.py) ontodeliverwith thecronorigin.Pattern harvest
Not generalizable: this moves one more sender onto the entry point slice A added; the pattern was harvested there.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)