Repository navigation
refactor(dashboard): route a cron's send_message through session_deliver.deliver - #23052
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the cron sender's idle-or-running branch moves into Notes
[DESIGN-REVIEWED] 2452cae Description read[DESCRIPTION-READ] c42874ebed890ffd0bacd46e00bdb76f48f93e1e5bac46bee22cfbc6772b7497 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 keeps every row, card, turn and eviction the same. One note: the new flag keeps the two cron senders behaving differently, which is the drift the PR says it removes. Notes
What this change shipsInventory (5 items) — 4 justifiedIntent: a cron's message to its origin session goes through the same session-side delivery the script-cron result already uses. This is a refactor (FIX of duplicated logic), not an addition.
[FIRST-PRINCIPLES-REVIEWED] 2452cae Description read[DESCRIPTION-READ] b0cd50ea3d573ebeacf738fcf0f73827fe682ceb3bf3c2898a75106bdbc300a7 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: |
bolichen97
left a comment
There was a problem hiding this comment.
Reviewed head 2452cae. This looks good to me.
What I checked:
- The idle branch in deliver() writes the same inject row as the removed code: role inject, cls with cronLabel, and meta with injectKind cron and cronLabel. It starts the turn with the same arguments: _directive_user_origin=False and _turn_actor set to cron. The synthetic payload flag stays False for a cron.
- The running branch keeps the eviction order: pop the oldest entry, remove its queued card, then queue the new cron card. Only this caller passes evict_oldest=True, so the script cron result and the app paths do not change.
- deliver() writes the row before its first await, so the move adds no new interleaving point in the handler.
- I ran the five changed test files at this head: 141 passed. The new parametrized test in test_session_deliver.py goes red if the eviction branch is removed, and the handler test pins evict_oldest=True.
- The linked issue is tier T1. No file is on a sensitive path.
Remaining before approval: the PR Readiness check is still pending on this head. I will approve after it passes on the same head.
|
Review-ready on head 2452cae: pr_status.py exits 0 (116 checks, 0 failing, readiness: passed), GPT and Opus clean on this head, Design / First Principles / UX PASS. Part of #22747 (slice D): a cron's |
bolichen97
left a comment
There was a problem hiding this comment.
Approving head 2452cae.
Gates checked on this head: readiness label is passed, PR Readiness is green, no required check is failing or pending, every review lane reports PASS, there is no merge conflict, the base is main, and no file is on a sensitive path. The linked issue is tier T1.
The change routes a cron's send_message through the shared session delivery path. The five changed test files pass at this head (141 tests), and the new parametrized test fails if the eviction branch is removed.
Setting squash auto merge.
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: refactor (8 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, security checklist all-NO, no reviewer-lane findings, readiness signal fresh for this head SHA, declared category matches the diff. Category: code move that replaces the cron send_message idle and running branches in the messaging handler with session_deliver.deliver, which writes the same cron row and turn actor when idle and queues the same card when running, with the oldest-entry eviction moved behind an evict_oldest flag; tests pin both paths. Spec files changed as a ride-along (a minority of the diff on both file count and changed lines), not reviewed as a design decision: docs/system-specs/modules/monitor-architecture.md.
Problem / Motivation
Goal: A cron's
send_messageto its origin session reaches that session through the same session-sidedeliver()the script-cron result already uses, with its evict-oldest queue behavior unchanged.api_send_messageinhandlers/messaging.pystill branched onslot.runningitself and wrote its owninjectrow, queued card and turn. The script-cron result path (_deliver_script_result) moved ontosession_deliver.deliverin #22937, so the two cron senders had two copies of the same choice. This is slice D of #22747.Why it matters
Two cron senders with two copies of the idle-or-running branch drift apart: one gets a fix the other misses, and the same cron text lands as different rows depending on which route sent it.
Not a goal
deliver(slice C).api_send_message's redaction, authorization, origin-session resolution or bell fallback.What changed (motivation → approach → change)
Approach: the cron sender names its
cronorigin and keeps its own queue-full policy as a flag.dashboard/session_deliver.py:deliver(..., evict_oldest=False). For a cron notification on a running slot whose live queue is full,evict_oldest=Truepops the oldest entry and removes its card, then queues the new one, with the same warning log. Without the flag nothing changes for the existing callers.dashboard/handlers/messaging.py(api_send_message): the idleinjectrow +spawn_guarded_turnbranch and the running eviction +queue_cron_notificationbranch become onedeliver(state, slot, wrapped, cron(label), evict_oldest=True)call.monitor-architecture.md.Known limit: the two cron senders still differ on a full live queue.
api_send_messagedrops the oldest entry (evict_oldest=True); the script-cron result path does not check the cap. Keeping each sender's current behavior was the scope of this slice; aligning them is a behavior change for a separate decision.Size: about 25 production lines in 2 files (net −40 in
messaging.py).Backwards compatibility
Compatible: the cron send writes the same
injectrow (injectKind: cron,cronLabel), the same queued card, the same_turn_actor="cron"turn, and still drops the oldest live entry when the queue is full.Removes nothing: no key, route or guard goes away; the branch moved into
deliver.Tests
test/test_cron_origin_injection.py:api_send_messagefor a cron's origin session callsdeliverwith thecronorigin, its label, the resolved slot andevict_oldest=True.test/test_session_deliver.py: on a full live queue a cron notification drops the oldest entry and its card only withevict_oldest=True; without it both stay.test_chat_turn_timeout_consistency.py(6 sites),test_handlers_messaging_composition_contract.py,test_slot_running_readers.py.Proof: on
origin/mainwith onlysession_deliver.pyand the new tests added, theapi_send_messagerouting test fails. Related set: 2702 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: the cron rows, queue entries and turns are unchanged and pinned by the existing cron-injection suites.
Related Issues
Part of #22747
Remaining on #22747: slice C, the idle autonudge fire (
_fire_dashboard_nudge) ontodeliver, so the idleautomationpath stops returningNOT_DELIVERED.Pattern harvest
Not generalizable: 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: ...)