Repository navigation
fix(migration): import oversized legacy conversations (K-brain v0.107.11, retry old 413s) - #1142
Merged
Merged
Conversation
…rt cap K-brain now accepts legacy imports up to 512 MiB (was 64 MiB). Conversations that already failed with 413 are recorded as deterministic failures and skipped at startup, so after the upgrade they would stay unmigrated until the user clicked "Import old conversations". Record the cap a too_large failure was seen under; startup retries records without the current cap once, and later 413s are skipped as before.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Linked issue
Closes #1141
Summary
Long legacy conversations (mostly ones with inline images) failed to migrate with 413 "超出单次导入限制". Each conversation goes to K-brain in one request whose
source_metadatarepeats the conversation, so these requests exceeded K-brain's 64 MiB import cap.too_largerecords now store the cap they were seen under (limitBytes). Records without the current cap are retried once at startup. A 413 under the new cap is skipped as before, so huge conversations are not re-uploaded on every launch.The import request itself is unchanged, so already-imported conversations keep their content fingerprint.
Change scope
crates/agent-gui/src/lib/kbrain/historyMigrationFailures.ts:LEGACY_IMPORT_MAX_BODY_BYTES,limitBytes, and the startup skip rulecrates/agent-gui/src/lib/kbrain/historyMigration.ts: recordslimitBytesontoo_largescripts/release/kbrain.lock.json: K-brain v0.107.11 (b143a827). The sha256 values come from the releaseSHA256SUMS.Screenshots / preview
N/A. No UI change. Labeled
governance-exempt.Verification
pnpm typecheckandpnpm lint(agent-gui): passkbrain-history-migration*.test.mjs): 37/37 pass. The new test covers both cases: a record without the cap marker is retried once and cleared on success; a record with the current cap is skipped.node --test scripts/release/prepare-kbrain.test.mjs scripts/release/verify-kbrain-packaging.test.mjs: 11/11 passSHA256SUMS.Pre-submit checklist