This repository was archived by the owner on Sep 22, 2026. It is now read-only.
Repository navigation
fix(proxy): handle large requests and TUI daemon paths - #3
Merged
Merged
Conversation
fix(proxy): allow bounded large model requests
fix(daemon): resolve TUI project path
heihei0299
pushed a commit
to heihei0299/pi-switch
that referenced
this pull request
Aug 30, 2026
- Gateway 预览干跑不写盘,发布原子写 models.json + notify_gateway_changed,校验失败 400 且不触 models - 双向错误隔离:profiles 与 gateway 分属独立 Router,错误不串扰;前端 PanelErrorBoundary 隔离,网关离线不阻断 supplier - 发布闭环:成功刷新 preview、清 pending、更新 lastPublishAt、消横幅;失败保留 draft 可重试 - 供应商权威:merge_gateway_extra 仅透传未知字段不提权 测试:cargo 304 / webui 183 全绿;typecheck 通过
heihei0299
pushed a commit
to heihei0299/pi-switch
that referenced
this pull request
Sep 11, 2026
上一轮 review 的 Spec CallmeLins#2/CallmeLins#3 与 Standards CallmeLins#1。 - basicAuthMiddleware 改为由调用方传入本面的 401 信封:管理面仍是 {"error":"Unauthorized"},/v1 推理面改为 OpenAI {"error":{"message":"Unauthorized","type":"invalid_request_error"}}, 补上 system-contract §2.8 唯一未遵守的路径(共享 middleware 此前把管理面 信封用在了推理面) - config 删除 rejectNullExposedModels 影子 schema:`exposedModels:null` 的 拒绝规则移到 Upstream.UnmarshalJSON,字段名只有一个 owner,不再存在 「字段改名后守卫静默失效」的风险 取舍:错误信息由 profiles.<name>.upstreams[i].exposedModels 变为 `profiles: exposedModels must not be null`;仍点名字段(满足 §2.2 「报出字段错误」),但不再带 profile/index 索引路径 - 测试:/v1 401 断言 OpenAI 信封、管理面 401 断言字符串信封、config 断言 null 错误点名字段 验证:gofmt -l / go vet 无输出;scripts/test-limited.sh go 全绿。 review-fixes-2
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
bin/pi-switch.jsfrom the package root when the native TUI starts a daemon outside the repository directoryProblem
Large multimodal requests can exceed Axum's default 2 MiB body limit and fail before reaching the proxy handler with:
Separately, the native TUI starts daemons without a
project_dirargument. Whenpi-switch tuiis launched outside the repository, daemon startup falls back to the current working directory and fails with:Changes
DefaultBodyLimitto the proxy routerPI_SWITCH_MAX_REQUEST_BODY_MIBvalues clamped to 4-256 MiBPI_SWITCH_PROJECT_DIRfrom the JavaScript entrypointutilfeature for router regression testingVerification
cargo test: 16 passedpnpm build:nativenode --check bin/pi-switch.jsrustfmt --check