fix(chat): declare output route fact for uncatalogued models - #216
Conversation
审计结论(已 rebase 到最新 origin/main 验证)根因与修复PR #210 移除 安全性(无新缺陷)
守护测试
验证(rebase 到最新 main 后实测)
结论根因真实、修复彻底且优雅(修复全在底座,品悟只加守护测试+文档登记,无重复造轮子)、无无关修改(仅 gitlink/docs/测试 3 文件)、无新缺陷。可合并。唯一补充:建议按 Pinvou/CodeWhale#8 → #210 → #216 顺序合并(#216 生产生效依赖 #210 移除 env 注入;#210 单独合并不含本 PR 时未登记模型会被 4096 压死)。依赖说明已补充进 PR 描述。 |
6fb679e to
4006aec
Compare
rebase PR #216 到最新 main(cbce4ecb,CodeWhale v0.9.5)。原 PR 依赖 CodeWhale PR #8(5f55006b4,v0.9.0 线)的 provider_capability fallback 4096→65536 写法;v0.9.5 已把 max_output 改为 Option(未登记返回 None), 原写法不再适用,其意图经 route_budget 白名单有机结合实现。 - CodeWhale gitlink → 72c653032(新增 fork commit:route_declares_ unknown_output_ceiling 白名单纳入 ApiProvider::Openai,自定义 openai-compatible 端点视为 operator-owned,未登记 alias 走窗口启发式 128K→64000,不再被 4096/8192 保守兜底压死;kimi membership Option 语义保持不变) - 新增 forkguard 守护测试:云端模型(已登记 deepseek-v4-pro / 未登记 openai-compatible)不得被品悟声明 output_tokens,由底座窗口启发式 兜底(128K 窗口 → 64000 → ceiling 62976);本地 vLLM 24K 预算不变 - 更新既有 forkguard_openai_compatible_route_uses_declared_limits: 未知远端 OpenaiCompatible 由 8K 保守预留改为声明 output 24576 生效 (token_threshold 56570 → 45648) - 同步 docs/fork-modifications.md/.en、fork-policy.md/.en 登记新 gitlink 与 drift;scripts/fork-guard.sh 基线更新为 7 个线性 commit Signed-off-by: asto <asto18089@126.com>
4006aec to
8b3420b
Compare
rebase PR #216 到最新 main(cbce4ecb,CodeWhale v0.9.5)。原 PR 依赖 CodeWhale PR #8(5f55006b4,v0.9.0 线)的 provider_capability fallback 4096→65536 写法;v0.9.5 已把 max_output 改为 Option(未登记返回 None), 原写法不再适用,其意图经 route_budget 白名单有机结合实现。 - CodeWhale gitlink → 72c653032(新增 fork commit:route_declares_ unknown_output_ceiling 白名单纳入 ApiProvider::Openai,自定义 openai-compatible 端点视为 operator-owned,未登记 alias 走窗口启发式 128K→64000,不再被 4096/8192 保守兜底压死;kimi membership Option 语义保持不变) - 新增 forkguard 守护测试:云端模型(已登记 deepseek-v4-pro / 未登记 openai-compatible)不得被品悟声明 output_tokens,由底座窗口启发式 兜底(128K 窗口 → 64000 → ceiling 62976);本地 vLLM 24K 预算不变 - 更新既有 forkguard_openai_compatible_route_uses_declared_limits: 未知远端 OpenaiCompatible 由 8K 保守预留改为声明 output 24576 生效 (token_threshold 56570 → 45648) - 同步 docs/fork-modifications.md/.en、fork-policy.md/.en 登记新 gitlink 与 drift;scripts/fork-guard.sh 基线更新为 7 个线性 commit Signed-off-by: asto <asto18089@126.com>
8b3420b to
5a1d33c
Compare
|
审计完成,已把 PR rebase 到最新 结论:根因真实、修复对症、可合并(有一个语义边界建议澄清)
rebase 说明
一个语义边界建议(非阻断)
合并顺序依赖需先合并 |
zhuowp
left a comment
There was a problem hiding this comment.
复核当前 head 后,本 PR 与最新 main 存在真实内容冲突(GitHub: mergeable=false / dirty;当前约落后 44 个提交),因此无法确认冲突解决后的最终行为,也不能直接合并。当前 checks 同时失败。
请同步最新 main,保全双方可共存语义并按最终源码重跑适用门禁后重新请求审核。
0.8.1 macOS 版 GLM Coding Plan 国际版选 glm-5.2 报 model "glm-5.2" is not served by direct provider zai:zai 目录行 为市场拼写 GLM-5.2,app 保存的小写选择器精确比较匹配不到自身 行,反而在外部校验中撞上 modelstudio 裸 wire id 被误拒;自定义 glm-5.3 无冲突走透传故可用。 原修复在 Pinvou/CodeWhale#14 按 provider class 泛化,该 PR 关闭 后由维护者按评审收敛并经官方上游 Hmbown/Codewhale#5475 合入 (c0f749731,Co-authored-by 原作者):折叠回退仅作用于官方 Deepseek/Zai 严格直连端点,仅在精确匹配穷尽后接受唯一的 provider-owned 折叠命中,歧义时保持透传。本 PR 将该上游提交原样 cherry-pick 到 pinvou3-clean(Pinvou/CodeWhale#18),父仓按 r6/PR #216 配对流程先指向修复分支 head,同步更新 fork 登记 (r8)与 guard 指纹。 Signed-off-by: asto <asto18089@users.noreply.github.com>
rebase PR #216 到最新 main(c65fa498,CodeWhale v0.9.5 r7)。原 PR 依赖 CodeWhale PR #8(5f55006b4,v0.9.0 线)的 provider_capability fallback 4096→65536 写法;v0.9.5 已把 max_output 改为 Option(未登记返回 None), 原写法不再适用,其意图经 route_budget 白名单有机结合实现。 - CodeWhale gitlink → 0661776cd(新增 fork commit:route_declares_ unknown_output_ceiling 白名单纳入 ApiProvider::Openai,自定义 openai-compatible 端点视为 operator-owned,未登记 alias 走窗口启发式 128K→64000,不再被 4096/8192 保守兜底压死;kimi membership Option 语义保持不变);drift commit 由 r6 线 1aff9dd73 移植到 r7 head a36e6cd53 之上,route_budget.rs 冲突面为零,11 条 route_budget 测试全绿 - 新增 forkguard 守护测试:云端模型(已登记 deepseek-v4-pro / 未登记 openai-compatible)不得被品悟声明 output_tokens,由底座窗口启发式 兜底(128K 窗口 → 64000 → ceiling 62976);本地 vLLM 24K 预算不变 - 更新既有 forkguard_openai_compatible_route_uses_declared_limits: 未知远端 OpenaiCompatible 由 8K 保守预留改为声明 output 24576 生效 (token_threshold 56570 → 45648) - 同步 docs/fork-modifications.md/.en、fork-policy.md/.en 登记新 gitlink 与 drift(47 files,+1865/-271);scripts/fork-guard.sh 基线更新为 PUBLISHED_HEAD=r7 a36e6cd53 + 10 个线性 commit,并修复误降的执行位 Signed-off-by: asto <asto18089@126.com>
5a1d33c to
c5001d5
Compare
0.8.1 macOS 版 GLM Coding Plan 国际版选 glm-5.2 报 model "glm-5.2" is not served by direct provider zai:zai 目录行 为市场拼写 GLM-5.2,app 保存的小写选择器精确比较匹配不到自身 行,反而在外部校验中撞上 modelstudio 裸 wire id 被误拒;自定义 glm-5.3 无冲突走透传故可用。 原修复在 Pinvou/CodeWhale#14 按 provider class 泛化,该 PR 关闭 后由维护者按评审收敛并经官方上游 Hmbown/Codewhale#5475 合入 (c0f749731,Co-authored-by 原作者):折叠回退仅作用于官方 Deepseek/Zai 严格直连端点,仅在精确匹配穷尽后接受唯一的 provider-owned 折叠命中,歧义时保持透传。本 PR 将该上游提交原样 cherry-pick 到 pinvou3-clean(Pinvou/CodeWhale#18),父仓按 r6/PR #216 配对流程先指向修复分支 head,同步更新 fork 登记 (r8)与 guard 指纹。 Signed-off-by: asto <asto18089@users.noreply.github.com>
zhuowp
left a comment
There was a problem hiding this comment.
复审当前 c5001d5a:输出上限语义与 app 守护测试本身未发现问题,且当前与 main 可自动合并;但仍有 1 个 P1 与 1 个 P2,不能批准。
- P1 公开底座门禁:父仓 gitlink/guard 指向
0661776cda6d2323f3fd182a686e66d57d40f90b,公开不可变标签仍是pinvou-v0.9.5-r7 -> a36e6cd533024cfe5724bae21875aea42b2ed87a。因此verify-public-submodule.sh、线上fast-gate和required-gate均确定失败。必须先将 CodeWhale 变更合入公开维护分支并发布新不可变 tag,再把 gitlink、验证脚本、guard 和双语登记统一到最终 commit。 - P2 PR 正文严重过期:正文仍声称 gitlink
72c653032、CodeWhale #8 待合并、7 个线性 commit,并依赖已过时的 #210 合并顺序;实际树是 r7 上的0661776cd、10 个 commit,当前 fork register 也写成另一套状态。请按最终差异、真实依赖、最终测试结果和发布风险重写正文。
当前 windows-rust-test/rust-lint 成功;除公开基线和元数据外无新增 finding。
c5001d5 to
f70c265
Compare
|
@zhuowp 已按两轮复审意见完成修复并重写(head P1 公开底座门禁 — 属实,但修复路径与「发布 0661776cd」不同门禁红根因确认无误: 因此修复改为后向移植上游已合并的 #5461:
即 P1 的最终解是「维护者发布 r9 → 三点对齐」,与你的要求方向一致,只是标签内容换成了维护者认可的上游修复而非被拒的 #8 commit。 P2 PR 正文严重过期 — 已重写正文已按最终差异全量重写:gitlink 顺带修复
验证:CodeWhale 移植分支 待 CodeWhale #21 合并 + r9 发布后门禁即绿,请重新审查。 |
zhuowp
left a comment
There was a problem hiding this comment.
Re-review of f70c265fc: the app-side output-limit semantics and updated description address the prior conceptual findings, but the branch is no longer publishable or integrable as written:
-
[P1] The claimed r9 foundation target is stale and cannot satisfy the public gate. This branch points
CodeWhaleat2645c6c630and configurespinvou-v0.9.5-r9; the immutable public r9 tag now resolves to a different commit,07d183e350, while currentmainis on public r10feb8761aed. Consequently the branch's required/fast gates fail and waiting cannot make this gitlink match r9. Restack the behavior on the current published baseline (upstream first as required), publish any still-needed foundation change under the next immutable tag, then align the gitlink, verifier, guard fingerprints, and bilingual register to the final SHA. -
[P1] Resolve the current-main conflicts semantically. The merge tree reports conflicts in the CodeWhale gitlink, four fork-policy/register files,
assistant/platform/bridge.rs,fork-guard.sh, andverify-public-submodule.sh. Preserve current r10 behavior and the intended route-limit semantics, then rerun the actual combined gates. -
[P2] Update PR collaboration metadata to English. The current PR title and developer-facing description are Chinese;
AGENTS.mdrequires PR titles/descriptions and repository collaboration to be English.
git diff --check and commit-message validation pass, but the PR remains non-mergeable with two failing required gates.
f70c265 to
d2c123c
Compare
Rebase 到最新 main + r11 对齐 + 审阅代修(d2c123c96)基线更新:gitlink 改钉已发布的
|
d2c123c to
ac360ac
Compare
跟进:#367(r11 基线同步)合入 main 后的二次收缩(head
|
ac360ac to
e8671f0
Compare
|
Re-review follow-up on the current head
Verification on the new head: targeted bridge tests 4/4, Ready for re-review. |
zhuowp
left a comment
There was a problem hiding this comment.
Re-review of e8671f0: the branch is now correctly reduced to the app-side route declaration on the published r11 foundation, the PR metadata is current and English, and no new standalone defect was found in the route-limit semantics.
[P1] Resolve the current-main register conflict before approval. GitHub reports mergeable=false / dirty, and git merge-tree --write-tree origin/main HEAD reproduces a content conflict in docs/fork-modifications.md. Reconcile the bilingual register against current main without dropping either the current inventory or this PR's app-adapter entry, then rerun the combined-tree gates and re-request review.
e8671f0 to
7912e77
Compare
|
Rebased onto current main [P1] Register conflict — resolved, and the audit's factual claims were verified locally before fixing.
Combined-tree gates rerun on the new head (CodeWhale gitlink untouched by the PR, resolves to main's published r12 One pre-existing main condition observed while testing (not introduced or touched by this PR): PR description's verification section updated for the new head. Ready for re-review @zhuowp |
PR #374 bumped the release to 0.8.8 but left the workspace member entries in pinvou3-app/src-tauri/Cargo.lock at 0.8.7, so every cargo invocation wants to rewrite the lock and `cargo test --locked` fails at the resolution step before compiling. Regenerated with `cargo metadata --offline` on main 794a13d; the diff is exactly the two member entries (pinvou-knowledge and the pinvou3-tauri root). Third-party 0.8.7 pins are untouched, and `cargo metadata --locked` now passes. Discovered while re-running the combined-tree gates on PR #216. scripts/sync-version.mjs does not update Cargo.lock; consider teaching it to do so in a follow-up. Signed-off-by: asto18089 <asto18089@126.com>
PR #374 bumped the release to 0.8.8 but left the workspace member entries in pinvou3-app/src-tauri/Cargo.lock at 0.8.7, so every cargo invocation wants to rewrite the lock and `cargo test --locked` fails at the resolution step before compiling. Regenerated with `cargo metadata --offline` on main 794a13d; the diff is exactly the two member entries (pinvou-knowledge and the pinvou3-tauri root). Third-party 0.8.7 pins are untouched, and `cargo metadata --locked` now passes. Discovered while re-running the combined-tree gates on PR #216. scripts/sync-version.mjs does not update Cargo.lock; consider teaching it to do so in a follow-up. Signed-off-by: asto18089 <asto18089@126.com>
7912e77 to
c02e025
Compare
zhuowp
left a comment
There was a problem hiding this comment.
Re-reviewed at c02e025a6. The current-main register conflict is resolved, the branch is merge-clean, and the app-side route declaration remains narrowly scoped to operator-owned/custom OpenAI-compatible endpoints while normalized coding-plan entries and official presets stay fail-closed. The explicit configured limit and local-vLLM priorities are preserved, and the focused guard covers the foundation budget path. No blocking finding remains.\n\nThe current Linux rust-test failure is the shared hosted-runner disconnect after a successful compile/link step, not a test assertion; rust-lint, Windows Rust tests, fork/architecture gates, and the other applicable checks pass.
Upstream Hmbown/Codewhale#5461 semantics (carried by the fork's published pinvou-v0.9.5-r11 baseline, see PR #367): when a route explicitly declares output_tokens, that concrete fact replaces the 8192 conservative guess for uncatalogued models; routes without a route fact stay fail-closed, and Documented ceilings remain authoritative. App side, route_limits_for_model: user-configured openai-compatible endpoints (the OpenAI-compatible preset or provider_kind=custom, operator-owned) declare an output route fact per the base window heuristic (>=500K -> 65536, otherwise min(window/2, 65536), 64000 when no window fact exists; degenerate windows <= 4K stay undeclared). Official endpoints and the coding_plan managed entry (prefs normalize the kind by endpoint URL) are excluded and stay base fail-closed. The local vLLM explicit 24K budget and SavedModel.max_output_tokens explicit tightening keep their priority. Guard test forkguard_cloud_models_defer_output_cap_to_base: documented cloud models stay undeclared / custom endpoints declare the window heuristic (E=128000-64000-1024=62976; fails if the base lacks #5461) / official endpoints stay fail-closed at E=118784 / coding_plan excluded / tiny windows undeclared and 16K -> 8192. The D case feeds the host's real route product into the base budget to pin the behavior. The existing unknown_cloud and compaction assertions follow the r11 base semantics (45_648), and the test env guard now also isolates CODEWHALE_MAX_OUTPUT_TOKENS / DEEPSEEK_PROVIDER. The parent-side adapter lines in fork-modifications(.en) register the capability. Signed-off-by: Pinvou Agent <dev@pinvou.ai>
c02e025 to
6cacddd
Compare
PR #374 bumped the release to 0.8.8 but left the workspace member entries in pinvou3-app/src-tauri/Cargo.lock at 0.8.7, so every cargo invocation wants to rewrite the lock and `cargo test --locked` fails at the resolution step before compiling. Regenerated with `cargo metadata --offline` on main 794a13d; the diff is exactly the two member entries (pinvou-knowledge and the pinvou3-tauri root). Third-party 0.8.7 pins are untouched, and `cargo metadata --locked` now passes. Discovered while re-running the combined-tree gates on PR #216. scripts/sync-version.mjs does not update Cargo.lock; consider teaching it to do so in a follow-up. Signed-off-by: asto18089 <asto18089@126.com>
…ns docs) to latest base
PR Pinvou#374 bumped the release to 0.8.8 but left the workspace member entries in pinvou3-app/src-tauri/Cargo.lock at 0.8.7, so every cargo invocation wants to rewrite the lock and `cargo test --locked` fails at the resolution step before compiling. Regenerated with `cargo metadata --offline` on main 794a13d; the diff is exactly the two member entries (pinvou-knowledge and the pinvou3-tauri root). Third-party 0.8.7 pins are untouched, and `cargo metadata --locked` now passes. Discovered while re-running the combined-tree gates on PR Pinvou#216. scripts/sync-version.mjs does not update Cargo.lock; consider teaching it to do so in a follow-up. Signed-off-by: asto18089 <asto18089@126.com>
…mation The Linux-gated linux_automation.rs never compiles on the macOS dev machine, so the sixth-round rebase landed with six gate errors that only the Linux rust-lint runner sees (all six confirmed in CI): - elided lifetime on the Plugin::on_event event parameter; - geteuid/getpid/pre_exec unsafe blocks lack SAFETY invariants; - two same-lock registry lookups expect() without a narrow justification, now annotated like the established host.rs pattern. Also folds in the same rebase's own fallout: the uncatalogued-model route test (#216) arrived with bare env writes that are E0133 under edition 2024; they take the crate-wide ENV_LOCK unsafe treatment like their sibling tests, and the style_edition 2024 import ordering is restored in multiagent.rs. Signed-off-by: asto <asto18089@126.com>
The Linux-gated linux_automation.rs never compiles on the macOS dev machine, so the sixth-round rebase landed with six gate errors that only the Linux rust-lint runner sees (all six confirmed in CI): - elided lifetime on the Plugin::on_event event parameter; - geteuid/getpid/pre_exec unsafe blocks lack SAFETY invariants; - two same-lock registry lookups expect() without a narrow justification, now annotated like the established host.rs pattern. Also folds in the same rebase's own fallout: the uncatalogued-model route test (#216) arrived with bare env writes that are E0133 under edition 2024; they take the crate-wide ENV_LOCK unsafe treatment like their sibling tests, and the style_edition 2024 import ordering is restored in multiagent.rs. Signed-off-by: asto <asto18089@126.com>
Background
After PR #210 removed the global
DEEPSEEK_MAX_OUTPUT_TOKENS=24576injection, uncatalogued models on user-configured OpenAI-compatible endpoints fell back to the foundation's conservativeUncatalogued(8192)output guess, inconsistent with the documented-model window heuristic (>=500K -> 64K, elsewindow/2). Upstream Hmbown/CodeWhale#5461 (merged03260ec) resolved this foundation-side: an explicitoutput_tokensroute fact replaces the uncatalogued guess, routes without a fact stay fail-closed, and Documented ceilings remain authoritative. The publishedpinvou-v0.9.5-r11baseline (synced by #367) carries that change, so this PR is now a pure app-side feature (3 files, +243/-9).History: the original revision used an
ApiProvider::Openaiwhitelist (Pinvou/CodeWhale#8), which the CodeWhale maintainer closed on 2026-08-17 in favor of the narrower upstream #5461 semantics; intermediate revisions backported #5461 pending the r11 tag. All foundation parts are fully absorbed intomainvia #367.Changes
route_limits_for_model(pinvou3-app/src-tauri/src/features/assistant/platform/bridge.rs): endpoints that are operator-owned — theOpenAI-compatiblepreset orprovider_kind=custom, excluding the officialcoding_planmanaged entry (prefs normalize the kind by endpoint URL) — declare anoutput_tokensroute fact per the base window heuristic:>=500K -> 65536, elsemin(window/2, 65536),64000when no window fact exists (half of the 128K fallback). Adeclared >= 4096gate keeps degenerate tiny windows undeclared. Official endpoints stay base fail-closed. Priorities unchanged:SavedModel.max_output_tokensstill wins and is clamped by the process 24K budget; local vLLM keeps its explicit 24K.forkguard_cloud_models_defer_output_cap_to_base(six cases): documented cloud models stay undeclared / custom endpoints declare the heuristic (E=128000-64000-1024=62976; fails if the base lacks #5461) / official endpoints stay fail-closed atE=118784with the host's real route product fed into the base budget /coding_planexcluded / tiny window (2K) undeclared and 16K -> 8192. The existingunknown_cloud_model_does_not_gain_a_speculative_route_limitand compaction assertions follow the same semantics, and the test env guard also isolatesCODEWHALE_MAX_OUTPUT_TOKENS/DEEPSEEK_PROVIDER.docs/fork-modifications(.en).mdparent-side adapter lines note the capability.Semantic notes (intentional boundaries, unchanged from the review discussion): small windows still clamp to
window/2; uncatalogued names on official endpoints keep the 8192 conservative guess by design (missing declaration is not permission).Verification (current head
7912e7741, rebased onto main794a13d10/ r12 baseline)Rebase note: the register conflict reported on
e8671f07fis resolved — main's r12 inventory indocs/fork-modifications.md(drift/guard rows and the r12 section) is preserved byte-exact, and this PR's parent-side adapter entry is re-anchored into the current 父仓适配 row; the English register change still applies to the unchanged r11 output-ceilings bullet. The CodeWhale gitlink is untouched by this PR and resolves to main's published r12 (9c5f4f19).forkguard_cloud_models_defer_output_cap_to_base,forkguard_cloud_route_output_not_pinned_by_global_env,forkguard_openai_compatible_route_uses_declared_limits,unknown_cloud_model_does_not_gain_a_speculative_route_limit, plus theroute_limits/compaction_cloudfamily — 7/7 pass./scripts/fork-guard.sh --fast: fingerprint layer pass./scripts/verify-public-submodule.sh:pinvou-v0.9.5-r12 -> 9c5f4f19pass (main's script, untouched by this PR)python3 scripts/architecture-guard.py: passpython3 -m unittest scripts.tests.test_ci_gate_policy: 19/19 passcargo fmt --checkclean;scripts/validate-commit-msg.pypass;git diff --checkcleanKnown pre-existing main condition observed while testing (unrelated to this PR, untouched here):
cargo test --lockedwants member versions 0.8.7 -> 0.8.8 inpinvou3-app/src-tauri/Cargo.lockafter the #374 version bump; the lockfile is left as-is pending a standalone main fix.