Repository navigation
Conversation
|
👋 Hi! This PR's description is missing some required sections from our PR template. Workflow runs won't be auto-approved until the description is updated. Missing sections:
Please update your PR description to include these sections, then push or re-save the description. The workflows will be approved on the next cycle. |
1 similar comment
|
👋 Hi! This PR's description is missing some required sections from our PR template. Workflow runs won't be auto-approved until the description is updated. Missing sections:
Please update your PR description to include these sections, then push or re-save the description. The workflows will be approved on the next cycle. |
0bc5b36 to
8df66fa
Compare
Design Review (Fable 5, fork) — 🟡 CONCERNSDesign-level review of Design-Verdict: CONCERNS Sound, well-reasoned solution to a real provenance gap — but it bundles a blast-radius-wide governance-primitive change into a note-mirror feature PR. WatchThe governance profile-store change rides in with the feature: [DESIGN-REVIEWED] 5af16aa |
GPT 5.6 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
First Principles Review (Fable 5, fork) — 🟡 CONCERNSPremise-level review of I have enough to review. Let me confirm the The base shows First-Principles-Verdict: CONCERNS A note-mirror Not justified as shipped
What this change shipsInventory (10+ items) — 6 justifiedIntent: make a
More than 10: also Watch
Subtractions
[FIRST-PRINCIPLES-REVIEWED] 5af16aa |
Opus 4.8 Review (fork) — ✅ no blocking findingsReviewed |
8df66fa to
3f24eef
Compare
3f24eef to
24252c3
Compare
24252c3 to
5464c9c
Compare
|
Item 1 is resolved at head The paragraph now describes what ships. It opens " Evidence at this head:
One more of the same class, found while verifying this and fixed in the same change. The spec and the Description both listed a refusal code Thanks for the precise citation — the pointer to the single consumer is what made the rewrite checkable rather than a guess. |
|
Still resolved at the current head Re-read at this head:
No code changed this round. The only reason for this note is that the head sha moved, so the evidence in my earlier reply pointed at a commit that is no longer current. |
|
All items are satisfied at head Taking your points as separate items: The The The "The guard logs rather than writing an SEL row" — this is the one item where the code moved rather than the prose, and it moved the way you wanted. The guard is at The three-state claim in the description — gone: 0 occurrences of "three states" or "THREE states", and the paragraph now reads " "Nothing in the prose says where the guard actually lives" — this was the part with the longest reach, and it is now explicit: the paragraph names I did not re-add the |
|
All three claims in your review are satisfied at head The The The shipped shape is two-state, as you read it. One correction to the review, on the part that has moved: that refusal is not log-only. Separately, on the overlap you raised with the other change to the same held-note pipeline: that is an ordering question between the two, not something a commit here can settle, so it stays yours to call. |
|
All three claims in your review remain satisfied at head The The The shape is two-state, as you read it. A correction to my previous note, which gave two line numbers wrongly. It cited the guard at One part of the review has moved since it was written. The refusal is not log-only: |
|
Still settled at head Code — your reading is correct, and unchanged at this sha. Prose — the paragraph you quoted is no longer in the description. Measured against the live body: The one part of your review that has moved: the refusal is not log-only any more. Nothing here needs a further change; if you see something at this sha that I have measured wrongly, name the file and line and I will read it there. |
|
Re-verified at head Claim 1 — the Claim 2 — the Claim 3 — the shape is two-state, not three. Required change — the description now matches. The paragraph you quoted is gone: One thing in your review has been overtaken by later work, and it is the part worth re-reading. The refusal is no longer log-only: If anything above is measured wrongly, name the file and line and I will read it there. |
|
Verified at head Your reading of the code was correct, and it still holds.
The description paragraph now describes that. Measured against the live body: On the audit row, since your required change left it open as a choice. It was emitted rather than dropped, but under the reason code the code actually uses: If any measurement above is wrong, name the file and line and I will read it there. |
|
Still settled at head Your reading of the code was right on all three counts, and it holds here. The description no longer carries the claims you flagged: On the audit row your required change left as a choice: it was emitted rather than dropped, under the reason code the code actually uses — |
|
Verified at head 1 — the 2 — 3 — the guard is where you said, caller-side on a plain 4 — the refusal now WRITES the audit row, so it is no longer log-only. This is the substantive change since your review. The two silent branches are deliberate and say so in place: an install with no channel transports at all ( So the second half of your required change is the one that was taken — the audit row is emitted and the claim kept — and the description describes that rather than the |
|
@bolichen97 — verified at head The description now describes what ships. The "An absent snapshot is no longer a licence to deliver" paragraph reads two-state, states explicitly that there is no What the code does, with coordinates:
Absence, positive-controlled (a zero is otherwise a claim about the grep): One coordinate correction for anyone following your review: you cite the guard at Your read of the cause was also right — the First Principles subtraction was adopted in the code and the prose lagged it. Thanks for catching it; a reader told a security-boundary refusal is filterable in the audit log under a name that is never written is worse off than one told nothing. |
|
@bolichen97 — your three measurements were right, and the paragraph has been rewritten to match. Re-verified at head The paragraph now reads:
So the Verified at this head, with positive controls (a zero is otherwise a claim about the grep rather than about the code):
One coordinate has drifted since you wrote: you cite the guard at Your diagnosis of the cause was right too — the subtraction was adopted in the code and the prose lagged it. Thanks for catching it. A reader told a security-boundary refusal is filterable in the audit log under a name that is never written is worse off than one told nothing at all. |
|
@bolichen97 — re-verified at head Every claim in your review was accurate about the code when you wrote it. The defect was entirely in the prose, and the prose now matches. Item by item: 1. No module-level 2. No 3. The refusal is a caller-side guard on a plain 4. No SEL row named The description now describes exactly that. The paragraph states I took the description route, not the audit-row route, for the reason you gave: emitting that row would re-add part of what the First Principles subtraction removed. Your diagnosis of the cause was right — the subtraction landed in the code and the prose lagged behind it. Thanks for catching it; being told a security-boundary refusal is filterable in the audit log under a name that is never written is worse than being told nothing. |
|
@bolichen97 — verified at head Already correct at this head — the description. The "An absent snapshot is no longer a licence to deliver" paragraph now describes a two-state Your four code claims, each with a positive control (a zero is otherwise a fact about the grep, not about the code):
One clause is now out of date, and it matters to your Risk paragraph. You wrote that the guard "logs rather than writing an SEL row", and that a reader would look for a filterable row that is never written. A row is written: That row also had a real gap you could not have seen from the tree you read: on the immediate I took the description route rather than adding the Your diagnosis of the cause was right — the subtraction landed in the code and the prose lagged it. Thanks for catching it. |
|
@bolichen97 — re-anchoring my earlier reply to the current head,
Your required change is in the description: the paragraph now states One clause of your Risk paragraph no longer applies, and it is the part that mattered: you wrote that the guard logs rather than writing an SEL row, so a reader would hunt a filterable row that is never written. A row is written — Your diagnosis was right: the subtraction landed in the code and the prose lagged it. This is the same disposition I gave at |
|
@bolichen97 — re-anchored to the rebased head,
Your required change is in the description: the paragraph states One clause of your Risk paragraph no longer holds, and it is the operative one: you wrote that the guard logs rather than writing an SEL row, so a reader would hunt a filterable row that is never written. A row is written — Your diagnosis was right: the subtraction landed in the code and the prose lagged it. Nothing in the rebase changed any of this — it is restated here only so the evidence names the head that now exists. |
|
Fixed at Two-state on the shared helper. No The guard at the one consumer.
The audit row. This took the second option you offered rather than deleting the claim: the row is emitted, reusing the existing module-level emitter instead of reinstating the bespoke SEL row the subtraction removed. That last item is a fresh prose claim of exactly the kind you caught last time, so I did not verify it by reading it. I deleted the No code changed for this — every item was already satisfied at the head above, so there is no new commit. |
|
Still holds at
No code or description change was needed this round. |
|
Still satisfied at Description, the paragraph your required change named:
Code, at that sha:
Each zero above was run against a positive control so it means absence rather than a bad query: No code or description change was needed for this. |
|
Two items, both verified at The record-shape paragraph is fixed in code. You were right that "carries exactly I also re-checked your crash-risk note at this head rather than at the sha you audited, since the head has moved a good deal since: The two remaining parts of your suggestion are not reachable from this side, so they need the ordering decision you proposed: there is no The description/code mismatch is settled. The paragraph now reads that
Each zero above was run against a positive control so it means absence rather than a bad query: |
|
Re-verified at The description/code mismatch. The paragraph states
The shared-list record shape. Each zero above was paired with a positive control so it is a statement about the code rather than about the query: The remaining parts of your ordering suggestion are still not reachable from this side: there is no |
|
Both items in the description/code mismatch are verified at head 1. The
2. The
Positive controls for the zero counts above, same greps over the same paths: in The single |
A note's context half already reaches the model on any surface, but its visible half broadcast only to the dashboard — so a channel-driven session gained the context with no visible provenance where its user was actually reading. Delivers through the two existing outbound paths and reports `mirroredTo` so a caller can tell delivery from silence, with the Slack leg gated on recipient authorization re-asked after every await and the shared ladder revalidating its binding before it sends.
|
Verified at head The "An absent snapshot is no longer a licence to deliver" paragraph was rewritten and now describes what ships:
That addresses the risk you named. A reader told the refusal is SEL-audited will now find a filterable row; it is written under No code or description change was made in response to this comment — both had already landed in earlier pushes. Raising it because the requested-changes review is currently the only blocking item on this PR, so if you agree it is settled, the PR needs your re-review rather than another revision. |
|
🤖 Kiro Crew [operator: NicholasRBowers#a942f9ca]: This PR has been inactive for 7+ days. I reviewed the blockers but they require your input:
For the record, nothing is failing on the code itself: the only red besides readiness is When you've addressed these, the pipeline will re-assess on its next cycle. |
|
Consolidation: rebase this PR onto PR #10928 and drop its copy of the send_message channel leg @rnoack1 PR #10928 says it was "Split out of a larger messaging change", but this branch was not trimmed after the split. Both PRs now rewrite the same function, The shared leg. This PR turns it into a public
Only in this PR. The Suggested sequence (both PRs are yours):
Also carry these through the rebase:
From a full open-PR audit against origin/main c66f95b (2026-09-25); findings were checked by independent reviewers reading the code. Reply here if this is wrong. |
PR triage (2026-10-05): rebase needed; overlap with #10928 still openChecked against origin/main
Recommendation: REBASE onto main (after #10928 if that lands first), then MERGE-DISCUSSION with #10928 and #7163. Not a duplicate, and not superseded. Do not close. |
|
Thank you for this work. This PR has had no activity for more than 30 days, it conflicts with main, and the questions from the earlier review are still open. I am closing it for now. If you want to continue, rebase it onto main after #10928 lands, drop the duplicated channel leg, and reopen it. |
Problem / Motivation
POST /api/chat/slots/{slot}/notewrites two halves. Only one was surface-aware.The context half is already surface-agnostic:
drain_pending_contextruns inside_run_chat, the one runner every inbound surface shares, so a note reaches the model whether the next message is typed in the dashboard, Slack or Telegram.The visible half was not.
slot.append(broadcast=True)fans out over the dashboard's own SSE/WS and nothing else, and every channel egress lives in the turn loop (user echo, tool stream, assistant reply, approval prompt, auth error) as a separate site the note path never reached.Why it matters
The result is worse-shaped than a missing notification: a session driven from a channel gained an agent that silently knew something its user was never shown. The note had no visible provenance on the surface they were reading, so the next turn referenced something with no record behind it. A missing notice gets noticed; invisible provenance does not.
What changed
Delivery reuses the two existing outbound paths rather than adding a third, matching
chat_compaction_notice— the closest existing analogue, a proactive non-turn notice addressed to whatever conversation a session belongs to.slack_client.post_message. Slack is deliberately absent from thechannel_transportsregistry so it cannot ride the ladder, and it is the one channel bindable two ways: a Slack-born session's origin, or a dashboard slot's_slack_linkedmirror. Both resolve here._resolve_channel_target), walking origin then mirror. This covers the remaining nine transports with no per-channel code, inheriting governance vetting, recipient re-authorization,supports_proactive_sendandchunk_for_transport.Both legs can fire for one note: a dashboard slot can hold a Slack thread link and a non-Slack mirror at once, and each is a conversation with a user in it.
The mirror is dispatched in the background and the response reports nothing about it. An earlier revision returned a
mirroredTofield; First Principles measured zero consumers for it, and I confirmed that at source — the field appeared in 0 files at the base, so it had never shipped and no external caller could depend on it. It was also the only reason the POST waited on a channel at all. Removing it removes the wait, the ceiling that bounded the wait, and both arms that served it. The note's contract stays the transcript line and the context entry. For a note that is NOT held those are committed before the mirror is dispatched. A HELD note is not mirrored at all, which is how that inverse gap is closed. While a turn is runningappendedis false and neither half is committed, so a foreign binding acquired before flush drops BOTH rather than retargeting them; mirroring at POST would therefore have published a channel note asserting content the session never received. The dispatch is guarded byif not deferred:anddeliveryConditionalreports the hold, so no caller is told otherwise. Mirroring held notes at FLUSH time, once their halves land, now ships: the held record carries its authored destinations andflush_deferred_notesdispatches them, across its six invocation sites in three modules (chat_orchestratortwice,chat_runnertwice,chat_handlerstwice, the last two on a slot being torn down) (a different count from the seven resolve-then-send sites inventoried inslack_egress.py) and moving channel egress under it is a behaviour change to a surface this PR does not otherwise touch.Two decisions worth a reviewer's attention
HELD NOTES MIRROR AT FLUSH, not at POST. A note arriving while a turn runs is held, and that is the common case for background senders by the module's own docstring, so it is the case the feature most needs to cover. Mirroring at HOLD time is rejected on orphan-post integrity: neither half is committed while held, so the channel would carry a line the transcript does not yet have, and a foreign rebind before the flush drops both halves and leaves the channel asserting a note that does not exist in the session. An orphan post is a data-integrity defect; a dropped best-effort mirror is not. So the POST dispatch stays guarded by
if not deferred:, pinned bytest_a_held_note_does_not_reach_the_channel, and the held record instead carries the destinations the note was AUTHORED for plus a bound dispatch.flush_deferred_notescalls it once BOTH halves commit, pinned byTestAHeldNoteMirrorsAtFlush. Snapshotting at authoring rather than at flush is what keeps the authored-link guarantee: a channel rebind during the hold makes the send REFUSE on the comparison instead of retargeting to the replacement. Three cases are pinned separately — the dispatch itself, a raising mirror not un-writing a committed note (the suffix-restore must not fire for a delivery failure), and a note dropped for a foreign rebind never dispatching at all. The mirror is carried on the record rather than threaded through a new parameter becauseflush_deferred_notesis called from five sites across three modules and its no-argument spelling is asserted by tests outside this change.An absent snapshot is no longer a licence to deliver.
authored_linkis TWO-state on the shared helper: omitted (an inline caller, which has no authored binding to compare against, which therefore skips only the authored comparison, not the continuation re-ask) or a captured link (compare and refuse on a mismatch). There is no_UNSETsentinel — the third case, a slot with NO binding when the work was authored, is refused at the ONE site that can produce it,chat_note_mirror._deliver_via_transport, whoseif authored_link is None:guard returns without delivering. That placement matters: the helper's walk runs when the TASK runs, so passing an unbound slot through would let it read a binding created after authoring and treat that as the authorized destination. Refusing at the capture site's consumer keeps the shared helper two-state and needing no sentinel to tell "absent" from "captured None". That refusal files a deniedaudit_channel_sendrow under the reason codeunbound_at_authoring, because on an install that HAS channel transports it is a permission decision about a real deliverable surface, and it would otherwise be the only denial on this leg with no SEL record. The exemption is the no-transport install, which stays silent: there the refusal is about the install rather than the request, so a row would fire for every note on every session while naming no destination. The emitter is module-level precisely because a second site refuses on this leg — a hand-written second copy is how a denial stream comes to look complete with one branch missing. A future producer that begins passingauthored_linkmust still carry its own guard for the unbound case; the shared helper does not provide one.Two duplications collapsed.
deliver_to_channel's_walk_ladderclosure was a second hand-written copy ofsnapshot_channel_link's origin→mirror pause-aware loop, so "the snapshot and the delivery agree by construction" actually meant "they agree as long as both copies are edited together" — and a pause-awareness fix applied to one is exactly the divergence the comparison cannot detect. The closure now calls the shared helper.snapshot_slack_linkwas a pure alias of a private_slack_linkwith one consumer; the body now carries the public name and the alias is gone.channel_egress_permittedgains a requiredtool_nameparameter and is public. Slack bypasses the ladder, so without sharing this gate the note's Slack leg would be the one unvetted, unaudited egress. Duplicating a fail-closed gate is how the two copies drift, so this is one function with a parameter rather than two that look alike.tool_nameis a caller identity for the SEL record, never a permission input. It is public because it genuinely has two consumers in two modules — this chain and the compaction notice, which imports it fromslack_egress— so a private name would advertise a boundary the code does not respect.tool_namecarries no default: all three call sites pass it explicitly, and a default would only let a future caller inherit another feature's identity in the SEL record.The pause gates are honoured on both legs. A note is background rather than turn output, so
slack_mirror_is_paused/mirror_is_pausedare not strictly aimed at it — but disconnect is the user saying "not into this conversation", which covers a note about it as much as a reply in it, and the dashboard transcript still carries the line either way.Scope, stated up front. The hardened chain covers the note mirror and nothing else.
api_send_message's Slack leg, the owner DM and the hook DM stay plain-client, and the compaction notice takes the shared gate without the rest of the chain, so three proactive-Slack tiers ship here rather than one. Reading the chain as a repo-wide guarantee would be wrong. The tier table below names every site, and a census test fails if a fourth tier appears unmarked.One caller outside the note feature gains one refusal, and the line is fail-open vs contract-widening.
api_send_messagesharesdeliver_to_channel, and the split is by QUESTION rather than by caller.Asked unconditionally. "Was the permit authorized under the ceiling STILL INSTALLED" needs no captured link: the ceiling is sampled before the target resolve, and that resolve is offloaded because it walks the profile directory, so it is an unbounded await for every caller. Asking this only when an authored link was present was a fail-OPEN — a tightening landing inside that window left the permit authorized under a ceiling no longer installed and part 1 went out on it.
link_changed_during_recheck_before_part_1andgovernance_changed_before_part_1therefore apply to every caller, both refuse BEFORE part 1 so nothing is delivered, andtest_an_inline_send_refuses_when_governance_tightens_during_resolvepins it.Gated on
authored_link. One question is dispatched-only: "is the live binding the one this WORK WAS AUTHORED FOR" (link_changed_before_dispatch). It compares against the binding a caller captured before its work was queued, and a caller that never captured one has nothing to compare — the parameter is wherelinkcomes from on that path, not a switch.Also asked unconditionally; re-gating is disqualified by measurement, and the widened refusal set is IN SCOPE for this change rather than a deferred rider. What is left is a SCOPE ruling from the repository owner, not a correctness question: keep it here, or split it into its own reviewed change. The behaviour is described in full below and pinned by tests either way. "Is the live binding still the one THIS SEND SELECTED" compares the post-resolve walk against
link, this send's own resolved destination, so every caller holds the comparand (link_changed_during_resolve) — and the per-chunk CONTINUATION re-ask asks the same of every later part. Earlier revisions gated both to keep an LLM-facing tool's mid-send contract out of a note change. That was a fail-OPEN, not a deferral: being inline bounds only the window before part 1, every transport send is an await, so a multi-part inline send spans the same window a dispatched one does and parts 2..N were reaching a conversation already unlinked. A mismatch is always a refusal, never a retarget.test_an_inline_send_refuses_when_the_binding_moves_during_resolveandtest_an_inline_send_stops_remaining_parts_when_unlinkedpin both.send_message's refusal set changed here, not in its own change. Stated plainly because it is the one cross-cutting effect of this PR: the inline/api/send-messageleg now refuses on a superseded governance ceiling, on a binding that moved during its resolve, and between parts once the destination is revoked. Each closes a hole where content reached a conversation the caller had not selected or was no longer permitted; none of them retarget, and none change a permitted send's outcome.No other generation consumer regresses.
governance_answer_generation's signature and contract are byte-identical to base (opaqueint, comparison-only). Its four consumers all use it as an equality comparand —ws.py:777(current != answer_generation, and that file is untouched by this change),state.py:7857(a cache-invalidation field),slack_egress.py:180, andgovernance_ceiling_unchanged(== observed) — so publishing one bump per publication instead of two can only reduce FALSE invalidations, never suppress a real one.test_a_publication_moves_the_generation_exactly_oncepins both directions: one publication moves it once, and a reload that publishes nothing does not move it at all.Tests
test/test_note_channel_mirror.py— 117 tests across both legs: delivery, the session-map fallback for a bare slot, paused mirrors, foreign namespaced channel ids refused at the Slack client, swallowed delivery failures, fail-closed governance degradation, non-proactive transports skipped, a Slack link declining to ride the ladder, origin-before-mirror ordering, both legs firing together, recipient authorization on the Slack leg with its SEL audit of every outcome, mid-send revocation aborting the remaining chunks on both legs, revocation timed inside the mid-send re-resolve await, the awaited mirror's overall bound, and the background dispatch not blocking the POST, the held-note case not reaching the channel at POST and reaching it at flush, and the two earliest Slack refusals — a disconnected thread and a foreign namespaced id — each emitting adeniedSEL row under its own reason code, with a third test asserting the two codes differ so the rows stay filterable. The endpoint tests share one draining helper that cancels and gathers the background mirror it dispatched, so no task outlives the test that spawned it; a dedicated test asserts that directly, because a leaked task otherwise only ever showed up as a stderr line while the suite still reported green. Two further tests cover recipient authorization across surfaces: a telegram-origin direct session linked to an authorized Slack channel must reach the tracked-channel authority rather than being refused by a principal check that cannot apply to it, with a Slack-origin counterpart asserting the principal path is still consulted so the surface gate cannot be too broad.No live channel is required. The Slack leg takes a stub client and the neutral leg drives a fake
MessagingTransportthrough the real send ladder, so the nine transports that are unreachable from many corporate networks are covered by the same assertions as Slack.Negative controls, run per round by neutralising each fix and observing the failure before restoring it. Latest: removing the post-await re-walk in the mid-send path makes the new test fail
assert 2 == 1— part 2 does reach the revoked conversation — and reverting the mirror to unbounded makes the bound test failTimeout >25.0s. Both detect their defect rather than passing vacuously.Local gate results:
check_black_formatting)src/kiro_crew test conftest.py xdist_budget.py)src/kiro_crew/)Affected suites run:
test_gateway_appkit_endpoints,test_cross_surface_mirror,test_channel_compaction_notice,test_channel_compact_failure_binding,test_chat_mirror,test_channel_transport_outbound_authz,test_messaging_transport,test_redaction_mirror_parity,test_slack_mirror_context_leak,test_ci_surface_tests.Echo-loop check
The mirror posts into a thread the gateway also listens on, so inbound must not ingest it as a user turn. Verified at two independent points:
slack/transport.pydropsbot_id/subtype == "bot_message"before authorization, andslack/events.pydoes the same with a SELuntrusted_botdenial. Telegram filters on its ownbot_id. The compaction notice already uses this exact egress.Not traced: the
from_trusted_botbranch inslack/events.py, which is a separate code path.Behaviour change beyond
/noteClosing the caller-supplied-link TOCTOU moved the ladder walk, the pause skip and the post-await revalidation into
handlers/messaging.deliver_to_channel, which is shared. MID-SEND REVALIDATION IS UNCONDITIONAL, and it widensapi_send_message's refusal set deliberately. An earlier revision keyed it onauthored_linkso the inline caller kept its exact prior behaviour; that was wrong, because being inline bounds only the window between the REQUEST and the FIRST part. Every part is an await, so a multi-part inline send spans the same inter-part window a dispatched one does, and its later parts reached a destination the user had already unlinked. The post-resolve re-walk (link_changed_during_resolve) and the per-chunk re-asks therefore run for EVERY caller. Whatauthored_linkstill gates is only the authored-link COMPARISON — "is the live binding the one this work was AUTHORED for" — which needs a captured link and so remains dispatch-only. Forapi_send_messagethis adds seven reason codes, not one: three that can refuse before the first part (a binding or governance ceiling replaced while the permit resolved) and four that fire only on a later part. A send the resolve permitted CAN now be refused before part 1, which the earlier wording denied.deliver_to_channelstill answers with a bool and LOGS which ladder row it selected rather than returning it, so its existing caller is unchanged.That is why
test/test_send_message_targeted.pyis in this diff:test_cron_job_session_key_is_used_verbatimassertedassert_called_once_withon the link getter, which encoded the old single-read behaviour. It now pinscall_args_listso every call is checked for the whole session key — the property that test is actually about — rather than only the first.Bounds and known asymmetries
The mirror is bounded per leg, not per request. Each delivery leg carries its own
_LEG_TIMEOUT_Sand absorbs its own stall or raise, so a wedged channel cannot starve a healthy sibling. That bound now lives entirely inside the mirror: the endpoint dispatches it in the background and never waits, so no outer ceiling exists or is needed. A channel that cannot be reached simply does not receive the note; the failure is logged and SEL-audited rather than reported to the caller.Held-note / rebind window — CLOSED. Two earlier revisions of this description got this wrong in opposite directions: the first claimed "a rebind cannot leave a channel showing a note the agent never receives", the second accepted that it could. Both are withdrawn. A held note is not mirrored at POST, so the window in which the channel held a note the transcript and context did not cannot arise; and it is no longer left unmirrored either, because the flush dispatches it once both halves land. A note whose slot was rebound to another session during the hold is dropped by the rebind guard before the write, and dispatches nothing.
Keying the mirror to the same flush-time condition is the better fix and is what ships.
flush_deferred_notesis a synchronous_ChatSlotmethod with no back-reference toDashboardState, so it cannot resolve destinations itself; the held record carries a bound dispatch instead, which is also why no call site changes spelling. It now has six invocation sites across three modules, one of them a teardown handing its key to a concurrent same-key recreate, where the halves do commit and the key stays open, so provenance there is wanted rather than suppressed.Accepted and deferred — declared, not carried silently
The hardened Slack send lives in its own module, and the note mirror runs it. The chain (governance gate → recipient authorization → coordinate and pause revalidation after every await → chunking → abort-on-revocation) is
_deliver_slack_governedin the newdashboard/slack_egress.py, besidechannel_egress_permittedand_slack_recipient_basis. It began insidechat_compaction_noticebecause that was its first consumer, which homed a cross-feature boundary in a feature-named module — the next caller either misses it or copies it, and a copied egress check stops being re-verified. The note mirror is its ONE consumer. The compaction notice deliberately stays on the barechannel_egress_permittedgate it imports fromslack_egress: adopting the full chain there would widen an existing surface's refusal set, which is a behaviour change to a surface this PR does not otherwise need to touch, so it is deferred alongside the three other proactive Slack sends_deliver_slack_governed's docstring names.test_a_recipient_no_authority_names_is_still_deliveredpins that unhardened posture, so adopting the chain later has to be a reviewed change rather than a silent rider. Slack is deliberately absent fromchannel_transports, so it never reaches_resolve_channel_target's ladder and gets none of that protection for free; this is where it lives instead, in one copy rather than two that drift.The tier map now has a named owner, not a promise. The three proactive-Slack tiers this change leaves in place (the full chain here, the gate-only compaction notice, and plain client for
api_send_message's Slack leg, the owner DM and the hook DM) are pinned by a census test that fails if a new dashboard module sends to Slack unclassified, or if the plain-client tier changes size. The deferred sites are enumerated by symbol indocs/system-specs/modules/messaging.md, alongside the tier map the census test pins executably, so the follow-up is a named inventory rather than a docstring sentence. That inventory deliberately stops at the INVENTORY: it names each deferred sibling and the profile-store cold load, and it prescribes no design for the consolidation. Two earlier revisions went further and both were subtracted at a reviewer's request -- a seven-step forward plan (including a binding-generation counter), because a design nobody is committed to build is speculation, and then the separate RFC document that carried it, because the only parts the census test and the spec actually lean on are the tier map and the symbol-named inventory, and those belong with the module they describe. Filing a tracking item is a maintainer action.The held-note pinning tests are mandatory, not advisory.
TestAHeldNoteMirrorsAtFlushandtest_a_rebound_slot_drops_the_held_note_without_mirroringboth live intest/test_note_channel_mirror.py, which carries zeroskip,skipiforxfailmarkers, and CI's backend job has no deselect list at all (its own comment records thatBACKEND_DESELECTSwas removed deliberately) and never names this file. Every backend shard therefore collects them and neither can be skipped on a runner.There are now TWO revalidation chains, and consolidating them is a declared follow-up rather than work this change withholds.
deliver_to_channelre-walks the transport ladder per chunk;_deliver_slack_governedre-asks_permitted_to_sendper chunk. What is genuinely shareable between them is only the per-chunk loop driver. What is NOT shareable is everything the loop guards: the authority sets differ (Slack sits outsidechannel_transportsand never reaches the ladder at all), the delivery-confirmation predicate differs, and the audit vocabulary differs.handlers/messaging.pydoes not importslack_egress, so the shared piece could not move between those two; it lives in the module both already import, assend_parts_revalidatinginkiro_crew/messaging/renderer.py. That per-chunk loop driver IS extracted here and both chains now run through it. What remains unshared is what the loop guards, which is the list above.Two consequences worth stating plainly:
_is_genuine_slack_link) demanded a thread and a channel, which is right for a note and wrong for a notice: a session bound to a channel with no thread posts top-level, and requiring a thread would have silently dropped its notices. What that check is actually for is refusing another channel's legacy namespaced id, which has nothing to do with threads — so the namespace half is shared and the thread half stays with the note leg as its own local precondition. Pinned by a test that fails when the thread requirement is reinstated.The note mirror passes a pause predicate;
is_pausedis a REQUIRED parameter of the shared send, so no adopter can omit the check by accident. The compaction notice does not call that helper at all, so the question does not arise for it.api_send_message's failure surface IS widened, and that is intended. The shareddeliver_to_channelgained a post-await re-walk and a per-chunk re-ask, and NEITHER is gated: both run for every caller, so the mid-send TOCTOU is closed forapi_send_messagetoo rather than left open. The widening is EIGHT new reason codes, six refusals and two errors, none gated onauthored_linkand so all reachable by the inline caller. Three can refuse before the first part goes out at all (link_changed_during_resolve,link_changed_during_recheck_before_part_1,governance_changed_before_part_1); the other four fire only on a part after the first (not_permitted_mid_send_before_part_N,link_changed_during_recheck_before_part_N,governance_changed_mid_send_before_part_N, and the errorresolve_failed_mid_send_before_part_N). An earlier revision of this description claimed one refusal and claimed nothing permitted at part 1 could be refused; the governance-ceiling sampling added later made both false, and they are corrected here rather than left to read as the smaller change. Exactly one refusal stays dispatched-only, and not by choice:link_changed_before_dispatchcompares against the binding a caller CAPTURED before its work was queued, so a caller that captured none has no comparand. The note mirror is dispatched to a background task and can be overtaken by a rebind, which is why it captures one.test_revalidation_covers_both_callers_and_authored_link_gates_comparisonpins the split by measuring ladder walks on both paths. Named plainly: this is a tightening of a surface this change is not otherwise about. The note mirror is the feature;api_send_messageinherits the closure because the helper both callers share is where the TOCTOU lives, and gating it to the mirror alone would leave the same hole open for the LLM-facing caller.Seven resolve-then-send siblings remain unfixed, named explicitly. The post-await revalidation now covers the shared
deliver_to_channeland, via_deliver_slack_governed, the note mirror's Slack leg. These seven sites across five symbols still send on a link captured before their governance await, with no re-walk (api_chat_slot_mirror_linkcarries three of them):state.py_notify_inbound_unbindchat_mirror.pyapi_chat_slot_mirror_linkchat_mirror.pyapi_chat_slot_mirror_linkchat_mirror.pyapi_chat_slot_mirror_linkslack/gateway.py_deliver_channel_replyhandlers/messaging.py_deliver_channel_dmapi_send_message's Slack legEach was re-verified by SYMBOL at the current tree, not inferred: line citations from the original base had drifted, and one (
state.py) pointed at a function that performs no send. Fixing them is a general change across four more modules and belongs in its own PR; naming them here so the gap is not mistaken for coverage, and so whoever takes it has the inventory.Out of scope
A note's transcript row can be replayed into a new session on a cold start (
is_new and not _provider_has_history), so the model may see it twice in one prompt. That is pre-existing, documented in the endpoint's own docstring, and a deliberate tradeoff — the replay is char-budget bounded, so dropping the queued copy would lose older notes the replay had already trimmed. This change adds no transcript row and neither causes nor worsens it.