Skip to content

fix: CLI agent 浮窗记忆用户调整的尺寸并跨重启保留 - #322

Open
Ghostknight0 wants to merge 1 commit into
zerx-lab:mainfrom
Ghostknight0:cli-subagent-size-memory
Open

fix: CLI agent 浮窗记忆用户调整的尺寸并跨重启保留#322
Ghostknight0 wants to merge 1 commit into
zerx-lab:mainfrom
Ghostknight0:cli-subagent-size-memory

Conversation

@Ghostknight0

Copy link
Copy Markdown

Description

每次新建对话时,CLI agent 浮窗都会回到默认大小(360×320),用户手动调整的尺寸不会被记住。根因是 CLISubagentView::new 每次都创建全新的 ResizableStateHandle,尺寸只活在单个 view 实例里。

本 PR 将浮窗尺寸接入仓库统一的 ResizableData 机制(与 LeftPanel / RightPanel / WarpAI 面板相同的模式):

  • ModalType 新增 CliSubagentWidth / CliSubagentHeightModalSizes 持有共享 handle——同一窗口内所有 CLI 浮窗共用记忆尺寸,新建对话自动复用
  • windows 表新增 cli_subagent_width / cli_subagent_height 两列(迁移 2026-07-20-000000_add_cli_subagent_window_sizes),经 WindowSnapshot 会话恢复链路跨重启保留
  • 窗口尺寸不足时沿用现有 with_bounds_callback 自动 clamp,无需额外处理

Testing

  • cargo check -p warp -p persistence 通过
  • cargo nextest run -p warp persistence:24/25 通过;唯一失败的 cloud_object::model::persistence::tests::test_unshared_team_object 为上游遗留问题(单独重跑确定性失败,断言的是云对象 Space::Team/Shared 共享语义,与本改动涉及的文件无交集)
  • 未新增测试的理由:新增两列的读写由既有 sqlite 往返测试(test_sqlite_round_trips_*)覆盖;尺寸共享逻辑复用既有 ResizableData/ModalSizes 机制,无新增分支逻辑

Server API dependencies

无——仅为客户端本地 SQLite 迁移,不涉及服务端 API。

Agent Mode

  • Zap Agent Mode - This PR was created via Zap's AI Agent Mode

Changelog Entries for Stable

CHANGELOG-IMPROVEMENT: CLI agent 浮窗现在会记住用户调整的尺寸,新建对话与重启应用后保持

每次新建对话时 CLI agent 浮窗都回到默认大小(360x320),因为
CLISubagentView::new 每次都创建全新的 ResizableStateHandle。

接入仓库统一的 ResizableData 机制(与 LeftPanel/RightPanel/WarpAI 相同):
- ModalType 新增 CliSubagentWidth/CliSubagentHeight,ModalSizes 持有
  共享 handle,同窗口内新对话自动复用记忆尺寸
- windows 表新增 cli_subagent_width/cli_subagent_height 两列
  (迁移 2026-07-20-000000_add_cli_subagent_window_sizes),
  经 WindowSnapshot 会话恢复链路跨重启保留
jwp2987 pushed a commit to jwp2987/phosphor that referenced this pull request Jul 29, 2026
Every new conversation reset the CLI agent floating window back to its
default size (360x320); a user's manual resize only lived in that one
CLISubagentView instance's ResizableStateHandle and was never persisted or
shared across new windows.

Wires the CLI subagent width/height into the same ResizableData/ModalSizes
mechanism already used for the left/right panels: new ModalType variants
CliSubagentWidth/CliSubagentHeight, a shared handle per window (so every
CLI floating window in a window reuses the remembered size), and two new
`windows` table columns (migration
2026-07-20-000000_add_cli_subagent_window_sizes) persisted through
WindowSnapshot's existing save/restore path.

Ports upstream zerx-lab#322.

Verified: cargo check -p warp -p persistence clean. 24/25 persistence::
tests pass (1 pre-existing ignore, unrelated: team-object stub, matches
upstream's own noted flake). 45/45 launch_config/resizable_data/
cli_subagent-focused tests pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant