Repository navigation
Conversation
… new ones A group-channel turn on a harness that reports compaction is sent the recent-messages window once, then only the entries that arrived since the previous turn. The whole window goes again on a new session, after a compaction, after a turn that did not land, and when no turn settled the last build.
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: nothing is removed, harnesses that don't report compaction keep the old path, and any build that doesn't settle falls back to repeating entries, never dropping them. Notes
[DESIGN-REVIEWED] 535da6d Description read[DESCRIPTION-READ] 31a4935a310fefe67ea51838c7aff100ad49b399299ffee567e9a8a094a83b61 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS The fix stops a 4k–16k-token channel window from being re-sent every turn on harnesses that report compaction. One surface has no consumer. Notes
What this change shipsInventory (5 items) — 3 justifiedIntent: in a group channel, the agent gets recent messages once, then only the ones that arrived since. FIX.
[FIRST-PRINCIPLES-REVIEWED] 535da6d Description read[DESCRIPTION-READ] 991fe5601e88929e6f980a3e9b410bbe0046471ca58aeb72eacf1ca0dca35e68 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — 🔴 changes requested (blocking)Reviewed The new "only new entries" branch in BLOCKING — src/kiro_crew/context_assembly/turn_message.py:713 [BLOCK-MERGE] 535da6d Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
|
Closing this one. The Opus review is right: every Slack build site passes |
Pull request was closed
Problem / Motivation
Goal: A group-channel conversation is sent its recent-messages window once, and after that only the entries that arrived since, on the harnesses whose compaction Kiro Crew sees.
ContextBuilder.build_messagereadschannel_history.context_foron every top-level channel turn (context_assembly/turn_message.py, the leg commented "inject on every message"). The window holds up to 50 entries of at most 300 characters, and 200 entries in observe mode. The engine replays its own conversation, so the previous turn's copy is already in its history and each message adds the whole window again. The block cannot be taken out at the wire the way the reply-format rules are, because each line carries a relative age ("5m ago") that changes every turn.Why it matters
A full window is 16,015 characters (50 entries of 300), about 4,000 tokens, and 4 times that in observe mode, added to the history on every message and re-read on every later turn. Measured with the real builder, one new message in a channel with 10 buffered entries of 150 characters makes the second turn 2,465 characters on main and 780 here. With 50 entries of 300 characters it is 16,556 and 930.
Not a goal
thread_repliesalready sends unseen replies only.What changed (motivation → approach → change)
Each entry now carries an arrival number.
ChannelHistory.context_since(channel_id, thread_ts, after)returns the text and the number of the newest top-level entry it covers, from one snapshot, so an entry pushed meanwhile is never skipped. Withafterit formats only newer entries under[New channel messages since the last turn:], and returns nothing when there are none.context_forkeeps its text and gains an optionalafter.The position lives in
context_assembly/delivery_records.py, beside the skill-body record and on its settle:commit_skill_bodieskeeps it,rollback_skill_bodiesrestores the value before the build.build_messageuses it only when the provider saysreports_compaction is True, for a top-level turn with a session key. Otherwise it makes the samecontext_forcall as before.needs_reinjection)An unsettled build can repeat entries and never drops one. A record for another channel or agent does not apply, and a position ahead of the buffer reads as no position.
docs/system-specs/modules/channel-history.mdsays so; no file undersrc/kiro_crew/docs/changes.Backwards compatibility
No setting. The reply-format change that sent a block once for compaction-reporting harnesses (#35756) shipped with no new key, and the harness check here is the same
reports_compaction is True. Every other harness, a thread turn, and a call with no session key take the unchangedcontext_forpath.test_thread_context.pystill pins the exactcontext_for(channel_id, thread_ts=...)call.Tests
599c87ffb5, 4 of the 10 cases inTestNewEntriesOnlyfail (second turn holds the whole window, nothing-new still sends it, and the two cursor cases). The other 6 pass on main and pin its outcome: full window after a compaction, after a rolled-back turn, on a harness that does not report compaction, in a thread, and the scrub.TestContextSincecases and the channel, skill-body, turn-bracket, binding, thread and neutralization suites (291 passed).test_context_composition_contract_facade.py, now lists the two builder methods and passes with the binding and channel tests (136 passed). The other 210 failed or errored ids are in the failure lists of earlier plain-main runs on this machine (for example a missingh2module).test_process_cache_floor_ratchet.pyfails only forsubagent_persistence.py::_NOT_DUE_MEMO, as on main. The cursor is builder state, not module state.python -m pytest test/test_channel_history.py -n0 -k "TestNewEntriesOnly or TestContextSince"Manual verification
Built two turns on one conversation with the real builder and a compaction-reporting stand-in provider: the second turn carried only the new entry (385 characters for one 300-character entry) and the first carried the whole window.
Sibling sweep
Sibling:
build_messagethread leg -- not affected -- keeps its whole thread windowSibling:
slack/handler_runtime/turn_context.pythread replies -- not affected -- already sends unseen replies only, the pattern copied hereSibling: reply-format rules (#35756) -- not affected -- taken out at the wire; this block cannot be, because its ages change each turn
Sibling: dashboard turn with a thread parent -- not affected -- passes
include_channel_history=FalsePattern harvest
Rule candidate: context re-sent on every turn on a harness that reports compaction keeps a per-session position that rides the existing turn settle, restores the prior value on a rollback, and reads from the last settled position when a build was never settled.
Related Issues
None filed.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement