Skip to content

fix(release): backport one knowledge fix to 0.12.0 line - #31019

Merged
buluoray merged 1 commit into
release/0.12.0from
crew/slack/0.12.1-batch-5
Nov 6, 2026
Merged

buluoray merged 1 commit into
release/0.12.0from
crew/slack/0.12.1-batch-5

Conversation

@buluoray

@buluoray buluoray commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Bring one knowledge fix that merged on main after v0.12.0 onto release/0.12.0, as its own commit, so the 0.12.1 patch ships it and it can be reverted alone.

Why it matters

PR What a 0.12.0 user sees today
#30588 A long document added to knowledge loses everything after its first 50 chunks, silently, so its end is never found by search.

Not a goal

What changed (motivation → approach → change)

The main squash commit was cherry-picked with -x onto release/0.12.0 @ f315771db6 (= v0.12.0) and applied clean. The branch also merges clean onto today's release/0.12.0 @ 6c33d94b6e (git merge-tree, no conflicts).

# PR main commit release commit
1 #30588 merge chunks past the per-file cap instead of dropping the tail 0c5e576ff7 cc69f3650a

Backwards compatibility

Compatible: the change is the one already merged on main, and #30588's own compatibility note applies unchanged.

Removes nothing: the pick hides, deletes or renames nothing 0.12.0 accepts beyond what #30588 already reviewed.

Tests

Proof: not provable -- other: a backport of a main commit whose proof ran on its own PR

  • CI does not run the backend suite on PRs into release/*, so the related set was run here: the 11 knowledge test files that import kiro_crew.knowledge.chunker, including the changed test_knowledge_chunker.py, in one pytest process, -n 0. 403 passed.
  • flake8 passes on the changed files and mypy passes on knowledge/chunker.py.

Manual verification

N/A - the pick was verified on its own main PR. The 0.12.1 RC soak is the end-to-end check.

Related Issues

Backport of #30588 to the 0.12 line for 0.12.1. Source issue: #30335.

Sibling sweep

Siblings: none -- #30588 carried its own sibling sweep; this PR only carries that fix unchanged.

Pattern harvest

Not generalizable: this PR only carries one fix already on main. #30588 has its own harvest.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.

@buluoray
buluoray requested review from a team and KiroCrewCaptain as code owners November 6, 2026 03:09
@buluoray
buluoray requested review from Zedmor and removed request for a team November 6, 2026 03:09
@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of cc69f3650a69691228abfa16932e0b3f69178414 — 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 does not.

First-Principles-Verdict: PASS

Nothing blocks: this is a clean -x cherry-pick of #30588 (issue #30335), and the added tests fail on base, since base truncates at 50 chunks.

What this change ships

Inventory (5 items) — 5 justified

Intent: let a 0.12.x user add a long document to knowledge and still find its end by search — FIX (backport).

  1. A plain-text document past 50 chunks merges neighbouring chunks instead of losing its end — justified
  2. Markdown, code and slide documents past the cap merge the same way (_fit_cap) instead of being truncated — justified
  3. A document longer than 50 × 4 pieces still keeps only its first pieces, and now logs a warning instead of dropping them silently — justified
  4. A new constant MAX_MERGE_WIDTH = 4 limits how large one stored chunk can get — justified
  5. The knowledge spec's constants table gains rows for MAX_CHUNKS_PER_FILE and MAX_MERGE_WIDTH — justified

[FIRST-PRINCIPLES-REVIEWED] cc69f36

Description read

[DESCRIPTION-READ] 3bcdbb5b54e7abfb564841da0891178b8b68dbe42c229a2a7a4ea2315865c3c3

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision cc69f3650a69691228abfa16932e0b3f69178414 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of cc69f3650a69691228abfa16932e0b3f69178414 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: this is a clean single-commit backport of a fix already merged on main. It takes nothing away and renders no new UI.

Notes

  • Merged chunks can be up to MAX_MERGE_WIDTH × the target size. Before 0.12.1 ships, check that whatever reads the chunks downstream (per-chunk extraction, the embedder's input limit) can take chunks four times larger on this release line.

[DESIGN-REVIEWED] cc69f36

Description read

[DESCRIPTION-READ] fcf309f4a7e13b3fe5810977377b347015ac7c83802d7d3d06da87922522b5bb

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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ human override accepted

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

Human judgment by @buluoray overrides the Opus 5.5 finding for cc69f3650a69691228abfa16932e0b3f69178414; the recorded reason is authoritative for this commit.

[OPUS-OVERRIDE] cc69f36

Verdict recorded from an authorized human decision for commit cc69f3650a69691228abfa16932e0b3f69178414.

False positive or not applicable? A repository writer can comment:
/ai-review override fable cc69f3650a69691228abfa16932e0b3f69178414 false-positive: <reason, 20 to 500 characters>

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 6, 2026
@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings (all downgraded on adjudication)

GPT 6.1 flagged blocking issues on cc69f3650a69691228abfa16932e0b3f69178414; Opus 5.5 adjudication downgraded every one of them. Downgraded: the remedy each one needs is disproportionate to the harm it prevents. Adjudication downgraded all 1 blocking finding(s): the remedy each one requires is disproportionate to the harm it prevents.

This comment is updated in place on each push.

Review details

BLOCKING -- src/kiro_crew/knowledge/chunker.py:193 -- Merging chunks drops previously embedded content

raw_chunks.append(text[group[0][1] : group[-1][2]].strip())
Trigger: Ingest a 60-paragraph document containing 600 eight-character words per paragraph with default settings and extraction timeout fallback. chunk() merges pairs; ingestion’s _embed_item() → embed_for_item() → LlamaCppEmbedder.embed_batch() clips each embedding input to 6,000 characters.
Outcome: A fact midway through paragraph 2 moves from offset 4,077 in its previously embedded chunk to offset 8,101 in the merged chunk. Neither the embedding prefix nor the next chunk’s overlap includes it, so previously represented content stops contributing to semantic retrieval. _fit_cap() shares this problem.
Anchor: defect
Fix: Embed merged content as bounded constituent inputs and combine their vectors, rather than embedding only the merged prefix.

[BLOCK-MERGE-DOWNGRADED] cc69f36
[GPT-REVIEWED] cc69f36

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

F1 — MEDIUM harm at most, recoverable, and the PR makes things strictly better than before. These conditions are in the code:

  • Merging only starts when a document splits into more than 50 pieces (src/kiro_crew/knowledge/chunker.py:31-33, _merge_plan). Before this PR, every piece past 50 was dropped (raw_chunks[:MAX_CHUNKS_PER_FILE] in the diff), so none of that text was indexed at all. The embedder trims each input to its first 6,000 characters (src/kiro_crew/embeddings_llama.py:1106-1111, _MAX_EMBED_CHARS at embeddings_settings.py:141). So the tail of a merged chunk gets no vector, but its text is still stored and the FTS5 keyword search still finds it (retrieval.py:1, retrieval.py:425-440).

  • Nothing is lost: re-ingesting after any later change re-embeds it. The cost is semantic recall on part of very long documents only, and the content in question was completely unindexed before. The fix the finding asks for (embed each part separately and combine the vectors per chunk) is a new mechanism across the ingestion/embedder seam that exists only for this path. That costs more than a partial loss on the vector search alone, in content this PR newly indexes.

    [ADJUDICATION] cc69f36 total=1 uphold=0 downgrade=1
    DOWNGRADE F1 src/kiro_crew/knowledge/chunker.py:193 reason=disproportionate-remedy
    [GPT-ADJUDICATED] cc69f36

False positive or not applicable? A repository writer can comment:
/ai-review override gpt cc69f3650a69691228abfa16932e0b3f69178414 false-positive: <reason, 20 to 500 characters>

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 6, 2026
…g the tail (#30588)

A document that split into more than MAX_CHUNKS_PER_FILE (50) chunks
kept only the first 50, with no log, and its file row still said done:
a ~48,000-character Japanese file lost its last sentence from search.
Every chunker path now merges neighbouring chunks so the document fits
the cap whole. The cap and every bound that reads it are unchanged.

Fixes #30335

Co-authored-by: Zezhen Xu <zezhexu@amazon.com>
(cherry picked from commit 0c5e576)
@buluoray
buluoray force-pushed the crew/slack/0.12.1-batch-5 branch from 5add895 to cc69f36 Compare November 6, 2026 04:12
@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Nov 6, 2026
@buluoray buluoray changed the title fix(release): backport two KAS and knowledge fixes to 0.12.0 line fix(release): backport one knowledge fix to 0.12.0 line Nov 6, 2026
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 6, 2026
@buluoray

buluoray commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

Goal, Why it matters and Not a goal edited at the requester's explicit ask: #30643 is held out of this backport (a maintainer requested changes on it after it merged), so the branch now carries #30588 only, at head cc69f36. #30643 comes back together with its follow-up fix in a later release PR.

@buluoray

buluoray commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

/ai-review override fable cc69f36 evidence-supplied: backport of #30588 unchanged; on main this diff passed Opus and GPT adjudicated the same finding non-blocking (#30588 (comment)). All text stays stored and keyword-searchable, where base dropped every piece past 50.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 6, 2026
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Human judgment recorded

@buluoray recorded a evidence-supplied release (class evidence-supplied) for the fable AI finding on cc69f3650a69691228abfa16932e0b3f69178414.

backport of #30588 unchanged; on main this diff passed Opus and GPT adjudicated the same finding non-blocking (#30588 (comment)). All text stays stored and keyword-searchable, where base dropped every piece past 50.

This decision applies only to this commit. A new push requires a new judgment.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention labels Nov 6, 2026
@buluoray
buluoray merged commit 7133174 into release/0.12.0 Nov 6, 2026
25 of 34 checks passed
@buluoray
buluoray deleted the crew/slack/0.12.1-batch-5 branch November 6, 2026 04:52
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 6, 2026
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.

2 participants