Skip to content

fix(linux): prevent IAB_LIFECYCLE sidebar rebound loop (windowId-based lookup) - #486

Merged
ilysenko merged 2 commits into
ilysenko:mainfrom
No1Hoo:fix/sidebar-iab-lifecycle-rebound-loop
Jun 13, 2026
Merged

ilysenko merged 2 commits into
ilysenko:mainfrom
No1Hoo:fix/sidebar-iab-lifecycle-rebound-loop

Conversation

@No1Hoo

@No1Hoo No1Hoo commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Problem

codexLinuxResolveLiveBrowserUseRouteWindow() uses a "first live window" heuristic instead of matching the requested windowId. During Electron startup when the main window is the only one, this eagerly binds to it, then hidden windows appear and IAB_LIFECYCLE enters a destroy+recreate rebound loop → sidebar text overlap/ghosting.

Fixes #485

Change

Replace the heuristic with a direct BrowserWindow.fromId(windowId) lookup — the function now correctly uses the windowId parameter it was already receiving:

  • Old: iterate getAllWindows() → if exactly 1 → force bind (regardless of windowId)
  • New: fromId(windowId) → if live → create state from it; otherwise check state map by id

Tested

  • Ubuntu 24.04 LTS, X11, Electron 42.1.0, AMD Phoenix3 GPU
  • Before: sidebar text overlap/ghosting, IAB_LIFECYCLE rebound loop in logs
  • After: sidebar renders correctly, clean IAB_LIFECYCLE init (registered once, no rebounds)
  • Browser Use functionality preserved (route window lookup still works)

jackie and others added 2 commits June 13, 2026 14:38
…d lookup)

Replace the 'first live window' heuristic in
codexLinuxResolveLiveBrowserUseRouteWindow() with a direct
BrowserWindow.fromId(windowId) lookup. The old heuristic
eagerly bound to whatever single window existed during startup,
then broke when hidden windows appeared, causing sidebar
destroy+recreate rebound cycles and text overlap/ghosting.

Fixes ilysenko#485

@ilysenko ilysenko left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Reviewed current head bc1c6ea. The runtime change now has targeted route-window lookup coverage: exact windowId resolves, unrelated single live windows are not used. Local focused patcher suite passed (244/244), and GitHub checks are green.

@ilysenko
ilysenko merged commit 8db1d3b into ilysenko:main Jun 13, 2026
6 checks passed
No1Hoo pushed a commit to No1Hoo/codex-desktop-linux that referenced this pull request Jun 18, 2026
The previous PR ilysenko#486 fixed function IJ (route window resolver) to use
BrowserWindow.fromId(windowId) instead of a "first live window" heuristic.

However, a second function LJ (focused owner resolver) introduced in newer
DMG versions still uses getAllWindows().filter().length===1 — the same
class of bug. When hidden Electron windows (crashpad, gpu, clipboard) exist,
the length===1 shortcut returns the wrong window, triggering an infinite
IAB_LIFECYCLE rebound loop on the sidebar.

This patch:
- Adds codexLinuxResolveFocusedOwnerWindow() helper (depth 0)
- Removes the getAllWindows().length===1 shortcut from LJ
- Uses lastSyncedWindowId via getLiveWindowState for precise lookup
- Falls back to iterating the windows Map (same as original, minus the bug)
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.

fix(linux): IAB_LIFECYCLE sidebar rebound loop causes text overlap/ghosting

2 participants