Skip to content

Commit 4e5b7de

Browse files
committed
fix(codex): keep multirouter wizard within small windows
Root cause: the Codex MultiRouter wizard constrained only the middle grid to 82vh while the header and footer were outside that limit. On the default 1000x650 / minimum 900x600 Tauri window the sum of header + 82vh + footer could exceed the viewport, so the bottom actions were clipped even though the wizard state was correct. Fix: make the overlay a bounded flex container, give the wizard shell max-h-full/min-h-0 flex-column layout, keep header and footer shrink-0, and let the middle body fill remaining height with independent scrolling for content and the step list. Tests: add a layout regression assertion for the shell/body/footer constraints, run CodexMultiRouterWizard Vitest, typecheck, renderer build, and git diff whitespace check. Record the debugging note in root memory.md.
1 parent 063aa16 commit 4e5b7de

3 files changed

Lines changed: 50 additions & 8 deletions

File tree

memory.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# CC Switch Repository Memory
22

3+
## 2026-06-30 Codex MultiRouter Wizard Small Window Layout Fix
4+
5+
- 用户截图显示 Codex MultiRouter 向导在较小窗口、尤其接近 Tauri 默认 `1000x650` / 最小 `900x600` 时底部按钮区被裁掉。根因不是向导状态机或步骤跳转,而是 `CodexMultiRouterWizard` 中间 grid 使用 `max-h-[82vh]`,但外层没有整体高度约束,最终高度约等于 header + `82vh` + footer,默认高度下会超过视口。
6+
- 修复边界:只调整 `src/components/codex/CodexMultiRouterWizard.tsx` 的遮罩弹窗布局。外层 overlay 改成 flex 居中并 `overflow-hidden`,向导 shell 改为 `max-h-full flex flex-col min-h-0`,header/footer `shrink-0`,中间 body `flex-1 min-h-0 overflow-hidden`,右侧内容和左侧步骤栏各自滚动。不要通过单纯提高 `tauri.conf.json` 默认窗口高度来掩盖问题,因为用户仍可能缩小窗口或恢复旧窗口状态。
7+
- 回归测试落点:`tests/components/CodexMultiRouterWizard.test.tsx` 断言向导 shell/body/footer 的关键布局类,避免后续把高度约束重新放回 `82vh` 内容区。验证命令:`pnpm vitest run tests/components/CodexMultiRouterWizard.test.tsx``pnpm typecheck``pnpm build:renderer``git diff --check`。浏览器直接打开 Vite renderer 会因缺少 Tauri IPC 出现 `window.__TAURI__` 相关错误,只能作为有限页面加载检查;完整交互仍以 Tauri 桌面或组件测试为准。
8+
39
## 2026-06-30 Codex MultiRouter Post-Setup Validation Refresh
410

511
- 用户追问“配置完返回的校验和刷新流程”,排查范围仍只限 Codex MultiRouter。现有成功判定已经正确:`StatusTab` 只在本地代理运行、Codex 接管、当前 provider 是选中 MultiRouter、入口/规则启用,并且当前方案 route 有真实成功转发证据时才触发 `onRuntimeReady`,不会因为其它 Codex 请求 200 就提前进入历史修复。

src/components/codex/CodexMultiRouterWizard.tsx

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,9 +1043,15 @@ export function CodexMultiRouterWizard({
10431043
[]) as CodexCatalogModel[];
10441044

10451045
return createPortal(
1046-
<div className="fixed inset-0 z-[120] bg-black/70 text-foreground backdrop-blur-sm">
1047-
<div className="absolute inset-x-3 top-4 mx-auto w-[min(96vw,1280px)] rounded-lg border border-white/15 bg-background shadow-2xl">
1048-
<div className="flex items-start justify-between border-b px-5 py-4">
1046+
<div className="fixed inset-0 z-[120] flex items-center justify-center overflow-hidden bg-black/70 p-3 text-foreground backdrop-blur-sm sm:p-4">
1047+
<div
1048+
role="dialog"
1049+
aria-modal="true"
1050+
aria-labelledby="codex-multirouter-wizard-title"
1051+
data-testid="codex-multirouter-wizard-shell"
1052+
className="flex max-h-full w-[min(96vw,1280px)] min-h-0 flex-col rounded-lg border border-white/15 bg-background shadow-2xl"
1053+
>
1054+
<div className="flex shrink-0 items-start justify-between border-b px-5 py-4">
10491055
<div className="flex items-start gap-3">
10501056
<div className="rounded-md bg-primary/10 p-2 text-primary">
10511057
<CurrentStepIcon className="h-5 w-5" />
@@ -1054,7 +1060,12 @@ export function CodexMultiRouterWizard({
10541060
<div className="text-sm text-muted-foreground">
10551061
{stepIndex + 1} / {STEPS.length}
10561062
</div>
1057-
<h2 className="text-xl font-semibold">{currentStep.title}</h2>
1063+
<h2
1064+
id="codex-multirouter-wizard-title"
1065+
className="text-xl font-semibold"
1066+
>
1067+
{currentStep.title}
1068+
</h2>
10581069
<p className="mt-1 text-sm text-muted-foreground">
10591070
{currentStep.description}
10601071
</p>
@@ -1070,8 +1081,11 @@ export function CodexMultiRouterWizard({
10701081
</Button>
10711082
</div>
10721083

1073-
<div className="grid max-h-[82vh] grid-cols-[15rem_minmax(0,1fr)] overflow-hidden">
1074-
<div className="space-y-1 border-r bg-muted/30 p-3">
1084+
<div
1085+
data-testid="codex-multirouter-wizard-body"
1086+
className="grid min-h-0 flex-1 grid-cols-[15rem_minmax(0,1fr)] overflow-hidden"
1087+
>
1088+
<div className="space-y-1 overflow-y-auto border-r bg-muted/30 p-3">
10751089
{STEPS.map((step, index) => {
10761090
const StepIcon = step.icon;
10771091
return (
@@ -1094,7 +1108,7 @@ export function CodexMultiRouterWizard({
10941108
})}
10951109
</div>
10961110

1097-
<div className="overflow-y-auto p-5">
1111+
<div className="min-h-0 overflow-y-auto p-5">
10981112
<div className="mb-4 rounded-lg border bg-muted/30 p-3 text-sm">
10991113
<div className="flex flex-wrap items-center gap-2">
11001114
<Badge variant="outline">状态机:{flowState.status}</Badge>
@@ -1529,7 +1543,7 @@ export function CodexMultiRouterWizard({
15291543
</DialogContent>
15301544
</Dialog>
15311545

1532-
<div className="flex items-center justify-between border-t px-5 py-4">
1546+
<div className="flex shrink-0 items-center justify-between border-t px-5 py-4">
15331547
<Button variant="ghost" onClick={() => closeWizard(true)}>
15341548
跳过
15351549
</Button>

tests/components/CodexMultiRouterWizard.test.tsx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,28 @@ describe("CodexMultiRouterWizard", () => {
7474
).toBeInTheDocument();
7575
});
7676

77+
it("keeps the wizard controls inside small app windows", () => {
78+
renderWithQueryClient(
79+
<CodexMultiRouterWizard
80+
open
81+
providers={[provider()]}
82+
onOpenChange={vi.fn()}
83+
onCreateProvider={vi.fn()}
84+
onOpenWorkspace={vi.fn()}
85+
onEnablePlan={vi.fn()}
86+
/>,
87+
);
88+
89+
const shell = screen.getByTestId("codex-multirouter-wizard-shell");
90+
const body = screen.getByTestId("codex-multirouter-wizard-body");
91+
const footer = screen.getByRole("button", { name: "下一步" })
92+
.parentElement?.parentElement;
93+
94+
expect(shell).toHaveClass("flex", "max-h-full", "flex-col");
95+
expect(body).toHaveClass("min-h-0", "flex-1", "overflow-hidden");
96+
expect(footer).toHaveClass("shrink-0");
97+
});
98+
7799
it("opens, navigates steps, and stores dismissed flag when skipped", () => {
78100
const onOpenChange = vi.fn();
79101

0 commit comments

Comments
 (0)