Skip to content

cmux-next: close batch B1 test windows - #27257

Closed
teamleaderleo wants to merge 19 commits into
feat-cmux-nextfrom
lane/window-leak-suites-B1-codex
Closed

teamleaderleo wants to merge 19 commits into
feat-cmux-nextfrom
lane/window-leak-suites-B1-codex

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Batch B1 closes the remaining Swift test windows and panels that were still kept alive after each test. This follows Leo's instruction: "But why do you guys not just clean up after yourselves, or at least do your best to?"

The suites close their own windows and popup panels in teardown, while the product-side cleanup keeps Page Info, Extensions Menu, Host Pressure, Native Popup, and browser retirement panels from surviving a window close. This branch is stacked after the merged overlay-host fix.

No capture: no visible change; these changes only close hidden panels and test windows after their owner closes.

metric before after delta harness or run link
Windows open at process exit 251 pending pending five-step fleet census harness

Agent session: agent session

teamleaderleo and others added 3 commits October 28, 2026 22:13
Leo (2026-10-28), on Swift suites that leave windows open for the suites
after them: "But why do you guys not just clean up after yourselves, or at
least do your best to?"

Each suite in this batch now closes every window its tests open, in the
test's own teardown, and carries `.closesItsWindows` so a new leak fails by
name:
- teardowns that only ordered a window out close it;
- tests that make browser pages release them (or close the chrome's popup
  panels), and tests that open the palette close its panel;
- background mode's menu bar item goes when the launch test shuts down.

Product code never closed three kinds of panel, only ordered them out, so
they stayed in the app's window list while anything held their owner:
- a window's overlay host panel, when the window closed (WindowOverlayHost);
- a browser page's Page Info and Extensions panels, when its tab closed
  (BrowserEntry.close now calls BrowserChromeView.closePopupPanels);
- the Mac screen approval prompt's panel, whose content holds the prompt
  (now closed and dropped when the prompt hides; the next request makes one).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-85ca59f74f02d81734c3
…heir panels

Leo (2026-10-28): "But why do you guys not just clean up after yourselves,
or at least do your best to?"

- WindowOverlayHost keeps a closed window's torn-down host registered, so a
  late `host(for:)` for that window returns it instead of making a fresh
  panel nothing closes; a window shown again gets a new host, and
  `existingHost` still answers nil once torn down.
- NativePopupHost.closePanel closes a popup's panel for good; Page Info,
  the Extensions bubble and the host pressure popover (when its indicator
  leaves its window) use it.
- DebugPaletteCaptureTests and HomeOpenFocusesComposerTests drop the trait
  for now: the first leaves only AppKit's own TUINSWindow, the second the
  Chief Settings popover's panel, which its owner never closes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-85ca59f74f02d81734c3
…pKit-only suites keep the trait

Leo: "But why do you guys not just clean up after yourselves, or at least do your best to?"

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-85ca59f74f02d81734c3
@cursor

cursor Bot commented Oct 29, 2026

Copy link
Copy Markdown

Bugbot needs on-demand usage enabled

Bugbot uses usage-based billing for this team and requires on-demand usage to be enabled.

A team admin can enable on-demand usage in the Cursor dashboard.

@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

cmux status (one comment, edited in place; each line is updated by the job that owns it)

Review 2a72ab7: HQ feed card · gallery before/after runs · checks

App of this head (app.zip, kept 1 day)

gh workflow run reload-build.yml -R manaflow-ai/cmux --ref feat-cmux-next -f tag=pr27257 -f ref=lane/window-leak-suites-B1-codex -f platform=macos -f backend_mode=local

red: cmux-next checks (god files, concurrency, crash safety, l10n); NEW: green on the base 1674720; do not merge until green; see lane-rules

@github-actions github-actions Bot added the risk:normal Risk tier (docs/ci/risk-tiers.md) label Oct 29, 2026
@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Bead cx-edi7x1 created for this PR by the cmux coordinator.

@blacksmith-sh

blacksmith-sh Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Found 7 test failures on Blacksmith runners:

Failures

Test View Logs
/tmp/tmpmiudc7_v/summary-fail.json (live):/summary-fail.json (live): View Logs
/tmp/tmpr2wtz94v/summary-missing.json (live):/summary-missing.json (live): View Logs
[new_workspaces] debug.new_workspace timed 0 of 50 new workspace rows/
[new_workspaces] debug.new_workspace timed 0 of 50 new workspace rows
View Logs
[new_workspaces] the window draws no frames/[new_workspaces] the window draws no frames View Logs
[tabs] debug.tab_switch timed 0 of 40 switches/
[tabs] debug.tab_switch timed 0 of 40 switches
View Logs
[tabs] the window draws no frames/[tabs] the window draws no frames View Logs
convention violations found (ERROR lines above)./
convention violations found (ERROR lines above).
View Logs

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

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (codex-review-box/gpt-6-astra high, lane-place): BLOCK at 29fcf05

BLOCK

  1. [P1] Third BrowserProfile test still lacks cleanup — BrowserProfileNewTabMenuTests.swift:132. theProfileBadgeMenuOpensItsTabInTheRightClickedTabsPane creates browser tabs without registering Self.close. Its harness closes shell windows but retains cached browser entries, leaving PageInfo/Extensions panels unclosed. Register cleanup at this body’s entry too.

  2. [P2] Daemon-close test cleans only one cached page on failure — DaemonClosedBrowserPageTests.swift:25. Both pages are cached, but the defer releases only tabs[0]. If closeTab throws or the subsequent waits fail before retirement, tabs[1] retains its panels. Teardown must release both independently of the behavior being tested.

Reviewed exact head 29fcf056bf811e6cf679f2c5d83fdb66cc260dbc, including all 28 cumulative changed files; their blob hashes match the diff. The earlier cache and palette findings are resolved for the first two BrowserProfile bodies.

Source-only verdict. macOS runtime and full census remain pending; no readiness or merge approval.

@cursor

cursor Bot commented Oct 29, 2026

Copy link
Copy Markdown

Bugbot needs on-demand usage enabled

Bugbot uses usage-based billing for this team and requires on-demand usage to be enabled.

A team admin can enable on-demand usage in the Cursor dashboard.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (codex-review-box/gpt-6-astra high, lane-place): BLOCK at 29f279a

BLOCK — 29f279aafff3ef0a05f41a15226b9f45d2247e65

  1. [P2] Failed setup can leave daemon startup running. PinnedPageTests.swift:98 and PasswordManagerRouteTests.swift:82 call shutdownConnection() only when connection exists. Cancellation or timeout before the first connection skips it, leaving the unstructured startup/retry task running after window cleanup and directory removal. Stop startup unconditionally, await its completion, and reap any owner it launched.

  2. [P2] Background shutdown still permits daemon restart. BackgroundAccessoryPolicyTests.swift:74 requests shutdown through the subscribed connection before disabling reconnect. Daemon EOF schedules reconnect through server ensure; if teardown’s main-actor continuation is delayed, it can spawn a replacement daemon. FreshLaunchSidebarTests.swift:48 has the same ordering. Close and await the connection first, then use the dedicated shutdownDaemon(endTerminals: true) socket, as the shared harnesses already do.

  3. [P2] Answering the last MacScreen request can bypass panel cleanup. MacScreenApprovalPanel.swift:97 clears current before calling update(). With no remaining unsettled request, update() compares nil with nil and returns before present(false). Thus the new panel close/drop branch never runs when settlement beats the pending-request observer, including the already-ended-request error path. Preserve the previous request until update() processes the transition, or explicitly close when settlement empties the queue.

Read the full cumulative diff and lifecycle dependencies; all 31 changed-file hashes match. This is a source-only verdict: no native execution or runtime census establishes readiness or merge approval.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (codex-review-box/gpt-6-astra high, lane-place): SHIP at 71c6f3a

SHIP

  1. No blocking source findings across all 33 cumulative changed files, including all 22 modified test files. Startup/reconnect draining, partial setup cleanup, browser/panel caches, and AppKit close paths reviewed.
  2. ci-target-graph.json:1 exactly matches base; generator-computed test-resource reads are unchanged.

Source verdict only for 71c6f3ac024379436e6d27747209e00f0f17fc96. No native compile, runtime, or census validation; no readiness inferred.

Coordinator must request lawrencecchen, post the awareness comment, and launch the fresh-home fleet at this final head—no reply-wait gate. Those external actions were unavailable here. No branches modified; PR #26809 HOLD untouched.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (codex gpt-6-astra high, next-review): SHIP at a36713a

No blocking findings.

Review covered the supplied diff and files. Additional repository reads were blocked by environment policy; macOS tests were not run.

@cmux-bot cmux-bot 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.

cmux-bot approves a36713a: an independent review passed this exact head (next-review receipt by teamleaderleo). A push needs a new review; a later BLOCK at this head dismisses this approval.

Base now has #27239 squashed. Conflicts keep this branch's cleanup: PageInfoController.closePanel retires and closes its windows, BackgroundAccessoryPolicyTests stops through AppTestDaemonOwner, DaemonClosedBrowserPageTests releases both tabs, and BrowserProfileNewTabMenuTests / DebugPaletteCaptureTests keep their own panel close (base's second close is dropped).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-0cf32b32a03b27dcdf4d
Record verified process identities and use the existing audit-token fallback when a shutdown handshake fails. Preserve state directories until every owned daemon exit is confirmed, and bound moved-tab synchronization and cancellation.

Validation: cmux-next prepush gate and diff check pass; native Swift compilation/runtime unavailable in this Linux lane. Fleet reruns and exact-head review required.
Agent-Session: https://cmux.com/deeplink/agent?id=aid-66d4d9063f5f1bfabf11
@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

take it

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (codex-review-box/gpt-6-astra high, lane-place): BLOCK at c26c33d

BLOCK

  1. [P2] ArtifactPanel.tsx:66: The new artifact preview is unreachable with agent.pageHost or agent.chromium enabled. Those hosts use cmux-page://cmux.agent, but canRender() accepts only cmux-agent:, so HTML/JSX artifacts show only Code. The frame URL also remains hardcoded to the legacy endpoint. Wire both the preview capability and frame URL to the newly added cmux-page://cmux.agent/__artifact endpoint.

@cursor

cursor Bot commented Oct 30, 2026

Copy link
Copy Markdown

Bugbot needs on-demand usage enabled

Bugbot uses usage-based billing for this team and requires on-demand usage to be enabled.

A team admin can enable on-demand usage in the Cursor dashboard.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Fresh-home launch of b14c3d133e12 on a fleet capture Mac (empty HOME, CFFIXED_USER_HOME, TMPDIR and defaults): PASS

Verdict PASS
Build fleet job 1048c2a8c4e76ac65d30dd88 of b14c3d133e12
Validator scripts/ci/fresh_home_launch_smoke.py from feat-cmux-next at 25d8da5fcd97
Home rendered 7.4s after launch
Up 30s
first_window_frame_committed 5169 ms
Crash reports / uncaught exceptions 0 / 0

fresh-home launch

cmux-ci fresh-home --job 1048c2a8c4e76ac65d30dd88 --pr N (commit status cmux-ci/fresh-home on b14c3d133e12)

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (codex-review-box/gpt-6-astra high, lane-place): BLOCK at b14c3d1

BLOCK

  1. Packages/macOS/CmuxNext/Tests/CmuxNextAppTests/PinnedPageTests.swift:29-32 — endpoint() removes its unstructured ensure task from ensures in defer as soon as the caller is cancelled. DaemonConnection.close() cancels the caller while ensureEndpoint() continues running, so reap() can miss that in-flight launch, report success, and delete the temporary state directory before server ensure finishes. The daemon can then start after teardown and outlive the test.

  2. Packages/macOS/CmuxNext/Tests/CmuxNextAppTests/PinnedPageTests.swift:70-83,97-105 — record adds every endpoint to endpoints even when process verification fails (processes[endpoint] remains nil), but reap still runs the graceful shutdown closure first. That closure connects to the endpoint and issues shutdownDaemon; if the socket now belongs to a replacement or otherwise unverified daemon, teardown can shut down a process the test never established ownership of. The “unverified live process is left alone” safeguard only applies after this potentially destructive shutdown attempt fails.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Superseded by #28093, a backlog-drain carry that keeps this PR's commits and their authorship and repairs its BLOCK findings. Closing this one in its favour.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (codex-review-box/gpt-6-astra high, lane-place): BLOCK at 2a72ab7

BLOCK

  1. Packages/macOS/CmuxNext/Tests/CmuxNextAppTests/PinnedPageTests.swift:152-154 treats kernelProcess(pid:) == nil as proof that the daemon exited after graceful shutdown. That API can also return nil when the process identity is temporarily unreadable; the fallback below explicitly treats unreadable identity as insufficient evidence. This can report a live daemon as reaped and delete its state directory, leaving an owner running against removed state.

teamleaderleo added a commit that referenced this pull request Oct 31, 2026
* cmux-next tests: batch B1 suites close the windows they open

Leo (2026-10-28), on Swift suites that leave windows open for the suites
after them: "But why do you guys not just clean up after yourselves, or at
least do your best to?"

Each suite in this batch now closes every window its tests open, in the
test's own teardown, and carries `.closesItsWindows` so a new leak fails by
name:
- teardowns that only ordered a window out close it;
- tests that make browser pages release them (or close the chrome's popup
  panels), and tests that open the palette close its panel;
- background mode's menu bar item goes when the launch test shuts down.

Product code never closed three kinds of panel, only ordered them out, so
they stayed in the app's window list while anything held their owner:
- a window's overlay host panel, when the window closed (WindowOverlayHost);
- a browser page's Page Info and Extensions panels, when its tab closed
  (BrowserEntry.close now calls BrowserChromeView.closePopupPanels);
- the Mac screen approval prompt's panel, whose content holds the prompt
  (now closed and dropped when the prompt hides; the next request makes one).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-85ca59f74f02d81734c3

* cmux-next: a closed window makes no new overlay panel; popups close their panels

Leo (2026-10-28): "But why do you guys not just clean up after yourselves,
or at least do your best to?"

- WindowOverlayHost keeps a closed window's torn-down host registered, so a
  late `host(for:)` for that window returns it instead of making a fresh
  panel nothing closes; a window shown again gets a new host, and
  `existingHost` still answers nil once torn down.
- NativePopupHost.closePanel closes a popup's panel for good; Page Info,
  the Extensions bubble and the host pressure popover (when its indicator
  leaves its window) use it.
- DebugPaletteCaptureTests and HomeOpenFocusesComposerTests drop the trait
  for now: the first leaves only AppKit's own TUINSWindow, the second the
  Chief Settings popover's panel, which its owner never closes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-85ca59f74f02d81734c3

* cmux-next tests: Home's Chief Settings panel closes with its test; AppKit-only suites keep the trait

Leo: "But why do you guys not just clean up after yourselves, or at least do your best to?"

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-85ca59f74f02d81734c3

* Close browser profile test pages and palette on early failure

Agent-Session: https://cmux.com/deeplink/agent?id=aid-c5f7357864b9736bff29

* Make window test cleanup cover failed setup and all cached pages

Agent-Session: https://cmux.com/deeplink/agent?id=aid-c5f7357864b9736bff29

* fix(tests): drain owned daemon startup and settle approval panels

Agent-Session: https://cmux.com/deeplink/agent?id=aid-c5f7357864b9736bff29

* fix(lifecycle): drain discarded startups and retire page info windows

Agent-Session: https://cmux.com/deeplink/agent?id=aid-c5f7357864b9736bff29

* fix(tests): avoid throwing key path in browser retirement assertion

Agent-Session: https://cmux.com/deeplink/agent?id=aid-66d4d9063f5f1bfabf11

* fix(tests): preserve launcher endpoint reuse during teardown

Agent-Session: https://cmux.com/deeplink/agent?id=aid-66d4d9063f5f1bfabf11

* fix(tests): synchronize moved tab metadata before assertions

Wait for the destination daemon store through its existing sync barrier before inspecting moved tabs. Keep metadata assertions unchanged so a failed rename still fails the test.

Validation: prepush gate and diff check pass. Native Swift syntax is unavailable in this Linux lane; CrossMachine/Stash fleet rerun required. Prior fleet runs 0e700eba and da960326 failed the name assertion before this barrier.
Agent-Session: https://cmux.com/deeplink/agent?id=aid-66d4d9063f5f1bfabf11

* fix(tests): finish fresh launch teardown on cancellation

Propagate cancellation from the presentation wait, capture its error, and join owned daemon shutdown before rethrowing. Register window and directory cleanup before startup so their lifetime ends in order.

Validation: static prepush and diff checks pass. Swift syntax/native execution unavailable in the Linux lane; fleet regression and cumulative review requested.
Agent-Session: https://cmux.com/deeplink/agent?id=aid-66d4d9063f5f1bfabf11

* fix(tests): retain owned daemon cleanup on handshake failure

Record verified process identities and use the existing audit-token fallback when a shutdown handshake fails. Preserve state directories until every owned daemon exit is confirmed, and bound moved-tab synchronization and cancellation.

Validation: cmux-next prepush gate and diff check pass; native Swift compilation/runtime unavailable in this Linux lane. Fleet reruns and exact-head review required.
Agent-Session: https://cmux.com/deeplink/agent?id=aid-66d4d9063f5f1bfabf11

* fix(tests): avoid region checker error in barrier wait

Agent-Session: https://cmux.com/deeplink/agent?id=aid-66d4d9063f5f1bfabf11

* fix(tests): observe daemon exit by kernel identity

Agent-Session: https://cmux.com/deeplink/agent?id=aid-66d4d9063f5f1bfabf11

* test: preserve unverified daemon ownership after shutdown

Agent-Session: https://cmux.com/deeplink/agent?id=aid-66d4d9063f5f1bfabf11

* fix(tests): retain cancelled daemon ensures through teardown

Agent-Session: https://cmux.com/deeplink/agent?id=aid-66d4d9063f5f1bfabf11

* fix(tests): guard graceful shutdown by daemon ownership

Agent-Session: https://cmux.com/deeplink/agent?id=aid-e042f94599ebd6e0409f

* test: keep unverified daemon shutdown-free

Agent-Session: https://cmux.com/deeplink/agent?id=aid-e042f94599ebd6e0409f

* fix(tests): reuse verified daemon identity

Agent-Session: https://cmux.com/deeplink/agent?id=aid-e042f94599ebd6e0409f

* fix(tests): keep waiting when daemon identity is unreadable

Agent-Session: https://cmux.com/deeplink/agent?id=aid-66d4d9063f5f1bfabf11

* fix(daemon): await initial connect during close

Agent-Session: https://cmux.com/deeplink/agent?id=aid-e042f94599ebd6e0409f

* fix(daemon): cancel startup connection on teardown

Agent-Session: https://cmux.com/deeplink/agent?id=aid-e042f94599ebd6e0409f

* Fix cancellation of prestarted daemon connection

Agent-Session: https://cmux.com/deeplink/agent?id=aid-e042f94599ebd6e0409f

* Document cancellation cleanup ownership

Agent-Session: https://cmux.com/deeplink/agent?id=aid-e042f94599ebd6e0409f

* Document prestart cancellation ownership

Agent-Session: https://cmux.com/deeplink/agent?id=aid-e042f94599ebd6e0409f

* Add deterministic initial daemon task close regression

Agent-Session: https://cmux.com/deeplink/agent?id=aid-e042f94599ebd6e0409f

* Guard initial connect after concurrent close

Agent-Session: https://cmux.com/deeplink/agent?id=aid-e042f94599ebd6e0409f

* Allow reconnect attempts from waiting phase

Agent-Session: https://cmux.com/deeplink/agent?id=aid-e042f94599ebd6e0409f

* Cover reconnect attempts from waiting state

Agent-Session: https://cmux.com/deeplink/agent?id=aid-e042f94599ebd6e0409f

* Fix compile errors in the startup-close carry

connectOnce used a closure literal as a guard condition, which Swift does not
parse; move the phase check into an acceptsNewAttempt property. The reconnect
test's raw string opened with #""" and closed with """, so it never terminated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-159afad10a5ab45ea16c

* Port the test daemon owner to AcpmuxDaemonStop

#28083 removed AcpmuxUnresponsiveWatch from base and kept its process
identity check in AcpmuxDaemonStop (Daemon, kernelProcess, signal) with no
SIGKILL path. The test owner and its tests now read identities from
AcpmuxDaemonStop and keep their own bounded TERM-then-KILL teardown, built on
AcpmuxDaemonStop.signal so a reused pid is still never signalled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-159afad10a5ab45ea16c

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: cmux-bot[bot] <348531757+cmux-bot[bot]@users.noreply.github.com>

This branch was previously deployed

1 inactive deployment
ci-routing-agent — 2a72ab7e Deployed Oct 30, 2026 by teamleaderleo via namespace autofix #7324
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:normal Risk tier (docs/ci/risk-tiers.md)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant