Skip to content

fix: restore browser windows after tab changes - #7

Open
ai-eks wants to merge 1 commit into
mainfrom
fix/edge-window-layout-restore
Open

fix: restore browser windows after tab changes#7
ai-eks wants to merge 1 commit into
mainfrom
fix/edge-window-layout-restore

Conversation

@ai-eks

@ai-eks ai-eks commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • retain runtime window identity for manual layout snapshots
  • match all strong window identities before using a same-index fallback
  • preserve skipped behavior when a changed window no longer has the same index

Verification

  • swift test (167 tests, 0 failures)
  • git diff --check

@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: 3aa96a3d1a

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +116 to +126
for placementIndex in placements.indices where matches[placementIndex] == nil {
guard let matchIndex = bestMatchIndex(
for: placements[placementIndex],
candidates: candidates,
excluding: usedIndices
) else {
continue
}

matches[placementIndex] = matchIndex
usedIndices.insert(matchIndex)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Choose identity matches globally before reserving candidates

When an earlier placement has a weak identity match (for example, a shared browser title) with a candidate that exactly matches a later placement's document URL, this placement-ordered loop reserves the candidate before considering the stronger pair. The later placement can then fall through to an unrelated same-index window, causing two windows to be restored to incorrect frames. Select the strongest placement-candidate identity pairs globally before applying the index fallback.

Useful? React with 👍 / 👎.

displays: displays,
ignoring: ignoredBundleIdentifiers,
runtimeSnapshotID: kind == .automatic ? snapshotID : nil
runtimeSnapshotID: snapshotID

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve runtime identities for previously captured snapshots

When window recovery is enabled and an automatic snapshot already exists, saving a manual layout now replaces the provider's single retainedSnapshotID/retainedWindows pair with the manual snapshot's data. The still-visible automatic snapshot consequently loses the exact runtime identities it previously retained, so restoring it from the UI after browser metadata and window order change can skip or misplace those windows. Retain identities per snapshot, or otherwise avoid invalidating the existing automatic snapshot when capturing a manual one.

Useful? React with 👍 / 👎.

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