Skip to content

Fix SSH retry script compiler timeout - #9213

Merged
austinywang merged 1 commit into
mainfrom
hotfix-ssh-retry-script-typecheck
Jul 30, 2026
Merged

austinywang merged 1 commit into
mainfrom
hotfix-ssh-retry-script-typecheck

Conversation

@austinywang

@austinywang austinywang commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Root cause

PR #9083 introduced one large expression combining array literals and computed arrays through multiple overloaded + operations. Swift cannot type-check that expression in reasonable time, so every macOS compilation lane fails in SSHPTYAttachRetryScriptBuilder.swift. Automatic full CI was paused, and the workflow guard outage hid the macOS lanes, so the merge showed only bots and scanners instead of a compile failure.

Verification

  • the changed file is byte-identical to the compiler fix already exercised in commit 74ab86da6c8e
  • existing SSHPTYAttachRetryScriptBuilderTests cover generated content and ordering
  • the CI integration ref combines this commit with Fix Ghostty Zig workflow guard false positives #9209 so macOS jobs can execute
  • no local Xcode build or XCUITest was run
  • no Swift budget TSV changes

Depends on #9209 to restore the macOS CI fan-out on main.


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 a Swift type-check timeout in the SSH retry script builder by switching from chained array concatenations to incremental appends. This preserves all script lines and ordering and unblocks macOS builds.

Written for commit 73364be. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Refactor
    • Reorganized internal script construction while preserving the generated retry behavior and output.
    • No user-visible functionality or public interfaces were changed.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 398f73cf-8365-4f9f-9f95-47f238c0fb84

📥 Commits

Reviewing files that changed from the base of the PR and between bddbd49 and 73364be.

📒 Files selected for processing (1)
  • Packages/macOS/CmuxFoundation/Sources/CmuxFoundation/SSHPTYAttachRetryScriptBuilder.swift

📝 Walkthrough

Walkthrough

SSHPTYAttachRetryScriptBuilder now constructs the generated retry script incrementally, appending configuration, authentication state, backoff state, wait lines, and the closing done before returning the accumulated lines.

Changes

SSH retry script construction

Layer / File(s) Summary
Incremental script line builder
Packages/macOS/CmuxFoundation/Sources/CmuxFoundation/SSHPTYAttachRetryScriptBuilder.swift
The method builds a mutable line array, appends configuration and retry state in separate steps, then appends backoff wait lines and the closing done before returning.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related issues

  • manaflow-ai/cmux-dev-artifacts#7057 — Addresses the same script-construction refactor pattern intended to resolve Swift type-checking failures.
  • manaflow-ai/cmux-dev-artifacts#7059 — Directly concerns refactoring SSHPTYAttachRetryScriptBuilder.swift to resolve the related Swift type-checking failure.

Possibly related PRs

  • manaflow-ai/cmux#9083 — Modifies the same retry-loop generation logic in SSHPTYAttachRetryScriptBuilder.lines(command:reauthenticates:).
🚥 Pre-merge checks | ✅ 24 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers summary and verification, but it misses the template's Testing, Demo Video, Review Trigger, and Checklist sections. Add the missing template sections, especially a clear Testing section, the Review Trigger block, and the Checklist items.
✅ Passed checks (24 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main fix: a Swift SSH retry script compiler timeout.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Cmux Swift Actor Isolation ✅ Passed The diff only swaps array concatenation for append(contentsOf:) in a pure Sendable value builder; no MainActor, shared mutable state, or UI-store isolation changes.
Cmux Swift Blocking Runtime ✅ Passed Diff only refactors Swift array construction; no new blocking waits, sleeps, locks, or sync primitives were introduced or expanded.
Cmux Browser Automation Off-Main ✅ Passed Diff only touches SSHPTYAttachRetryScriptBuilder.swift; no browser automation commands, main-actor routing, or worker-router policy changes are present.
Cmux Expensive Synchronous Load ✅ Passed Diff only refactors SSH retry script line assembly; it adds no agent-history loads, JSON parses, or main-actor synchronous work.
Cmux Cache Substitution Correctness ✅ Passed The patch only rewrites SSH retry script string assembly; it does not replace a fresh read with a cache in any persistence/history/undo/snapshot path.
Cmux No Hacky Sleeps ✅ Passed Only a Swift builder changed; the runtime-no-hacky-sleeps rule is out of scope, and the diff adds no sleep/timer/polling hacks.
Cmux Algorithmic Complexity ✅ Passed Only a fixed-size shell-line array was refactored to append(contentsOf:); no scalable scans or repeated work were introduced.
Cmux Swift Concurrency ✅ Passed The diff only refactors shell-line array construction in SSHPTYAttachRetryScriptBuilder; it adds no Dispatch/Combine/Task/completion-handler async patterns.
Cmux Swift @Concurrent ✅ Passed PASS: The only touched Swift code is a synchronous pure builder; no async/nonisolated/@Concurrent changes or UI-isolation call sites are introduced.
Cmux Swift Package Boundaries ✅ Passed PASS: The diff only touches Packages/macOS/CmuxFoundation/Sources/CmuxFoundation, a small SwiftPM leaf package with dedicated tests; no app-target domain logic was added.
Cmux Swiftpm Lockfiles ✅ Passed PR only changes SSHPTYAttachRetryScriptBuilder.swift; no .gitignore, workflow, Package.swift, or Package.resolved files were touched, so the lockfile policy isn’t violated.
Cmux Swift Logging ✅ Passed The diff only refactors array construction; it adds no Swift logging APIs and preserves the existing CLI retry printf unchanged.
Cmux User-Facing Error Privacy ✅ Passed Only internal Swift array construction changed; the user-visible reattaching message and other output strings are unchanged and generic.
Cmux Full Internationalization ✅ Passed The PR only refactors one Swift builder file; no locale/catalog files changed, and the existing localized key already exists in Resources/Localizable.xcstrings.
Cmux Swiftui State Layout ✅ Passed The only changed file is a Foundation shell-script builder; no SwiftUI, ObservableObject/@published, GeometryReader, list rows, or render-time state mutation appear.
Cmux Architecture Rethink ✅ Passed Only a local script-builder refactor: array concatenation became append(contentsOf:); no sleeps, observers, duplicate wiring, or split ownership were introduced.
Cmux Swift Auxiliary Window Close Shortcuts ✅ Passed PR only refactors SSHPTYAttachRetryScriptBuilder; no NSWindow/NSPanel/WindowGroup or cmuxAuxiliaryWindowIdentifiers changes appear in the diff.
Cmux Source Artifacts ✅ Passed Only a hand-written Swift source file changed; no local/generated artifacts or scratch paths were added.
Cmux No Test Or Debug Seam In Production Source ✅ Passed The only production-source change is an array-building refactor; no #if DEBUG, test-only, or debug seam members were added.
Cmux No Ambient Global State ✅ Passed Diff only refactors SSHPTYAttachRetryScriptBuilder.lines() internals; no new file-scope func/var, namespace type, or singleton was added.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch hotfix-ssh-retry-script-typecheck

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.

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