fix(runtime): fall back on invalid archive routing proposals - #245
Merged
Conversation
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.
摘要 / Summary
Runtime capacity archival now falls back for a routing proposal that fails Host validation, including later batches that restart source numbering. The Host applies each proposal only after complete validation, preserves earlier valid batches, and archives exact originals while keeping model excerpts within their character budget.
关联 Issue 或背景 / Related Issue or Context
Fixes #235
涉及区域 / Affected Areas
PR 类型 / PR Type
最新代码确认 / Latest Codebase Confirmation
main分支开发,或在提交前已 rebase 或合并最新main。 / I developed from the latestmain, or rebased or merged the latestmainbefore submitting.同步命令 / Sync command:
git fetch origin main— latest base1e19caf40f0bf37edf678c3d829f2398ab28792a.AI 编码披露 / AI Coding Disclosure
使用的 AI 模型 / AI model used:
GPT-6 Astra, max reasoning.
使用的编码 Agent 工具 / Coding Agent tool used:
Codex desktop.
仓库规范检查 / Repository Rules
@deepseek-ai/*NPM 契约。 / I did not modify DSH source or point tsconfig at a DSH source checkout, and used only published@deepseek-ai/*NPM contracts.src/host/protocol.ts为准,没有在两侧重复定义 wire DTO。 / The Client and Host boundary still uses browser-safesrc/host/protocol.tsas the source for wire DTOs.lib/文件。 / I did not commit tokens, credentials, private memory, unredacted logs, or generatedlib/files.兼容性与数据安全 / Compatibility and Data Safety
No storage-format, Provider contract, configuration, credentials, path, or RPC authority changes. Fallback uses only the existing eligible catalog and preserves earlier valid route batches. The current chunk is validated in a temporary map; invalid or partially valid proposals cannot leak destinations. Exact source bytes remain independent of truncated model excerpts, and caller cancellation still stops before archival writes.
Provider-write preflight and compensation are handled separately in PR #243 for issue #240; this PR does not change Provider recovery semantics or promise a distributed transaction. Root alone receives a patch changeset.
本地验证 / Local Validation
执行的命令 / Commands run:
结果摘要 / Result summary:
All pass. Root: 936 tests passed, 5 opt-in live-model tests skipped; final coordinator run: 95 tests. Workspace tests, types, deterministic builds, real Headless activation, public entries and package validation pass. Standalone verification covers 16 independent plugins and 17 packed artifacts, including all three optional enhancements together. Real Mnemon 0.2.7 created/wrote/recalled/forgot a disposable store.
Regression fails before the fix. Added checks cover missing sources, duplicate/out-of-range/noninteger indexes, invalid destinations, empty/failed proposals, preservation of earlier valid chunks, exact original content and bounded excerpts. Existing cancellation checks remain passing. Model replies are deliberately scripted to reproduce the malformed proposal; transport, tool calls, Host, Source plugins, WebUI and Native storage are real.
用户可见变更证据 / Local Feature Evidence
证据 / Evidence:
Reproduction steps, bilingual results and screenshots.
With two active Native spaces and all three Strategy enhancements, the first routing batch receives and returns
[1, 2]; the second receives[3]but returns[1]. Before: the exact coverage error appears, no archive is written, and Runtime stays at 1,278/1,600 bytes. After restarting the same fixture with the fix and retrying the same entry: fallback succeeds, all three complete originals are visible in Native, and Runtime commits the pending entry at 913/1,600 bytes.