fix: repair main's red full CI (window crash loop, Cloud port and team regressions and test drift)

Merged
TE
10d ago
+102-27

Main's full CI at d2ebf976 (run 37357769643) fails 6 of 7 app-host shards. Every full run on main since about 11:00Z on 10-05 has failed or been cancelled. This PR fixes forward everything that failed in that run, except the dictation paste PTY test, which looks like a timing flake (see below).

Fixes

FailureCulpritFix
App-host crash loop in shards 1, 2, 4, 5 and 6: objc "Cannot form weak reference to instance … CmuxMainWindow"#17368 (updater revert) also dropped #16352's window-identity fixReapply the identity hunks in UpdateTitlebarAccessory.swift: observe by ObjectIdentifier, take window changes from the container view, and resolve deferred work through NSApp.windows
CloudPortDiscoveryStateTests:37: "inventory unavailable" read as an empty successful scan (also red on unrelated PRs)#17232Product: keep skipping stray rows beside real socket rows, but return nil when the listing holds only diagnostics. New assertions keep #17232's intent.
CloudMultiTeamSurfaceTests:139: a restored pane keeps reconnecting after its team access is gone#17232 (try? swallowed the 403 in registerPendingRestoredMachines)Product: an access loss unregisters the machine, as the foreign-team pass already does
MachinesPanelModelTests:477/:825#17233 always appends the Coderouter sectionTests expect the intended section
NewMachineSheetLayoutTests:154#17427's lookup of cmux-devbox-0 vs #17422's renaming fixtureMatch the title family
UpdatePillReleaseVisibilityTests (cache policy 4 vs 0, titlebar width 149 vs 152)#17368 reverted these test hunks but not the code they coverRestore the pre-revert assertions

Not changed: TerminalPlainTextPastePTYTests:64 (dictation paste, zero bytes). No commit since the last green touched the paste path. realPTYDelivery passed on the same host, and the runner logged WebContent signal errors. It failed once in the last 12 failing main runs. The other drift seen earlier today needs no change: DeviceDiscoverabilityGating and CloudPortsVPNAffordance have passed since #17325, and CLIWorkspaceGroupSafety failed only once, at 02:43Z.

Verification

  • No local Swift build (not allowed on this Mac). Root causes come from main's logs and git history; this PR's changed-suites CI runs the touched suites.
  • The crash loop only shows across a full app-host run, so the full CI on main after merge is its proof. I'll dispatch it.

Resource check: no new loops, caches, logs or long-lived tasks.

Changelog

  • Fixed: a Cloud port scan whose inventory failed no longer reports that nothing is listening, and restored panes stop reconnecting after their team access is gone.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Summary by cubic

Fixes the main branch's failing full CI by repairing the app-host crash loop and two cloud regressions, and updating tests that drifted from intended behavior.

The titlebar accessory no longer stores a deallocating window in a weak reference, which crashed app-host shards; it now observes windows by identity and resolves deferred work through NSApp.windows. A Cloud port scan whose only rows are diagnostics now reports the inventory as unavailable instead of an empty successful scan, and restored panes unregister their machine when team access is lost instead of reconnecting.

Test drift

  • Updated tree expectations for the always-present Coderouter section.
  • Matched the nightly machine fixture by name family instead of exact title.
  • Restored assertions the updater revert dropped for cache policy and titlebar layout.

Summary by CodeRabbit

  • Bug Fixes
    • Cloud port scans now remain successful when diagnostic rows appear alongside valid listening services. Scans with no recognized listening services are reported as empty rather than unavailable.
    • Machines with permanently lost access are no longer restored as available machines.
    • Titlebar controls and phone-forwarding actions more reliably track their window during window changes and delayed updates.