Skip to content

fix(desktop): restore off-screen main window - #2203

Open
xianjianlf2 wants to merge 11 commits into
moeru-ai:mainfrom
xianjianlf2:fix/restore-main-window-bounds-2181
Open

fix(desktop): restore off-screen main window#2203
xianjianlf2 wants to merge 11 commits into
moeru-ai:mainfrom
xianjianlf2:fix/restore-main-window-bounds-2181

Conversation

@xianjianlf2

Copy link
Copy Markdown
Contributor

Summary

  • Validate persisted main-window bounds against the current display work area before creating the Electron window.
  • Keep move/resize persistence reachable and fall back to the primary display when the saved display is unavailable.
  • Add focused coverage for fully off-screen, partially off-screen, and unavailable-display recovery.

Validation

  • corepack pnpm --filter @proj-airi/stage-tamagotchi exec vitest run
  • corepack pnpm --filter @proj-airi/stage-tamagotchi exec eslint src/main/windows/main/index.ts src/main/windows/shared/display.ts src/main/windows/shared/display.test.ts
  • corepack pnpm --filter @proj-airi/stage-tamagotchi run typecheck
  • corepack pnpm --filter @proj-airi/stage-tamagotchi run build

Fixes #2181

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 60a1d14e60

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/stage-tamagotchi/src/main/windows/main/index.ts Outdated
@xianjianlf2

Copy link
Copy Markdown
Contributor Author

已推送 3f94c941 同步最新 main;当前 head 包含窗口边界恢复修复及对应测试。@nekomeowww 请复审。

@xianjianlf2

Copy link
Copy Markdown
Contributor Author

The requested window recovery change is implemented in 3f94c94:

  • persisted bounds are recovered on startup;
  • intermediate move events are not clamped, so the window can cross displays;
  • recovery is debounced after moving completes;
  • tests cover fully off-screen, partially off-screen, and unavailable-display fallback cases.

Could you please re-review this update?

@xianjianlf2
xianjianlf2 force-pushed the fix/restore-main-window-bounds-2181 branch from 3f94c94 to 27bfa3f Compare August 6, 2026 11:35
@xianjianlf2

Copy link
Copy Markdown
Contributor Author

Rebased onto the latest main and pushed as 27bfa3f. The window recovery fix still passes the targeted display tests (23/23) and lint checks. The implementation restores persisted off-screen bounds at startup, avoids clamping intermediate moves, and debounces recovery after moving completes. Please re-review.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 27bfa3f54e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/stage-tamagotchi/src/main/windows/main/index.ts
@xianjianlf2
xianjianlf2 force-pushed the fix/restore-main-window-bounds-2181 branch from 27bfa3f to 2050465 Compare August 7, 2026 03:37
@xianjianlf2

Copy link
Copy Markdown
Contributor Author

已修复 P2 review 并推送 2050465:只有保存的窗口 bounds 与当前显示器 bounds 有实际交集时才使用 getDisplayMatching;完全属于已断开显示器的 bounds 会回退到主显示器。新增 rectanglesOverlap 测试。验证:stage-tamagotchi 全量 366 passed、1 skipped,ESLint 通过。typecheck/build 仍受基线已有的 eventa/better-fetch 类型冲突和 audio 缺少 toWavFromPCM16 导出阻塞。请重新 review。

@xianjianlf2

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2050465044

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/stage-tamagotchi/src/main/windows/main/index.ts Outdated
@xianjianlf2

Copy link
Copy Markdown
Contributor Author

补充处理了最新 review:resize-only 拖动只触发 Electron 的 resize 事件,之前只在 move 后恢复边界,可能让窗口继续越过工作区。现在 resize 与 move 共用 250ms trailing debounce,窗口调整结束后都会执行边界恢复。

提交:ca097a240

验证:display tests 25/25、stage-tamagotchi lint 通过;typecheck 仍被基线的 @moeru/eventa 重复版本、缺失 toWavFromPCM16 和 @better-fetch/fetch 阻塞。

@xianjianlf2

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@xianjianlf2

Copy link
Copy Markdown
Contributor Author

Rebased/synced this branch onto the latest main and pushed 3e3d6df. There were no merge conflicts.\n\nCurrent local validation after the sync:\n- pnpm install --frozen-lockfile\n- pnpm -F @proj-airi/stage-tamagotchi exec vitest run src/main/windows/shared/display.test.ts (25 passed)\n- pnpm -F @proj-airi/stage-tamagotchi run lint\n- pnpm -F @proj-airi/stage-tamagotchi exec vitest run (357 passed, 1 skipped)\n- pnpm -F @proj-airi/stage-tamagotchi run typecheck\n\nThe latest resize/move recovery changes are preserved after the main sync. Please re-review when convenient.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3e3d6df2e1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/stage-tamagotchi/src/main/windows/main/index.ts Outdated
Comment thread apps/stage-tamagotchi/src/main/windows/shared/display.ts
Comment thread apps/stage-tamagotchi/src/main/windows/shared/display.test.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ea63c22203

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/stage-tamagotchi/src/main/windows/shared/display.test.ts Outdated
@xianjianlf2

Copy link
Copy Markdown
Contributor Author

Synced this branch with the latest main and pushed merge commit 9fef14c. There were no merge conflicts; the PR diff remains scoped to the main-window bounds recovery files.\n\nLocal validation after the sync:\n- pnpm -F @proj-airi/stage-tamagotchi exec vitest run src/main/windows/shared/display.test.ts (25 passed)\n- pnpm -F @proj-airi/stage-tamagotchi run lint\n- git diff --check origin/main...HEAD

@xianjianlf2

Copy link
Copy Markdown
Contributor Author

Addressed the latest regression-test traceability feedback in cc011152:

Validation:

  • corepack pnpm --filter @proj-airi/stage-tamagotchi exec vitest run src/main/windows/shared/display.test.ts (25 passed)
  • corepack pnpm --filter @proj-airi/stage-tamagotchi exec eslint src/main/windows/shared/display.test.ts
  • git diff --check

Please re-review when convenient.

@xianjianlf2

Copy link
Copy Markdown
Contributor Author

All current review conversations are now resolved. The latest head is cc011152, with the window recovery regression traceability update and the previous display fallback/JSDoc fixes preserved. Please re-review when convenient.

@lietblue lietblue added apps/stage-tamagotchi Desktop App: Windows & macOS & Linux bug Something isn't working pr-review/well-informed Pull Request that well described, with screenshots or tests, or explained well, easier to review scope/ui Scope related to UI/UX, or interface improve, perf, and bugs and removed pr-review/well-informed Pull Request that well described, with screenshots or tests, or explained well, easier to review labels Aug 13, 2026
…ndow-bounds-2181

# Conflicts:
#	apps/stage-tamagotchi/src/main/windows/main/index.ts
#	apps/stage-tamagotchi/src/main/windows/shared/display.ts
@xianjianlf2

Copy link
Copy Markdown
Contributor Author

Synced this branch with current upstream/main and resolved the conflict state in merge commit b3abab1ef3a25ce216934bdb79dd4002a5930dd1.

Conflict resolution:

  • apps/stage-tamagotchi/src/main/windows/main/index.ts: preserved upstream setWindowAlwaysOnTop / withHashRoute changes and kept this PR’s rectanglesOverlap / restoreWindowBounds recovery path.
  • apps/stage-tamagotchi/src/main/windows/shared/display.ts: kept this PR’s off-screen restore helpers, while using upstream’s shared DisplayArea / findDominantDisplayArea implementation instead of the removed local duplicate.

Local validation:

  • git diff --check

I attempted corepack pnpm install --frozen-lockfile to rerun the previous Vitest/ESLint checks, but the local install could not complete because repeated registry downloads timed out (operation was aborted due to timeout). CI is now running on the pushed merge commit and should provide the full validation signal.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 29, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-08-29T08:14:48.337270Z abbec0a New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

⏳ Approval required for deploying to Cloudflare Workers (Preview) for stage-web.

Name Link
🔭 Waiting for approval For maintainers, approve here

Hey, maintainers, kindly take some time to review and approve this deployment when you are available. Thank you! 🙏

@xianjianlf2

Copy link
Copy Markdown
Contributor Author

Updated the branch with the latest upstream/main to clear the BEHIND state.\n\nLocal validation:\n- pnpm run typecheck\n- pnpm exec vitest run apps/stage-tamagotchi/src/main/windows/shared/display.test.ts\n- pnpm run lint\n- git diff --check\n\nNote: two earlier parallel pnpm commands failed during dependency linking with ENOTEMPTY because they were started concurrently; rerunning the checks serially after install completed passed.

@xianjianlf2

Copy link
Copy Markdown
Contributor Author

All requested follow-ups are present on the current branch: recovery is scheduled after both move and resize events, the 250 ms workaround has the required NOTICE/source/removal condition, and the display regressions include the ROOT CAUSE block plus Issue #2181 name/link traceability. I resolved the addressed threads; could you please re-review when convenient?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

apps/stage-tamagotchi Desktop App: Windows & macOS & Linux bug Something isn't working scope/ui Scope related to UI/UX, or interface improve, perf, and bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Desktop: dragging the main window off-screen persists an unrecoverable position

3 participants