Skip to content

fix(runtime): stop the headless hydration repo gate from dropping every tab - #10437

Merged
brennanb2025 merged 2 commits into
mainfrom
brennanb2025/fix-headless-hydration-repo-gate
Jul 24, 2026
Merged

brennanb2025 merged 2 commits into
mainfrom
brennanb2025/fix-headless-hydration-repo-gate

Conversation

@brennanb2025

Copy link
Copy Markdown
Contributor

Problem

main is currently red for every PR. Three tests have been failing since #9343 (c2371c0cd8) landed:

  • orca-runtime-terminal-retirement.test.ts — "honors a legacy persisted tombstone before its first migration write", "publishes the host-rebased layout after a stale client pane update"
  • orca-runtime.test.ts — "polls floating tabs with targeted PTY liveness and no repo/provider inventory"

#9343 added a repo gate to hydrateHeadlessMobileSessionTabsFromWorkspaceSession — a correct idea (don't hydrate a session key whose repo is gone) with two problems in how the inventory is read:

const liveRepoIds = new Set((this.store?.getRepos?.() ?? []).map((repo) => repo.id))
if (ownerRepoId && !liveRepoIds.has(ownerRepoId)) continue
  1. Fails closed instead of open. ?? [] collapses "the store cannot report repos" into "there are zero live repos". Every parseable repoId::path key is then skipped, so nothing hydrates — headless/mobile session tabs silently vanish rather than one stale key being pruned.
  2. Enumerates repos on a hot path. getRepos() ran on every hydrate, including the floating-tab poll that orca-runtime.test.ts explicitly pins as free of repo/provider inventory work.

Fix

Resolve the inventory lazily, and only for keys that actually parse to a repoId; keep null (unavailable) distinct from an empty list (all repos genuinely gone).

Tests

#9343 shipped with no tests, which is how it broke three existing ones. Added orca-runtime-headless-hydration-repo-gate.test.ts covering all three properties above. Verified the two new behavioral tests fail without this fix and the gate-still-prunes test passes both before and after, so they pin the fix rather than the implementation.

Full src/main/runtime/ suite: 2614 passed / 5 skipped. oxlint and tsc --noEmit -p config/tsconfig.node.json clean.

Not addressed here: whether the phantom-workspace scenario #9343 targeted also needs the delete-path/load-time complements it mentions (#9025, #9200) — this PR only repairs the regression.

…ry tab

#9343 gated headless mobile-session hydration on the live repo list, but read
it as `this.store?.getRepos?.() ?? []`. A store that cannot report repos then
yields an empty set, which reads as "every repo is gone" and skips every
parseable session key — so no tabs hydrate at all. It also called getRepos on
every hydrate, including the hot floating-tab poll path that is contractually
free of repo/provider inventory work.

Resolve the inventory lazily and only for keys that parse to a repoId, and keep
`null` (unavailable) distinct from an empty list (all repos really gone). An
absent list now fails open; a known list still prunes as #9343 intended.

Fixes 3 tests that have been failing on main since #9343 landed:
orca-runtime-terminal-retirement (2) and orca-runtime (1).
@coderabbitai

coderabbitai Bot commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 51b1780a-e87c-4292-9c94-1c4f7923cb5c

📥 Commits

Reviewing files that changed from the base of the PR and between aae0087 and f9bb4ff.

📒 Files selected for processing (2)
  • src/renderer/src/components/editor/RichMarkdownEditor.tsx
  • src/renderer/src/components/editor/useRichMarkdownPendingFocus.ts

📝 Walkthrough

Walkthrough

Session hydration now lazily resolves live repository IDs while processing persisted terminal sessions. It preserves tabs when repository inventory is unavailable, skips tabs whose repository is absent from a known inventory, and avoids querying inventory for unparseable worktree IDs. Pending editor focus handling is extracted into a dedicated hook used by RichMarkdownEditor. A new headless test suite covers the three repository-gate scenarios.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers the problem, fix, and testing, but omits required Summary, Screenshots, AI Review Report, Security Audit, and Notes sections. Add the missing template sections, including a user-facing Summary, Screenshots or 'No visual change', AI Review Report, Security Audit, and Notes.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main fix to headless hydration repo gating.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…ines cap

#8083 pushed RichMarkdownEditor.tsx to 404 counted lines against the 400-line
.tsx cap, failing lint for every PR that merges current main. The Explorer
find-focus request is self-contained, so it moves to its own hook.
@brennanb2025
brennanb2025 merged commit 20ceeeb into main Jul 24, 2026
1 check passed
brennanb2025 added a commit that referenced this pull request Jul 24, 2026
…10443)

#9343 broke two contracts at once and #10437 fixed both, but neither is
asserted: #10429 repaired the failing tests by deleting the poll assertion and
by handing the retirement store a live repo, so a revert would land silently.

Restore `expect(getRepos).not.toHaveBeenCalled()` on the floating-tab poll, and
add a hydrate case for a store that cannot report repos. Verified both fail
against the pre-#10437 code: the poll assertion reports getRepos "called 2
times", and the hydrate case returns [] instead of the persisted tab.
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…ry tab (stablyai#10437)

* fix(runtime): stop the headless hydration repo gate from dropping every tab

stablyai#9343 gated headless mobile-session hydration on the live repo list, but read
it as `this.store?.getRepos?.() ?? []`. A store that cannot report repos then
yields an empty set, which reads as "every repo is gone" and skips every
parseable session key — so no tabs hydrate at all. It also called getRepos on
every hydrate, including the hot floating-tab poll path that is contractually
free of repo/provider inventory work.

Resolve the inventory lazily and only for keys that parse to a repoId, and keep
`null` (unavailable) distinct from an empty list (all repos really gone). An
absent list now fails open; a known list still prunes as stablyai#9343 intended.

Fixes 3 tests that have been failing on main since stablyai#9343 landed:
orca-runtime-terminal-retirement (2) and orca-runtime (1).

* refactor(editor): extract the pending-focus effect to clear the max-lines cap

stablyai#8083 pushed RichMarkdownEditor.tsx to 404 counted lines against the 400-line
.tsx cap, failing lint for every PR that merges current main. The Explorer
find-focus request is self-contained, so it moves to its own hook.
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…tablyai#10443)

stablyai#9343 broke two contracts at once and stablyai#10437 fixed both, but neither is
asserted: stablyai#10429 repaired the failing tests by deleting the poll assertion and
by handing the retirement store a live repo, so a revert would land silently.

Restore `expect(getRepos).not.toHaveBeenCalled()` on the floating-tab poll, and
add a hydrate case for a store that cannot report repos. Verified both fail
against the pre-stablyai#10437 code: the poll assertion reports getRepos "called 2
times", and the hydrate case returns [] instead of the persisted tab.
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