Skip to content

test: repair session-restore, CLI, shell, and Cloud placement app-host tests - #13657

Merged
teamleaderleo merged 6 commits into
manaflow-ai:fix/app-host-greenfrom
teamleaderleo:fix/app-host-geom-session-cli
Sep 22, 2026
Merged

teamleaderleo merged 6 commits into
manaflow-ai:fix/app-host-greenfrom
teamleaderleo:fix/app-host-geom-session-cli

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Sep 22, 2026 •

Copy link
Copy Markdown
Collaborator

App-host repairs for the terminal/session/CLI/shell group, into fix/app-host-green (#13643). Failures are from #13403's CI run 35688876556.

Fixed

  • CloudPlacementCoordinator aDetachedTerminalDropsItsStaleTabBeforeMoving: test bug. c402b9c (Repair main's full macOS suite: package test compile and app-host regressions #13403) made the test install a daemon graph. When the placement lane drains, it reconciles against that graph, which predates the projected tab, and clears tab_projected. The real projection reply always carries a mutation cursor (CmuxTuiSnapshotParser.placedTab requires one), and that cursor fences this reconcile. The fake provider returned no cursor. It now takes a projectCursor, and the test sets it ahead of the installed graph.
  • TabManagerSessionSnapshotTests.testSessionSnapshotPersistsRemoteSurfaceProjectionsAndRestoreRelinksThem: stale test. After Fix Cloud display ownership and connection readiness #13196, validateOwnership refuses a workspace the app can't resolve. The test now registers the restored TabManager with LiveWorkspaceFixture.withAppRegistration, the same fix test: give Cloud catalog tests live destination workspaces #13651 uses.
  • ZshShellIntegrationHandoffTests.testShellIntegrationRelayPromptRefreshUsesRefreshReasonInZsh: test bug. Since Add first-class Mosh transport for remote workspaces #8442, precmd also sends report_shell_state, from a separate background child. The test waited only until the log was non-empty, so it could see that line alone. It now waits, with a deadline, for the ports_kick line itself. The bash sibling test gets the same fix.
  • CLINotifyProcessIntegrationRegressionTests.testDefaultFreestyleSSHAttachRelaysAfterDelayedSuccessfulCredential: product bug. For the first 2 s after sending the password, the expect wrapper watches for a rejection with log_user 0. A session that authenticates and exits inside that window hits the eof branch, and its output was dropped. The CLI now flushes expect_out(buffer) before it exits. Fix CLI notify integration regression tests #13207 replaced the test's sleep 9 with a FIFO release, which is what exposed the bug.
  • CLINotifyProcessIntegrationRegressionTests.testVMDevRejectsBadInputBeforeAnyRequest: test regression. Fix CLI notify integration regression tests #13207 dropped 4120e35's expectsSocketConnection: false path. Each rejected run then waited 60 s on a mock expectation that only the listener closing fulfills, and the listener closes after the wait. That path is restored: the listener stays open and its backlog is checked with a non-blocking accept after the CLI exits.
  • Cloud SCP with OpenSSH transferUsesRealSFTPAndChecksTheHostKey: test bug, not a host dependency. The test starts its own /usr/sbin/sshd, and every other scenario passed on the runner. The terminal case (Fix idle Cloud SCP watches and report local transfer failures #12759) read the pty master only after the CLI exited. A pty holds about 1 KiB, the host-key failure report is longer, and the CLI blocked on stderr until the 30 s timeout. A thread now drains the master while the CLI runs.

Already fixed by #13651: "Restoring a Cloud terminal reserves a manual mirror instead of a local shell".

Not failing in the latest run: CloudManualMirrorPresentation, CloudManualMirrorTransport, CloudNativeLayoutProjection, CmuxTuiSurfaceProviderRegistryPolling.

Left open: these need an app-host run to diagnose, and there's no evidence yet for a fix.

  • offPlanGeometryWithUnchangedSizingInputsReconverges: fails every run (%1 plan=320x450 view=511x450, rearms=3). All three recovery passes re-impose the extent, but the bonsplit divider stays at the perturbed 0.8. The mirror code hasn't changed since July. The last bonsplit bump was Prevent terminal flicker and delayed nested layout on workspace switches #12310 (faf8418, new resizeSubviewsWithOldSize).
  • workspaceRevealKeepsTerminalSizeUntilAnUnchangedGeometryPass: flaky. It passed in 35666501009 and failed in 35688876556: the final resize to 360 never published a smaller native size within 5 s.
  • WorkspaceTerminalFocusRecoveryTests.testTerminalFirstResponderFeedbackPreservesActiveFocusTransaction: fails every run. The surface never becomes first responder. Other focus suites show the same symptom: WorkspaceTerminalFocusRecoverySwiftTests and TerminalNotificationDirectInteractionTests.

swiftc -parse passes on every changed Swift file. check-test-determinism.py --strict and lint-pbxproj-test-wiring.sh are clean. The expect eof flush was reproduced and verified locally with /usr/bin/expect, and the pty drain with a 20 KB writer.

🤖 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

Repairs app-host test failures across session-restore, CLI, shell, and Cloud placement, and fixes a CLI bug where an SSH session that authenticated and exited right away dropped its output.

Bug Fixes

  • The SSH expect wrapper now flushes expect_out(buffer) on eof before exiting, so a session that authenticates and ends inside the two-second rejection watch still prints its output.

Test Fixes

  • The Cloud placement test sets a mutation cursor on the fake projection reply so the reconcile can't clear the projected tab.
  • The session-restore test registers the restored window with the app before relinking projections.
  • Shell relay tests wait for the surface.ports_kick line itself instead of any relay line.
  • The invalid vm dev input test keeps the listener open and checks its backlog after the CLI exits, instead of waiting on a mock expectation that only closes after the timeout.
  • The SCP pty test drains the terminal master while the CLI runs, preventing stderr from blocking past the timeout.

Written for commit bafd6c3. Summary will update on new commits.

Review in cubic

teamleaderleo and others added 6 commits September 22, 2026 09:36
aDetachedTerminalDropsItsStaleTabBeforeMoving installs a daemon graph
since c402b9c (manaflow-ai#13403). When the placement lane drains it reconciles
against that graph, which predates the projected tab, and clears
tab_projected. The real reply always carries a mutation cursor
(CmuxTuiSnapshotParser.placedTab requires one) that fences exactly this;
the fake returned none. Give the fake a projectCursor and set it ahead
of the installed graph.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
manaflow-ai#13196 made SurfaceCatalog.validateOwnership refuse a destination the app
cannot resolve, so SurfaceCatalog.shared no longer relinked a restored
projection into a TabManager that no main window owns. Register it for
the test body with LiveWorkspaceFixture.withAppRegistration, as manaflow-ai#13651
does for CloudClosedPanelRestoreTests.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Since manaflow-ai#8442, a relay prompt also reports shell state. Both RPCs run in
separate background children, and the zsh prompt-refresh test waited
only until the log was non-empty, so it could read report_shell_state
alone. Wait (deadline-bounded) for the ports_kick line itself, in the
zsh test and its bash sibling.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The expect wrapper watches the first two seconds after sending the
password for a rejection with log_user 0. A session that authenticates
and exits inside that window hit the eof branch and its output was
dropped. Flush the buffered output before exiting. manaflow-ai#13207 replaced the
test's 9 s sleep with a FIFO release, which is what exposed this.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
4120e35 taught runVMDev that invalid input never connects: keep the
listener open, then check its backlog after the CLI exits. manaflow-ai#13207 dropped
that again, so each rejected run waited 60 s for a mock-server
expectation that only the listener closing (after the wait) fulfills.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The pty case read the master only after the CLI exited. A pty's output
queue holds about 1 KiB and the host-key failure report is longer, so the
CLI blocked writing stderr until the 30 s timeout. Read the master on a
thread while the CLI runs. The test starts its own sshd; no runner host
dependency is involved.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 22, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository: manaflow-ai/cmux/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 4560d4ba-0efa-422d-b097-05d544cfc533

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@teamleaderleo
teamleaderleo merged commit f7132b3 into manaflow-ai:fix/app-host-green Sep 22, 2026
36 checks passed
@teamleaderleo
teamleaderleo deleted the fix/app-host-geom-session-cli branch September 23, 2026 11:35
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