Repository navigation
fix(channels): guard every delivery path the enumeration derives - #14029
chenmingwei23 wants to merge 1 commit into
Conversation
Three paths that grade a delivered sequence read a subject narrower than the answer, and the enumeration enforcing the guard was a hand-written list, so the paths most likely to be missed were invisible to it. WeCom re-counted a remainder starting at the rotation offset and assigned the result, dropping every placeholder already delivered; the count is an addition measured against that remainder. Slack's no-stream fallback recorded only chunk 0 in the ledger the notice counts, so an over-limit answer announced fewer placeholders than it shipped; every confirmed continuation is recorded. Telegram's table-aware cut re-split a repaired body with the prose splitter, which knows neither the table blocks nor the rich budget and cut the table run mid-body; the repair re-enters the assembly that graded it. The population is derived by walking every module that calls a splitter accepting a redactor, with an exception map whose entries state the property making them true and fail when it stops holding. The walk finds three delivery paths with no redactor: Discord's rotation and seal, Feishu's reply split, and the shared transport chunker, whose units every caller sends as its own message. Discord also gains the sealed-predecessor record at its one seal sink and at its live frame, so all five of its sealing paths inherit it. The byte unit is guarded by grading the sequence the byte splitter produced, because that splitter reaches its budget by shrinking a character limit and retrying, which a cut free to decline would not terminate on. The shared splitter drops its `stable` mode: one streaming caller selects it and the branch is two calls that caller's own renderer already makes. The module spec is corrected to match and states the credential-aware cutting contract. Refs #13743
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing to check. Suggestions
[DESIGN-REVIEWED] 04fed51 |
First Principles Review (Fable 5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS The module-keyed What this change shipsInventory (10 items) — 10 justifiedIntent: make every multi-message delivery path cut and count credential-aware, and make that enforcement derived rather than hand-listed — a FIX.
Notes a human may want: the reversal of the old "Enumerated rather than discovered" pin carries its own evidence (three unguarded paths the list missed, all closed here); both exception claims were verified against the code (teams/session_resume.py:346 keeps [FIRST-PRINCIPLES-REVIEWED] 04fed51 |
GPT 5.6 Review — 🔴 changes requested (blocking)GPT 5.6 found at least one blocking issue that must be resolved before merging This comment is updated in place on each push. BLOCKING -- src/kiro_crew/discord/renderer.py:1309 -- upload recovery bypasses the new seam repair FINDING -- src/kiro_crew/wecom/renderer.py:324 -- using display-redacted [BLOCK-MERGE] 04fed51 Adjudication (Opus 5) — is blocking on each finding proportionate?UNBOUNDED (credential exposure across adjacent messages) — the harm class this PR exists to close. False positive or not applicable? A repository writer can comment: |
Opus 5 Review — ✅ no blocking findingsReviewed Review detailsThree ungraded or mis-subjected seams in the new credential-boundary machinery — none blocking. FINDING — src/kiro_crew/messaging/renderer.py:184 — FINDING — src/kiro_crew/wecom/renderer.py:324 — FINDING — src/kiro_crew/discord/renderer.py:1321 — the multipart-recovery sink calls [OPUS-REVIEWED] 04fed51 Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
What is the problem?
Three of the delivery paths that grade a delivered sequence read a subject narrower than the answer, so the redaction notice under-counts what shipped, and one repair leaves a table run cut mid-body.
wecom/renderer.pyre-countsremainder = answer[self._carried:]and assigns the result. After a bubble rotation that subject starts past everything already delivered, so a placeholder in an earlier bubble drops out of the notice.slack/renderer.py's no-stream fallback writes the delivery ledger forchunks[0]only, while the continuation posts record nothing. The notice counts that ledger, so an over-limit answer announces fewer placeholders than it shipped.telegram/renderer.py's table-aware cut hands a repaired body to the prose splitter, which knows neither the table blocks nor the rich budget. The table run is re-cut against the wrong budget and its rows strand as literal pipes.Separately, the enforcement that every path delivering one chunk as one message passes a redactor was a hand-written list of seven modules. A path nobody adds to such a list is not merely unchecked, it is invisible, and the paths most likely to be forgotten are the new ones. Walking the tree finds three delivery paths outside that list with no redactor at all: Discord's rotation and seal, Feishu's reply split, and the shared transport chunker every channel-neutral sink calls.
The module spec also states something the code contradicts: that the splitter is "stdlib-only and pure -- no config objects, no modes".
Why this issue matters to the user
The redaction notice is how a user learns a credential was removed from the reply they just read. A tally that drops the placeholders already on screen tells them nothing was redacted when something was, so they do not know to rotate the key.
On the three unguarded paths the consequence is the one this work exists to close. A key written across a line break matches nothing as written, so every per-message scan passes it; the cut then removes that break and the reader scrolling two messages reads the key whole while neither message holds it. Both messages are already delivered, so there is no recovery. Discord and Feishu are ordinary answer-delivery paths, and the shared chunker carries the dashboard's channel-addressed sends and the Slack mirror.
A stranded table row is a smaller harm: the answer is complete but reads as literal pipes.
How our fix solves it
Each tally counts what it can see, and the count is an addition rather than a replacement:
repaired_for_deliveryanswers only with text that reads clean even with every whitespace run removed.The enumeration is derived instead of listed.
_modules_that_split()walks every module undersrc/kiro_crewthat calls a splitter accepting aredactor, and each call must pass one. Two calls are excepted, and each entry states the property that makes it true rather than an intention: the Teams replay preview keepschunks[0]and discards the rest, so no second message exists to rejoin across; WhatsApp's prefix-stable branch cuts an already-redacted body at its own budget and nowhere else, because searching for a safer budget would move a boundary under a message already sent. A staleness test fails when either claim stops holding, so an exception cannot outlive its reason, and a walk that returns a subset of the tree fails against the channels it must reach.That walk's three findings are closed rather than deferred:
bounded_for_deliverywith its own last-resort cutter, and gains one grader and one writer for the sealed predecessor. The grade runs at the seal sink and at the live frame; the record is written only where a send or edit confirms, because recording unsent text would cost the next delivered message a leading span for a key nobody read.chunk_for_transportguards both units. The character path passes the redactor; the byte path grades the sequencesplit_markdown_bytesproduced, using the byte cutter it measured in, because that splitter reaches its budget by shrinking a character limit and retrying and a cut free to decline would not terminate on it.The shared splitter drops its
stablemode. One streaming caller selected it, and the branch is two calls that caller's own renderer already makes, so the contract now lives with the caller that needs it and the pure primitive carries no mode. The spec sentence is corrected to match, and the credential-aware cutting contract is written down beside the others.What tests we did
Every run scoped with an explicit
-n0.test/test_split_credential_boundary.py: 154 passed, 5 skipped.docs_lint.pyclean; mypy oversrc/kiro_crew/reports 4 errors intranscribe.pyandops_mission_control/backend/providers/cloudwatch.py, neither touched here.Any other suggestions on the work
The content-revision half of the streaming case stays open and is not addressed here: a sealed message can render differently once a later frame arrives, which a delivered-chunk count cannot observe. Closing it needs grading against what is already on screen, which is #13494's subject. The disclosure half -- a sealed credential prefix completed by text arriving afterwards -- is closed on every path this touches.
Predecessor: #13984, merged. This carries only the work that followed it.
Refs #13743