Skip to content

fix(wecom): choose a streaming cut the reader cannot rejoin into a credential - #12198

Merged
bolichen97 merged 1 commit into
mainfrom
fix/wecom-stream-redaction-11727
Sep 22, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
fix/wecom-stream-redaction-11727

Conversation

@chenmingwei23

@chenmingwei23 chenmingwei23 commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

What is the problem?

WeComRenderer streams an answer in capped bubbles. The cap is applied to the RAW answer
text, but the reader sees the CANONICAL rendering of each bubble. So a credential the model
split with markup is severed by the cap without anything noticing:

bubble 1 tail: ... [AKIA](https://ex.test/a,b)
bubble 2 head: IOSFODNN7EXAMPLE ...

canonicalize_display collapses [label](target) to label, so the reader sees
AKIAIOSFODNN7EXAMPLE spanning the two bubbles. Each bubble is scrubbed on its own and
neither half matches a credential pattern, so the per-message redaction is blind to it.

Why this issue matters to the user

The user is shown a live credential. Not in a log, not in a debug path: in the answer, on
screen, in their own chat. A bubble rotation is irreversible -- a sealed bubble can never be
rewritten -- so there is no in-frame recovery once the two halves are up.

How our fix solves it

The symptom is a key on screen. The immediate cause is that the two bubbles' contents are
adjacent to the reader but separate to the scrubber. The root cause is WHERE the cut falls:
it is chosen in raw coordinates, with no reference to what the pieces will look like once
rendered.

So the cut is chosen against the rendered form. _push replaces its blind slice with
safe_split_offset(body, room, _default_redactor), which returns the largest sampled offset
at or below the budget that severs no credential. Nothing after that offset has been
delivered, so the next frame of the bubble carries the remainder and the answer is not
truncated.

safe_split_offset rests on joins_to_a_credential, which asks the question directly rather
than guessing which characters could hide a split. That distinction is the whole reason the
earlier attempt at this failed: #11196 carried a ~360-line engine whose straddle predicate was
sound but whose search WINDOW was found by walking backwards over a hand-written character
class. Whenever canonicalisation can join text across a character the class does not contain,
the walk stops early, the window excludes the credential's prefix, and the predicate passes
vacuously. There is no character class, no window and no anchor list anywhere in this guard.

The oracle reads the pair BOTH ways, because neither reading contains the other:

  • canonicalising the CONCATENATION models a copy of both messages and a client lenient about
    where one ends. It is wider for a run of delimiters, which concatenation can only extend:
    AKIA** beside **REST is a run only once the halves sit together.
  • canonicalising EACH SIDE then joining models the screen: two messages rendered separately,
    read one after the other. This is wider wherever canonicalising DROPS text, which is what a
    link does to its target. A cut one character inside [l](https://x/AKIA + REST) completes
    the link only in the concatenation, where the url collapses to the label and the key vanishes
    from the scan -- while on screen each half is an unfinished link whose url stays visible.

Soundness: redact_for_display already emits the canonical form whenever canonicalising
reveals something the literal form hid, so redacting and then canonicalising is a fixed point
for any single string. Whatever the scan finds is therefore produced by putting the two sides
together and by nothing else.

What tests we did

test/test_display_split_safety.py (new) pins the two primitives on their own.
TestTheCapCutsWhereTheReaderCannotRejoin in test/test_wecom_renderer.py drives the renderer
end to end and asserts against the reader's RENDERED view, scanned with the same redaction pair
the renderer sends through.

The reader model asserts EVERY instant the screen passed through, not just the final state: a
stream frame replaces its own bubble, so a frame that puts a credential on screen has been read
by the time a later frame supersedes it.

The straddling shapes live in one shared table (conftest.CREDENTIAL_STRADDLE_SHAPES) so the
primitive and the renderer cannot drift apart on what they cover: a comma inside a link target,
whitespace in an authorization header, underscore and tilde emphasis, URL-terminating
punctuation, a cut inside a link's URL, a PEM anchor split mid-word, the same anchor split by
emphasis, and a cut through a key carrying no markup at all. Each row asserts its own premise
first -- neither half is a credential alone -- so a fixture that stops straddling fails loudly
instead of passing on a case it does not cover.

Mutation-verified. Restoring the blind cut (body[:room]) reddens TEN tests, every one of them
in the new renderer class and every one with "a credential reached the reader". The allow
direction stays green throughout: an answer within the cap is sent unchanged, which is the case
that says the guard is conditional rather than refusing every boundary.

166 tests pass across the three touched test files. black, isort, flake8, mypy, docs lint and
the comment-history gate are clean.

Pattern harvest

Rule candidate: semgrep
Pattern: a credential or redaction scan whose search window is bounded by a hand-written
character class, typically a backwards walk that stops at the first character outside the
set, when the text will be transformed after the scan

A scan that has to anticipate a later transformation cannot be scoped by a character
class.
This is the generalisable shape, and it is why the earlier attempt at the same bug
failed. The predicate was right; the WINDOW it ran in was found by walking over a
hand-written set of characters, and such a set can never be closed -- the next character it
does not know about is one more place a split can hide. The walk stops early, the check runs
on a span the credential was never inside, and it passes vacuously. Anywhere a scan happens
before a transformation (markup rendering, canonicalisation, unicode folding, a client's own
prettifier), ask the transformation what it produces and scan THAT, rather than enumerating
the characters you think it can cross.

When two readings of the same data both exist, neither may be assumed to contain the
other.
Canonicalising a concatenation and concatenating two canonicalised pieces give
different answers, and which one is wider depends on whether the transformation EXTENDS text
(a delimiter run) or DROPS it (a link target). Checking either alone leaves a real case
unscanned. One test per reading pins that neither covers the other.

A fixed point is what makes a two-sided check sound. redact_for_display already emits
the canonical form whenever canonicalising reveals what the literal form hid, so redacting
and then canonicalising is idempotent for any single string. Without that property, a
finding from the joined scan could have come from one side alone and the check would not be
attributing it correctly. It is pinned on its own rather than assumed
(TestRedactionIsAFixedPoint).

Scope discipline: a boundary whose other side can still be edited is a different problem
from one that is frozen.
Both look like "a credential spans a cut". The first is closed by
choosing the cut; the second needs a model of what the reader currently has, which turned out
to need four review rounds of its own and is now #12683. Shipping them together hid that they
were two problems.

Any other suggestions on the work

This PR was descoped deliberately, and the rest is tracked rather than dropped. An earlier
revision of this branch also re-decided the seam at a BUBBLE ROTATION, which is a different
problem: the sealed bubble cannot be rewritten, the platform never reports that a frame was
accepted, and the graded screen therefore has two possible edges at once. Four consecutive
review rounds each found a real defect in that half, each one in the state model rather than in
a line, so it is taken out of this PR and filed as #12683. The cap cut is what this
issue asks for, it has been stable across every round, and it stands alone.

What is left is deliberately small, so a reviewer can hold all of it at once: one behaviour change
in _push, two functions in display_safety.py with no deletions from that module, one spec
section, and the tests. Six files, 538 insertions, 9 deletions.

One residual worth naming for whoever picks that up: the rotation seam's correctness rests on
WeCom's ACK semantics, specifically that an accepted frame is not acknowledged in a way that can
be attributed to a frame. That claim is sourced from the code (send_stream has no per-frame
ACK wait because every frame replays the one inbound req_id, and the ACK handler's own comment
says an accepted frame is not documented to be acknowledged), but a maintainer who knows the
protocol should confirm it before that half ships.

Closes #11727

@chenmingwei23
chenmingwei23 requested review from a team and patrigao September 20, 2026 05:10
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 20, 2026
@github-actions

github-actions Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — ✅ PASS

Design-level review of b9a2ffcbe47e68db68ef7467fc0c5ece7a5e8ac1 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Verify no other capped streaming renderer (Slack, Feishu, WhatsApp) shares the blind raw-cut pattern — the primitive is general but wired into WeCom only.

[DESIGN-REVIEWED] b9a2ffc

@github-actions

github-actions Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — ✅ PASS

Premise-level review of b9a2ffcbe47e68db68ef7467fc0c5ece7a5e8ac1 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: PASS

Verify no other streaming renderer cuts raw text before per-slice scrubbing — the fix lands only in WeCom's _push; Slack/Telegram/Discord stream paths were not traced here.

What this change ships

Inventory (5 items) — 5 justified

Intent: FIX — stop WeCom's streaming cap from severing a credential across two bubbles the reader's client rejoins on screen (issue #11727; the gap was already documented as a known residual in the base _render_slice docstring).

  1. A WeCom streaming frame now cuts where the rendered halves cannot rejoin into a credential — justified
  2. A capped frame may deliver fewer characters than the cap, or none, deferring the rest to the next frame — justified
  3. New shared helpers safe_split_offset / joins_to_a_credential in messaging/display_safety.py — justified
  4. Spec section added to docs/system-specs/modules/messaging.md in the same commit — justified
  5. Shared straddle-shape fixture table plus two test suites pinning primitive and renderer — justified

[FIRST-PRINCIPLES-REVIEWED] b9a2ffc

@github-actions

github-actions Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings

GPT 5.6 completed its review of b9a2ffcbe47e68db68ef7467fc0c5ece7a5e8ac1 and found no blocking issues.

This comment is updated in place on each push.

Review details

FINDING -- src/kiro_crew/wecom/renderer.py:663 -- “the next frame of this bubble carries the remainder” contradicts _push, which re-caps from _carried; overflow waits for rotation/finalization -> Fix: correct this comment and the matching spec wording.
[GPT-REVIEWED] b9a2ffc

False positive or not applicable? A repository writer can comment:
/ai-review override gpt b9a2ffcbe47e68db68ef7467fc0c5ece7a5e8ac1: <one-sentence reason>

@github-actions

github-actions Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Opus 4.8 Review — ✅ no blocking findings

Reviewed b9a2ffcbe47e68db68ef7467fc0c5ece7a5e8ac1 — this comment is updated in place on each push.

Review details

No findings.

Both candidates are performance/UX observations below the survival bar, not concrete defects.

Candidate 1 (full-remainder scan per frame) describes correct output at possibly higher cost: _default_redactor is a linear-time matcher, scanning the whole tail yields the correct answer (a credential wholly inside the tail is redacted by the tail's own pass and correctly not re-flagged), and the candidate's own evidence concedes the latency impact is "unverified." No observable wrong outcome — (c) resolves to "could block the loop," which the falsification bar rejects.

Candidate 2 (backoff returns 0 → footer replaces shown text) is self-rated low confidence and is transient by its own account: returning 0 sets body="", on_done re-delivers the full remainder from self._carried (never advanced while 0 was returned), so no content is lost — only a possible momentary flicker, contingent on footer presence and exact offset arithmetic. Not a crash, data loss, or reachable security hole.

No un-inherited defect met the (a)/(b)/(c) bar at 80+ under my own re-derivation: the cap is only strengthened (no guard removed), room=0 degrades to the prior behavior, and the boundary the oracle checks (delivered head vs undelivered tail) is exactly the inter-bubble seam.

[OPUS-REVIEWED] b9a2ffc

Verdict parsed from the review's SHA-scoped output markers for commit b9a2ffcbe47e68db68ef7467fc0c5ece7a5e8ac1.

False positive or not applicable? A repository writer can comment:
/ai-review override fable b9a2ffcbe47e68db68ef7467fc0c5ece7a5e8ac1: <one-sentence reason>

@chenmingwei23
chenmingwei23 force-pushed the fix/wecom-stream-redaction-11727 branch from 1feac70 to 5cb38a1 Compare September 20, 2026 06:16
@github-actions

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ⚠️ review incomplete

GPT 5.6 did not produce a complete verdict for 5cb38a14ee84fef7c29841dff44bf90f4755e862; inspect the workflow logs and re-run it.

This comment is updated in place on each push.

See the GPT 5.6 Review job logs; this commit has no completed GPT verdict.

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 5cb38a14ee84fef7c29841dff44bf90f4755e862: <one-sentence reason>

1 similar comment
@github-actions

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ⚠️ review incomplete

GPT 5.6 did not produce a complete verdict for 5cb38a14ee84fef7c29841dff44bf90f4755e862; inspect the workflow logs and re-run it.

This comment is updated in place on each push.

See the GPT 5.6 Review job logs; this commit has no completed GPT verdict.

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 5cb38a14ee84fef7c29841dff44bf90f4755e862: <one-sentence reason>

@chenmingwei23
chenmingwei23 force-pushed the fix/wecom-stream-redaction-11727 branch from 5cb38a1 to d41a8c7 Compare September 20, 2026 08:57
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 20, 2026
@chenmingwei23
chenmingwei23 force-pushed the fix/wecom-stream-redaction-11727 branch from d41a8c7 to 0f92ff3 Compare September 20, 2026 09:42
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 20, 2026
@chenmingwei23
chenmingwei23 force-pushed the fix/wecom-stream-redaction-11727 branch from 0f92ff3 to 811a004 Compare September 20, 2026 10:07
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 20, 2026
@chenmingwei23
chenmingwei23 force-pushed the fix/wecom-stream-redaction-11727 branch from 811a004 to 983ec52 Compare September 20, 2026 10:40
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 20, 2026
@github-actions github-actions Bot added the readiness: action required A blocking check or review needs attention label Sep 21, 2026
@chenmingwei23
chenmingwei23 force-pushed the fix/wecom-stream-redaction-11727 branch from d426b89 to 7dc02a2 Compare September 21, 2026 17:12
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 21, 2026
@chenmingwei23
chenmingwei23 force-pushed the fix/wecom-stream-redaction-11727 branch from 7dc02a2 to 1d07708 Compare September 21, 2026 17:42
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 21, 2026
@chenmingwei23
chenmingwei23 force-pushed the fix/wecom-stream-redaction-11727 branch from 1d07708 to 7f93c2d Compare September 21, 2026 18:07
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 21, 2026
@chenmingwei23
chenmingwei23 force-pushed the fix/wecom-stream-redaction-11727 branch from 7f93c2d to 234f05e Compare September 21, 2026 18:39
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Rebuttal: the footer-erasure finding names a state this renderer cannot reach

Re the blocking finding on src/kiro_crew/wecom/renderer.py:914, "footer-only frame erases
delivered answer without rewinding progress", on head
e5df6b69a3b39019ed426cc36914947fa24d21d8.

The finding's premise is sound about the frame model: a WeCom stream frame replaces the
whole bubble, so a frame carrying no answer text would indeed erase answer text the bubble
is showing, and progress is not rewound when the answer slice is empty. If that state were
reachable, the consequence would be exactly what the finding says.

I implemented the suggested fix -- skip sending the footer-only replacement when the answer
slice is withheld -- and then wrote a test for it. The test fails with the fix in place,
because the state it needs cannot be constructed. That failure is the evidence below, and it
is why this is a rebuttal rather than a patch.

Why the state is unreachable

Three facts have to hold at once, and the second and third exclude each other.

  1. The same bubble must have DELIVERED answer bytes, or there is nothing on screen to
    erase.
  2. The seam must THEN withhold, which is what empties the answer slice.
  3. Withholding requires that no sampled resume offset breaks the join with the frozen head,
    and the search steps back through offsets before giving up.

Point 3 is the constraint. For every offset to fail, the answer has to begin with the
credential's second piece, so that the frozen head's trailing piece is adjacent to it at
every candidate. As soon as any other answer text precedes that piece, the search steps
back to an offset where the frozen head is followed by that other text instead, the join
reads clean, and an ordinary frame goes out carrying the answer.

That is what my fixture hit. Prose delivered first (satisfying 1), then the straddling tail
arrives, and the seam simply moves back rather than withholding -- so the footer-only frame
is never composed.

The remaining route would be for the frozen head to GROW after the delivery, making a
previously clean join readable. The head only grows when a rotation folds delivered
reasoning into it, and a rotation opens a fresh bubble in which nothing has been shown yet.
A frame carrying no answer text there erases nothing.

Disposition

Rebutted as unreachable on this head, with the failing test as the evidence rather than an
argument alone. No code change: adding a guard whose trigger cannot be reached would be an
unpinnable branch, and this PR has been explicit about not carrying those.

Two notes for the record. The frame model the finding describes is real, so if a later
change lets the frozen head grow mid-bubble, this becomes reachable and the suggested fix is
the right one -- that dependency is now written down. And the rotation-seam work in this PR
has produced several findings in this one span; the sibling rotations in other channel
renderers are tracked separately in #12293.

@github-actions

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ⚠️ review incomplete

GPT 5.6 did not produce a complete verdict for 9beead16765969bdb3e5d4389ec51a581250c066; inspect the workflow logs and re-run it.

This comment is updated in place on each push.

See the GPT 5.6 Review job logs; this commit has no completed GPT verdict.

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 9beead16765969bdb3e5d4389ec51a581250c066: <one-sentence reason>

1 similar comment
@github-actions

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ⚠️ review incomplete

GPT 5.6 did not produce a complete verdict for 9beead16765969bdb3e5d4389ec51a581250c066; inspect the workflow logs and re-run it.

This comment is updated in place on each push.

See the GPT 5.6 Review job logs; this commit has no completed GPT verdict.

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 9beead16765969bdb3e5d4389ec51a581250c066: <one-sentence reason>

@github-actions

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — 🔴 changes requested (blocking)

GPT 5.6 found at least one blocking issue that must be resolved before merging 12df22d6f0c0e6c72a445b62ae716534ce8d9bcc. 1 of 1 blocking finding(s) are security-class and were withheld from adjudication, so the blocking verdict stands.

This comment is updated in place on each push.

BLOCKING -- src/kiro_crew/wecom/renderer.py:696 -- Replaced reasoning remains in the frozen screen
self._frozen_reasoning += self._sent_reasoning
Reasoning prefix -> two delivered answer frames -> age rotation -> terminal reseam inserts a false redaction marker and repeats the answer.
Anchor: residual/crash-data-loss-corruption
Fix: Fold reasoning only when _prev_sent_abs <= _carried; always clear _sent_reasoning.
[BLOCK-MERGE] 12df22d
[GPT-REVIEWED] 12df22d

Adjudication (Opus 4.8) — is blocking on each finding proportionate?

The adjudicable input block is empty (0 findings). One fenced finding, F1, requires a ruling.

F1 — renderer.py:696, unconditional self._frozen_reasoning += self._sent_reasoning in _roll_if_sealed.

Conditions I confirmed on disk:

  • _sent_reasoning is populated on an accepted reasoning frame (line 957) and only cleared at line 697 or overwritten at 957 — so once answer frames flow it is never re-cleared, leaving a stale value at rotation.
  • Age rotation fires at lines 641–642; the fold at 696 then treats reasoning that answer frames have already displaced off-screen as still-frozen head.
  • _reseam grades frozen = _frozen_reasoning + answer[:_frozen_end] (line 779) and, on the terminal branch, can set _carried = 0 + insert the breaker marker (lines 862–863) — the "false marker + repeat" the finding names.

The code (comments 686–695) deliberately chooses the unconditional fold, arguing over-grading is "the safe direction." That makes the realistic consequence a bounded, visible, self-correcting over-redaction rather than a leak or hole — which would favor accepting residual risk. But the condition combination (reasoning → delivered answer → age rotation with a credential-like reasoning tail joining the answer head) is not extreme: a long agentic turn plus content the LLM can produce is plausible, so I cannot complete the extreme-rarity record FLAG requires. When torn on a fenced/unbounded-anchored finding, the contract is UPHOLD-FENCED.

[ADJUDICATION] 12df22d6f0c0e6c72a445b62ae716534ce8d9bcc total=0 uphold=0 downgrade=0
[GPT-ADJUDICATED] 12df22d6f0c0e6c72a445b62ae716534ce8d9bcc
[ADJUDICATION-FENCED] 12df22d6f0c0e6c72a445b62ae716534ce8d9bcc fenced=1 flagged=0
UPHOLD-FENCED F1 src/kiro_crew/wecom/renderer.py:696 -- Stale off-screen reasoning folded into the frozen head is reachable in an ordinary long turn with credential-shaped reasoning text, so the extreme-rarity record a FLAG needs cannot be completed.
[GPT-ADJUDICATED-FENCED] 12df22d6f0c0e6c72a445b62ae716534ce8d9bcc

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 12df22d6f0c0e6c72a445b62ae716534ce8d9bcc: <one-sentence reason>

@chenmingwei23

Copy link
Copy Markdown
Contributor Author
  • WeCom stream ACK semantics, cited from the pre-existing protocol reading span=624b23d8b52d

The item offers two clearance routes: cite the ACK semantics showing an accepted frame
returns no acknowledgement, or point at an acceptance signal the resume consults. The
second route does not exist, and the first is already in the codebase rather than asserted
by this PR.

  1. WeComClient.send_stream states the contract of its own return value in its docstring:
    True means the frame "reached the socket -- NOT that WeCom accepted it. Acceptance
    arrives later on a cmd-less ACK frame."
  2. The ACK handler states the limit of that later frame directly. On the zero-errcode path
    its comment reads "WeCom is not documented to acknowledge an accepted frame, so this
    cannot be relied on alone." That line is on origin/main today, at client.py:777
    there, so it is the repository's pre-existing reading of the protocol and not a premise
    introduced to justify this change.
  3. Structurally the handler only ACTS on errcode not in (0, None): a refusal is
    classified terminal or non-terminal and recorded by _mark_stream_dead or
    _mark_stream_rejected. No path records an acceptance. And _track_stream RETIRES a
    recorded rejection when the next frame goes out, so stream_had_rejection means "the
    latest verdict is a refusal", not "everything written here was accepted".

A frame therefore has three states, refused, accepted, and no answer yet, and the protocol
offers no way to observe the second. False from stream_had_rejection is the third state.
That is why the aged resume cannot consult an acceptance signal: there is none to consult,
which is what the inverted assertion records.

The cost of this reading is one frame's worth of text appearing twice at a rotation, which
is the price the sealed path already paid for the same reason. If WeCom later documents a
positive acknowledgement, the resume should consult it and the replay can be dropped.

@github-actions

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — 🔴 changes requested (blocking)

GPT 5.6 found at least one blocking issue that must be resolved before merging 4449dad07c97f33ddac82aefc72403fcd87be340. 1 of 1 blocking finding(s) are security-class and were withheld from adjudication, so the blocking verdict stands.

This comment is updated in place on each push.

BLOCKING -- src/kiro_crew/wecom/renderer.py:730 -- Max-only edges discard an intermediate visible screen
self._frozen_end = max(...) / self._frozen_end_confirmed = max(...)
Aged rotation at edge E2 -> refused replacement reaching E3 -> E2 is omitted from seam grading -> a credential prefix at E2 joins the replay from E1 and reaches WeCom.
Anchor: backend-security-controls
Fix: Preserve and grade every still-plausible visible edge across rotations, not only the minimum and maximum.

[BLOCK-MERGE] 4449dad
[GPT-REVIEWED] 4449dad

Adjudication (Opus 4.8) — is blocking on each finding proportionate?

This is the empty adjudicable block plus one fenced finding F1. I've opened the code F1 names (renderer.py:730) and traced the surrounding rotation/seam logic.

F1 concerns _frozen_end = max(...) / _frozen_end_confirmed = max(...) collapsing to two monotonic scalars. The code explicitly keeps two heads (possible + confirmed) precisely because "a join is read against a head's TAIL and the further head buries this tail in its middle" (renderer.py:839-845, 731-735). F1's claim is that across successive rotations a third, intermediate visible edge E2 can exist whose tail is buried inside answer[:_frozen_end] and therefore ungraded as a tail — the exact hazard the two-head design was built to defend against, extended to a third edge.

Harm class is credential text reaching WeCom — unbounded. To FLAG I would need to prove from the code that a distinct intermediate buried tail cannot arise across two rotations, i.e. that two tracked edges always suffice. I cannot complete that rarity argument: the two-head design shows the author tracked exactly two edges, and whether a third is reachable across chained rotations is the open question F1 raises, not one the code visibly forecloses. An incomplete rarity record on an unbounded-harm fenced finding is UPHOLD-FENCED, and when torn the contract says UPHOLD-FENCED.

[ADJUDICATION] 4449dad total=0 uphold=0 downgrade=0
[GPT-ADJUDICATED] 4449dad

[ADJUDICATION-FENCED] 4449dad fenced=1 flagged=0
UPHOLD-FENCED F1 src/kiro_crew/wecom/renderer.py:730 -- The two-head design explicitly exists to grade buried tails, and I cannot prove from the code that two tracked edges suffice across chained rotations, so a third intermediate edge E2 supplying a credential prefix to WeCom stays plausible.
[GPT-ADJUDICATED-FENCED] 4449dad

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 4449dad07c97f33ddac82aefc72403fcd87be340: <one-sentence reason>

@chenmingwei23

Copy link
Copy Markdown
Contributor Author
  • ACK semantics: all the code-side evidence there is, plus a trade only a maintainer can accept span=3f7bd6576373

This item now clears on two things a maintainer does: confirm the ACK semantics against WeCom's
protocol docs or the #5105 cross-check sources, and explicitly accept the one-frame-repeat
trade. Neither is available to an agent, so this is recorded as a disclosed residual rather
than claimed as answered. What the code side can supply is supplied, and it is this.

The unobservability is TWO facts in WeComClient, and they are easy to read as a
contradiction of each other:

  1. an ACK frame does exist. send_stream's docstring says acceptance "arrives later on a
    cmd-less ACK frame". So the claim is not that the channel is absent.
  2. it is not ATTRIBUTABLE to a frame. Every frame of a turn replays the one inbound req_id,
    which is the only correlation key an ACK carries, so a waiter for one frame can be resolved
    by another frame's ACK. That is why send_stream deliberately has no per-frame ACK wait,
    and the docstring says so in the same paragraph.
  3. and a zero-errcode ACK is not promised at all. The ACK handler's own comment reads "WeCom is
    not documented to acknowledge an accepted frame, so this cannot be relied on alone". That
    line is on origin/main today, so it is the repository's pre-existing reading of the
    protocol rather than a premise introduced here.

Neither fact alone settles it. Together they leave no observation that separates "accepted"
from "no answer yet", which is what the flipped assertion records. Both are now stated in the
renderer comment and in the messaging spec, so a later reader meets the reconciliation rather
than the apparent contradiction.

The trade, stated plainly so acceptance is a decision and not an inference. Cost: at a rotation
the continuation replays the newest frame, so one frame's worth of text can appear twice on a
long turn. Benefit: the alternative is resuming past a frame whose fate is unknown, which drops
that text silently while the turn's stored history keeps it. The sealed path already pays this
same price for the same reason.

What a maintainer is being asked to decide, concretely: whether that repeat is acceptable
given WeCom's real ACK behaviour. If per-frame acceptance turns out to be correlatable after
all, the resume should consult it and the replay can be dropped; the two offsets and the
grading would stay as they are.

The bubble cap was applied to the raw answer while the reader sees the
canonical rendering of each bubble, so a credential the model split with
markup could be severed by it: each bubble was scrubbed alone and matched
nothing, and the client rendered the markup away and joined the halves on
screen. A bubble rotation is irreversible, so there was no recovery.

The cut is now decided by the transforms that decide the display, not by a
set of characters a split might hide behind. joins_to_a_credential redacts
each side the way it will be sent, joins the two, canonicalises the join and
scans it; safe_split_offset walks the boundary back exponentially until that
is clean. _push fills a bubble to that offset, and _roll_if_sealed re-decides
the boundary against the whole answer before a rotation makes it permanent,
because the answer grows after a frame goes out.

Closes #11727
@github-actions

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ⚠️ review incomplete

GPT 5.6 did not produce a complete verdict for b9a2ffcbe47e68db68ef7467fc0c5ece7a5e8ac1; inspect the workflow logs and re-run it.

This comment is updated in place on each push.

See the GPT 5.6 Review job logs; this commit has no completed GPT verdict.

False positive or not applicable? A repository writer can comment:
/ai-review override gpt b9a2ffcbe47e68db68ef7467fc0c5ece7a5e8ac1: <one-sentence reason>

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved after a live re-verification: readiness: passed label, PR Readiness status success on this head, no required check pending/failed/cancelled, mergeable, no effective CHANGES_REQUESTED, and no unresolved human blocking request found in comments or review threads. Native auto-merge (squash) enabled; no admin override used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

wecom: streaming cap severs a markup-split credential across two bubbles because the cut is chosen in raw coordinates

2 participants