Skip to content

fix: resolve issues page flickering and tile memory exhaustion - #968

Merged
Jinwoo-H merged 1 commit into
mainfrom
Jinwoo-H/test-issues-flickering
Apr 23, 2026
Merged

Jinwoo-H merged 1 commit into
mainfrom
Jinwoo-H/test-issues-flickering

Conversation

@Jinwoo-H

Copy link
Copy Markdown
Contributor

Summary

  • useEffect dep array size change: useTabDragSplit toggled between useSensors(pointerSensor) (length 1) and useSensors() (length 0) based on enabled. dnd-kit spreads the sensors array into an internal useEffect dependency list, so changing its length violates React's rules of hooks — causing constant re-renders and the console error. Fixed by always passing one sensor with Number.MAX_SAFE_INTEGER activation distance when disabled.
  • Tile memory exhaustion: Each row in the issues list applied backdrop-blur-md to label badges (up to 3) and the "Use" button. With 36 rows, that's ~144 separate compositor layers, exceeding Chromium's tile memory budget and causing blank rows / glitchy rendering. Replaced with opaque bg-background/80.

Regression from #732 (feat: support dragging tabs into new split panes).

Test plan

  • Open the issues page with 20+ items — verify no blank rows or flickering
  • Check console for absence of tile memory limits exceeded warnings
  • Check console for absence of useEffect changed size between renders error
  • Verify label badges and "Use" buttons still look correct visually
  • Verify tab drag-and-drop still works in the active worktree
  • Verify hidden worktrees do not interfere with drag in the active one

Two root causes:

1. useTabDragSplit toggled between useSensors(ptr) and useSensors(),
   changing the sensors array length. dnd-kit spreads this into a
   useEffect dep list internally, violating React's hook rules and
   causing constant re-renders. Fix: always pass one sensor but use
   Number.MAX_SAFE_INTEGER activation distance when disabled.

2. TaskPage rows used backdrop-blur-md on labels (×3) and the Use
   button — up to 144 compositor layers across 36 rows, exceeding
   Chromium's tile memory budget. Fix: replace with opaque bg.
@Jinwoo-H
Jinwoo-H merged commit 206efc4 into main Apr 23, 2026
2 checks passed
LesleyMurfin added a commit to LesleyMurfin/orca that referenced this pull request Sep 23, 2026
…ing PR stablyai#968 scenarios

reconciledWorktreeIdsForHost applied unconditionally to every catalog-confirmed
worktree, regardless of whether this client's SSH connection to that host was
ever actually interrupted. Since an SSH-hosted worktree's tabsByWorktree row
never routes to the 'local' base partition in the first place
(buildHostSessionRouting always sends it to ssh:<targetId>), base.tabsByWorktree
is absent for EVERY confirmed worktree on EVERY boot -- closed or not. Combined
with remote-repo-registration.ts stamping the modern executionHostId field on
every SSH repo it registers (not a rare legacy shape), this meant an ordinary
quit + relaunch with nothing closed by anyone dropped every still-open tab on
every SSH worktree whose repo carries the modern stamp -- the opposite of
GAP-03's own goal, and a severe regression the existing 115-test suite, the
Docker e2e harness (which always closes every opened tab, CLOSE_COUNT=TAB_COUNT
by design) and the 4-client live verification never exercised, because none of
them ever tested a worktree with a genuine SURVIVOR tab through the confirmed
attribution path.

Fix: gate reconciledWorktreeIdsForHost on whether this host's SSH target was
actually connected at the client's last shutdown (activeConnectionIdsAtShutdown
-- the same field use-app-startup-hydration.ts already reads to decide which
targets to auto-reconnect at boot). A target still listed there was never
disconnected; its host-partition mirror is this client's own current state
written moments before quitting, not a stale pre-offline cache, so an absent
base row for it was never evidence of anything and must not be read as "the
server's confirmed zero." A target NOT listed there is the actual GAP-03
precondition, and still declines exactly as before.

Verification of PR stablyai#968's 4 deferred pr-agent scenarios, RED-then-GREEN against
this fix's own parent (36beb65f6b) and current HEAD, per-scenario:

- Concurrent Active Edits: the achievable case (host not disconnected -- see
  the restart regression above) now adopts correctly. The harder case (a live
  sibling worktree while genuinely offline) is a DOCUMENTED, PROVEN
  architectural limitation: reconciledWorktreeIdsForHost gates per host, not
  per worktree, so a worktree the base has never cached is indistinguishable
  from one whose tabs were genuinely closed while offline. Both are safely
  parked (never deleted -- attachHostSessionShadow/partitionRowsTheWriteWontReturn),
  just not adopted this boot. Resolving this needs a live server signal (the
  upstream draft's own manifestEpoch/handshake proposal); this fix has none.
- Split Layout Pruning: proven safe by construction -- GAP-03's decline is
  per-worktree across every field, not per-tab, so a declined worktree carries
  no rows in tabsByWorktree, unifiedTabs, tabGroups OR tabGroupLayouts. No
  orphaned split leaf can survive because nothing about that worktree is
  adopted at all.
- Write Race Protection: CONFIRMED, REPRODUCIBLE, UNFIXED bug. A wake-triggered
  persistWorkspaceSessionByHost never touches a host partition with nothing
  else routed to it (no race). The instant anything else legitimately writes
  to that same host partition in the same call (a sibling worktree gaining a
  tab), attachHostSessionShadow unconditionally re-attaches EVERY parked row
  for that host -- including one GAP-03 just correctly declined -- and it
  round-trips back to the server. A naive "drop instead of park" mitigation
  was prototyped and reverted: it closes this race for a genuinely-closed
  worktree but is blind to the Concurrent-Active-Edits false positive, turning
  a recoverable non-adoption into an unrecoverable delete of another client's
  live tabs. Answers PR stablyai#968's deferred question directly: hasPendingReconnectionHandshake
  is NOT unnecessary -- it (or an equivalent live signal) is the only thing
  that would close this race without risking data loss.
- Rapid Sleep/Wake Cycles: verified convergent and non-corrupting across 5
  consecutive boot cycles against an unchanged on-disk profile, with no
  cumulative resurrection and no duplicate adoption.

Also adds a real Docker cross-site e2e scenario (ordinary quit + relaunch,
nothing closed, connection still active at shutdown) proving the restart
regression fix end-to-end, not just at the unit level.

New/changed tests: workspace-session-host-offline-reconnect.test.ts (+7),
workspace-session-host-write-race.test.ts (new, 2), workspace-session-host-
rapid-reconnect-cycles.test.ts (new, 2). All 115 pre-existing GAP-03 tests
still pass unchanged; 124 total across the 11 touched files.

No PR opened; stays on this pushed branch pending owner sign-off, per this
slice's constraints (nothing goes upstream until fully verified).
LesleyMurfin added a commit to LesleyMurfin/orca that referenced this pull request Oct 14, 2026
…ing PR stablyai#968 scenarios

reconciledWorktreeIdsForHost applied unconditionally to every catalog-confirmed
worktree, regardless of whether this client's SSH connection to that host was
ever actually interrupted. Since an SSH-hosted worktree's tabsByWorktree row
never routes to the 'local' base partition in the first place
(buildHostSessionRouting always sends it to ssh:<targetId>), base.tabsByWorktree
is absent for EVERY confirmed worktree on EVERY boot -- closed or not. Combined
with remote-repo-registration.ts stamping the modern executionHostId field on
every SSH repo it registers (not a rare legacy shape), this meant an ordinary
quit + relaunch with nothing closed by anyone dropped every still-open tab on
every SSH worktree whose repo carries the modern stamp -- the opposite of
GAP-03's own goal, and a severe regression the existing 115-test suite, the
Docker e2e harness (which always closes every opened tab, CLOSE_COUNT=TAB_COUNT
by design) and the 4-client live verification never exercised, because none of
them ever tested a worktree with a genuine SURVIVOR tab through the confirmed
attribution path.

Fix: gate reconciledWorktreeIdsForHost on whether this host's SSH target was
actually connected at the client's last shutdown (activeConnectionIdsAtShutdown
-- the same field use-app-startup-hydration.ts already reads to decide which
targets to auto-reconnect at boot). A target still listed there was never
disconnected; its host-partition mirror is this client's own current state
written moments before quitting, not a stale pre-offline cache, so an absent
base row for it was never evidence of anything and must not be read as "the
server's confirmed zero." A target NOT listed there is the actual GAP-03
precondition, and still declines exactly as before.

Verification of PR stablyai#968's 4 deferred pr-agent scenarios, RED-then-GREEN against
this fix's own parent (36beb65f6b) and current HEAD, per-scenario:

- Concurrent Active Edits: the achievable case (host not disconnected -- see
  the restart regression above) now adopts correctly. The harder case (a live
  sibling worktree while genuinely offline) is a DOCUMENTED, PROVEN
  architectural limitation: reconciledWorktreeIdsForHost gates per host, not
  per worktree, so a worktree the base has never cached is indistinguishable
  from one whose tabs were genuinely closed while offline. Both are safely
  parked (never deleted -- attachHostSessionShadow/partitionRowsTheWriteWontReturn),
  just not adopted this boot. Resolving this needs a live server signal (the
  upstream draft's own manifestEpoch/handshake proposal); this fix has none.
- Split Layout Pruning: proven safe by construction -- GAP-03's decline is
  per-worktree across every field, not per-tab, so a declined worktree carries
  no rows in tabsByWorktree, unifiedTabs, tabGroups OR tabGroupLayouts. No
  orphaned split leaf can survive because nothing about that worktree is
  adopted at all.
- Write Race Protection: CONFIRMED, REPRODUCIBLE, UNFIXED bug. A wake-triggered
  persistWorkspaceSessionByHost never touches a host partition with nothing
  else routed to it (no race). The instant anything else legitimately writes
  to that same host partition in the same call (a sibling worktree gaining a
  tab), attachHostSessionShadow unconditionally re-attaches EVERY parked row
  for that host -- including one GAP-03 just correctly declined -- and it
  round-trips back to the server. A naive "drop instead of park" mitigation
  was prototyped and reverted: it closes this race for a genuinely-closed
  worktree but is blind to the Concurrent-Active-Edits false positive, turning
  a recoverable non-adoption into an unrecoverable delete of another client's
  live tabs. Answers PR stablyai#968's deferred question directly: hasPendingReconnectionHandshake
  is NOT unnecessary -- it (or an equivalent live signal) is the only thing
  that would close this race without risking data loss.
- Rapid Sleep/Wake Cycles: verified convergent and non-corrupting across 5
  consecutive boot cycles against an unchanged on-disk profile, with no
  cumulative resurrection and no duplicate adoption.

Also adds a real Docker cross-site e2e scenario (ordinary quit + relaunch,
nothing closed, connection still active at shutdown) proving the restart
regression fix end-to-end, not just at the unit level.

New/changed tests: workspace-session-host-offline-reconnect.test.ts (+7),
workspace-session-host-write-race.test.ts (new, 2), workspace-session-host-
rapid-reconnect-cycles.test.ts (new, 2). All 115 pre-existing GAP-03 tests
still pass unchanged; 124 total across the 11 touched files.

No PR opened; stays on this pushed branch pending owner sign-off, per this
slice's constraints (nothing goes upstream until fully verified).
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
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