Skip to content

Fix main compile: read matchingObservation after its declaration in Workspace restore check - #14130

Merged
teamleaderleo merged 1 commit into
mainfrom
fix-workspace-restore-order
Sep 24, 2026
Merged

teamleaderleo merged 1 commit into
mainfrom
fix-workspace-restore-order

Conversation

@azooz2003-bit

@azooz2003-bit azooz2003-bit commented Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator

Main does not compile: Sources/Workspace.swift:640:211: error: use of local variable 'matchingObservation' before its declaration. The Codex restore-intent early return (from 36c3050) was spliced onto the effectiveRestorableAgent guard line by a concurrent merge and reads matchingObservation, which is declared a few lines later. This moves the check directly below the declaration; the intervening statements only compute values, so the early return behaves as intended. Verified with a local tagged Debug build of the app target. Follows #14123 (the missing import from the same commit).

🤖 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 main not compiling: the Codex restore-intent early return read matchingObservation before its declaration. Moves the check below the declaration; the statements in between only compute values, so the early return behaves as intended.

Written for commit 85287d3. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Bug Fixes
    • Improved accuracy when determining whether an agent was active during session restoration.

… check

The Codex restore-intent early return landed on the same line as the
effectiveRestorableAgent guard and reads matchingObservation, which is
declared a few lines later, so main stopped compiling:
"use of local variable 'matchingObservation' before its declaration".
Move the check below the declaration. The intervening statements only
compute values, so the early return behaves exactly as intended.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@azooz2003-bit
azooz2003-bit enabled auto-merge (squash) September 24, 2026 03:48
@coderabbitai

coderabbitai Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

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

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 0b3e3856-9c92-4fd5-8f9d-10c8db0f290f

📥 Commits

Reviewing files that changed from the base of the PR and between afacff3 and 85287d3.

📒 Files selected for processing (1)
  • Sources/Workspace.swift

Included review availability: Your plan provides up to 10 included reviews per hour; 2 remain after this review.


📝 Walkthrough

Walkthrough

The agent-running heuristic now checks shouldPreserveAfterOwnerExit after confirming that an effective restorable agent exists. The matching-observation and runtime-process liveness fallback is unchanged.

Changes

Agent liveness

Layer / File(s) Summary
Restore-intent check ordering
Sources/Workspace.swift
The heuristic returns nil if no effective restorable agent exists. Otherwise, it checks whether to preserve restore intent before applying the unchanged liveness fallback.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 85287

The ordering fix addresses the reported build error without an identified change to session restore behavior. It is mergeable after normal checks.

🚥 Pre-merge checks | ✅ 24 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description clearly explains the compile error, the code change, the reason for the change, and the local build verification. It does not follow the required template structure and omits the Revie… Reformat the description using the repository template. Add Summary and Testing headings, include the Review Trigger block, and complete the Checklist with the applicable testing, coverage, documentation, bot-review, and comment-resolution …
✅ Passed checks (24 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: moving the matchingObservation read after its declaration to fix the compile error in Workspace.swift.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
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 Cloud Persistent Session And Early Input ✅ Passed PASS. The PR changes only Sources/Workspace.swift and moves the CodexTurnRestoreIntentPolicy check below the matchingObservation declaration. It does not change Cloud terminal creation, transpor…
Cmux Swift Actor Isolation ✅ Passed PASS: The authoritative diff changes only Sources/Workspace.swift and moves the existing CodexTurnRestoreIntentPolicy.shouldPreserveAfterOwnerExit call below the existing matchingObservation dec…
Cmux Swift Blocking Runtime ✅ Passed The production diff only moves the existing CodexTurnRestoreIntentPolicy.shouldPreserveAfterOwnerExit check below the matchingObservation declaration. It adds no semaphores, blocking waits, sleeps…
Cmux Browser Automation Off-Main ✅ Passed The pull request changes only Sources/Workspace.swift and moves the CodexTurnRestoreIntentPolicy restore-liveness check below matchingObservation declaration. It does not change browser socket c…
Cmux Expensive Synchronous Load ✅ Passed The authoritative diff changes only the placement and formatting of CodexTurnRestoreIntentPolicy.shouldPreserveAfterOwnerExit in Sources/Workspace.swift. It does not add or move `RestorableAgentSe…
Cmux Cache Substitution Correctness ✅ Passed The PR only moves the existing CodexTurnRestoreIntentPolicy.shouldPreserveAfterOwnerExit check below the declaration of matchingObservation. It does not replace a fresh authoritative read with a c…
Cmux No Hacky Sleeps ✅ Passed PASS: The pull request changes only Sources/Workspace.swift, a Swift source file. The diff only moves the CodexTurnRestoreIntentPolicy check below matchingObservation declaration. It introduces …
Cmux Algorithmic Complexity ✅ Passed PASS. The diff only moves the existing CodexTurnRestoreIntentPolicy.shouldPreserveAfterOwnerExit check below the local matchingObservation declaration in Sources/Workspace.swift. It adds no loop…
Cmux Swift Concurrency ✅ Passed PASS. The PR changes only Sources/Workspace.swift and moves the existing CodexTurnRestoreIntentPolicy.shouldPreserveAfterOwnerExit call below the matchingObservation declaration. The added lines…
Cmux Swift @Concurrent ✅ Passed The diff only moves a synchronous CodexTurnRestoreIntentPolicy.shouldPreserveAfterOwnerExit call below matchingObservation in Workspace.sessionPanelSnapshot. It adds or removes no async, `noni…
Cmux Swift Package Boundaries ✅ Passed The diff changes only Sources/Workspace.swift and moves an existing CodexTurnRestoreIntentPolicy check below the matchingObservation declaration. The call and policy logic already existed in the…
Cmux Swiftpm Lockfiles ✅ Passed The PR changes only Sources/Workspace.swift. The patch moves a restore-check statement and does not modify Package.swift, Package.resolved, .gitignore, an Xcode project package reference, a wo…
Cmux Swift Logging ✅ Passed PASS. The PR changes only the placement and formatting of an existing CodexTurnRestoreIntentPolicy.shouldPreserveAfterOwnerExit check in Sources/Workspace.swift. The diff adds no print, `debugPr…
Cmux User-Facing Error Privacy ✅ Passed The only pull-request change is in Sources/Workspace.swift: it moves a boolean CodexTurnRestoreIntentPolicy.shouldPreserveAfterOwnerExit check below the declaration of matchingObservation. It ad…
Cmux Full Internationalization ✅ Passed PASS. The pull request changes only Sources/Workspace.swift and moves an existing restore-intent check below the matchingObservation declaration. The diff adds no user-facing text, localization ke…
Cmux Swiftui State Layout ✅ Passed The PR changes only Sources/Workspace.swift and moves an existing CodexTurnRestoreIntentPolicy.shouldPreserveAfterOwnerExit call below the matchingObservation declaration. The diff adds no Swift…
Cmux Architecture Rethink ✅ Passed PASS — The PR changes only Sources/Workspace.swift and moves the existing CodexTurnRestoreIntentPolicy.shouldPreserveAfterOwnerExit check below the matchingObservation declaration. The diff adds…
Cmux Swift Auxiliary Window Close Shortcuts ✅ Passed PASS. The PR changes only restore-state logic in Sources/Workspace.swift: it moves the CodexTurnRestoreIntentPolicy.shouldPreserveAfterOwnerExit call below matchingObservation declaration. The d…
Cmux Source Artifacts ✅ Passed The diff changes only Sources/Workspace.swift. It moves the CodexTurnRestoreIntentPolicy check below the matchingObservation declaration. This is an intentional hand-written source change, not l…
Cmux No Test Or Debug Seam In Production Source ✅ Passed PASS. The PR changes only Sources/Workspace.swift and moves the existing CodexTurnRestoreIntentPolicy check below the matchingObservation declaration. Added lines contain no #if DEBUG block, t…
Full details: Description check

Explanation

The description clearly explains the compile error, the code change, the reason for the change, and the local build verification. It does not follow the required template structure and omits the Review Trigger and Checklist sections. A Demo Video is not needed because this is a compile fix rather than a UI or behavior change.

Resolution

Reformat the description using the repository template. Add Summary and Testing headings, include the Review Trigger block, and complete the Checklist with the applicable testing, coverage, documentation, bot-review, and comment-resolution items.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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

Copy link
Copy Markdown
Collaborator

GREAT CATCH I WILL JUST MERGE THISI ASAP

@teamleaderleo
teamleaderleo merged commit cce3e82 into main Sep 24, 2026
49 of 51 checks passed
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.

2 participants