Repository navigation
Conversation
|
👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review. When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically. |
GPT 5.6 Review (fork) — 🔴 changes requested (blocking)Reviewed 1 of 1 blocking finding(s) are security-class and were withheld from adjudication, so the blocking verdict stands. BLOCKING -- src/kiro_crew/dashboard/chat_handlers.py:12725 -- Metadata-changing reposts are falsely acknowledged as duplicates
FINDING -- test/test_ctx_boundary_key_and_label.py:243 -- [BLOCK-MERGE] 1e34980 Adjudication (Opus 4.8) — is blocking on each finding proportionate?F1 is a fenced finding. The dedup arm at chat_handlers.py:12740–12750 (per the patch) matches an existing pending entry on The condition combination (repost same content/source/key with an extended maxAge to refresh lifetime, within the original TTL window, drain not yet run) is a natural refresh pattern for keyed context, not a contradictory or writer-impossible one, and the loss is silent. I cannot complete a rarity record that a human would accept as residual risk. [ADJUDICATION] 1e34980 total=0 uphold=0 downgrade=0 |
Design Review (Fable 5, fork) — 🟡 CONCERNSDesign-level review of Design-Verdict: CONCERNS Description attests a different diff: the claimed Watch
[DESIGN-REVIEWED] 1e34980 |
First Principles Review (Fable 5, fork) — 🔴 BLOCKPremise-level review of First-Principles-Verdict: BLOCK A "fix" for a Not justified as shipped
What this change shipsInventory (8 items) — 0 justifiedIntent: stated as a FIX to
BlockersFraming contradicted by the diff. The description narrates fixing rewrite bugs in an existing boundary ("an overlong key was clipped", "checked after being stripped") and lists hunks in Zero-consumer one-way-door surface. New public field [FIRST-PRINCIPLES-REVIEWED] 1e34980 |
Opus 4.8 Review (fork) — ✅ no blocking findingsReviewed |
42d8eeb to
f1354a7
Compare
f1354a7 to
94fb228
Compare
c8aa113 to
ba0e870
Compare
1912ece to
5019dbf
Compare
5019dbf to
9b48fe6
Compare
9b48fe6 to
7e9069b
Compare
A contextKey is the identity the reload-dedup compares, so clipping or stripping it aliases two distinct keys and drops a post answered 200.
7e9069b to
1e34980
Compare
|
🤖 Kiro Crew [operator: dodgeblaster#b5f0d847]: This PR has been inactive for 7+ days. I reviewed the blockers but they require your input:
When you've addressed these, the pipeline will re-assess on its next cycle. |
|
PR triage (automated, 2026-10-05) — OVERLAPPING with #6813; needs a rebase I read the full diff at Overlap: #6813 (open PR, same author). #6813 also adds
Please pick one shape for the Not on main. Rebase needed. The PR is 1950 commits behind main, and Already raised by other reviewers, repeated here only for completeness:
Breaking change / P0: none found. Recommendation: rebase onto main, settle the |
|
Thanks for this, @rnoack1 — and sorry it is landing as a "not yet". I picked this up to re-home it onto But when I checked the premise against current That makes the "is this worth adding at all, and should the |
Unit 12 of a split: the /context boundary's key and label rules
Problem / Motivation
POST /api/chat/slots/{slot}/contextaccepts an optionalcontextKey, which thereload-dedup compares to decide whether an arriving post is a repeat of one already
queued. That makes the key an identity, and two boundary behaviours silently
rewrote it before the comparison:
a 64-character prefix collapsed onto one;
stripped, so
"\nv7"passed validation and then matched the earlier"v7"entry.In both cases the second post matched the first, was answered 200, and appended
nothing. The caller believed its content was queued; it never reached the model, and no
surface reported the loss.
A third arm had the same shape from the other direction: the dedup matched an entry that
had already expired. An expired entry is discarded by the drain rather than
delivered, so suppressing on it acknowledged a replacement whose content then went
nowhere.
Separately,
context_entry_expireddid the TTL arithmetic unguarded, so amaxAgeof"60"raisedTypeError: unsupported operand type(s) for +: 'int' and 'str'on the user's next send. That is reachable from every restore path, because the boundary
validators only guard the live enqueue — an entry rehydrated from an operator-editable
metadata line never passes through them.
Why it matters
Every one of these is the same defect class: content acknowledged with a 200 and then
silently dropped. That is the worst failure mode for this endpoint, because the caller
has no way to detect it and no reason to retry. A 400 is recoverable; a false 200 is not.
Refusing rather than rewriting also makes the key's contract honest.
sourceis alreadyrefused at the same limit, so this reuses the existing convention instead of inventing a
second one.
What changed
Behavioural (
chat_handlers.py, +145/−24)_validate_context_key: refuses a non-string, a raw value containing a controlcharacter (checked before the strip), and a normalized value over the label cap —
with
context_key_too_longandinvalid_context_keycodes.api_chat_slot_contextthreads the validated key into the entry and matches a repostonly against unexpired entries this binding owns.
_context_owned_by_previous_bindinggates the match, so a repost after a rebind isqueued rather than suppressed against the previous binding's copy.
context_keythreaded through_enqueue_pending_contextand_build_pending_context_entry; both call sites (/contextand/note) updated to thesingle
max_age-before-ephemeralorder so the two cannot drift.ephemeralis now stored only when the caller did not explicitly opt into durability,so an
is Truetest can no longer makenull,0or the string"false"durable byaccident.
Behavioural (
state.py, +47/−1)context_entry_expiredreports EXPIRED for a non-finite or non-numericmaxAgeinstead of doing the arithmetic. Reporting expired rather than "never expires" is
deliberate: the callers that already drop expired entries then prune it, whereas
immortality would have it re-persisted on every save.
MAX_CONTEXT_CONTENT,MAX_SOURCE_LENandSOURCE_CTRL_REmove here as theircanonical home, plus
_finite_number.chat_handlersalready imports this module andthe reverse would be circular, so this is the only non-circular direction — and it is
what lets the HTTP boundary and the restore path judge a label by one spelling.
Supporting primitives carried so this unit builds and tests alone
chat_utils.py(+30/−1):context_owned_by_previous_binding, which shares the drain'sown ownership rule rather than restating it.
history.py(+74): the stem-resolution chainsame_transcript→resolved_transcript_stems→coexisting_transcript_stems, plus the no-follow_node_presentprobe it needs. These are shared primitives that also appear insibling units of this split; carrying them identically is what keeps each unit
independently reviewable.
Tests
test/test_ctx_boundary_key_and_label.py(+229): 4 tests / 8 cases covering theoverlong-key refusal, the pre-strip control-character refusal, the expired-key repost,
and the malformed-TTL arithmetic. Each of the first three carries a discriminating
control asserting the refusal is a specific rule rather than the feature having been
disabled — a key at the cap is still accepted, a clean distinct key is still accepted,
and a live duplicate still suppresses.
ephemeralstorage change(
test_dashboard_chat_handlers_coverage.py,test_gateway_appkit_endpoints.py).Two rationales were trimmed out of code comments by the repo's comment-length gate and
belong here instead. First,
_is_finite_numberisstate._finite_numberunder an aliasbecause this module has its own
_finite_numberwith a different contract(
float | None, for the cosmetic context-reading fields); the delegation exists so theboundary and the hydrate path cannot drift on the isfinite-plus-OverflowError rule.
Second, the repost match normalizes
sourceon both sides, because a sourceless poststores no
sourcekey at all — a restored entry readsNonewhere the live value is"", and the repost missed the dedup entirely.Tests
(
test_ctx_boundary_key_and_label,test_dashboard_chat_handlers_coverage,test_dashboard_chat,test_channel_slots,test_ws_event_scoping,test_gateway_appkit_endpoints,test_deferred_note_persistence).failed — byte-identical to a pristine checkout of the same base run at the same
scope, so this unit introduces no regression.
with "a contextKey carrying a leading newline was accepted (200)";
"an overlong contextKey was accepted (200)".
black,isort,flake8clean; the comment-length pre-commit hook passeswithout a bypass.
Pattern harvest
Rule candidate: review-prompt
Pattern: a request boundary that normalises a caller-supplied identifier by rewriting it, so two distinct keys silently collide instead of one being refused.
Refusing at the boundary keeps the caller's key the caller's: a rewrite is indistinguishable, downstream, from the caller having sent the rewritten key, so the collision surfaces as missing state rather than as a rejected request.