Repository navigation
Harden long-uptime sidebar observation lifecycle (#7929) - #7954
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughAsyncStream publication now detects terminated continuations and removes them from both sidebar observation models. Tests cover pruning 2,000 terminated observers during runtime and settled process-title publications. ChangesObserver reconciliation
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related issues
Possibly related PRs
Suggested reviewers: Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (1 error)
✅ Passed checks (24 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Greptile SummaryThis PR hardens the sidebar observation lifecycle during long-running sessions. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (2): Last reviewed commit: "Keep sidebar observer registries model-o..." | Re-trigger Greptile |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Sources/WorkspaceSidebarAgentRuntimeObservationModel.swift`:
- Line 23: Change the changeObservers property declaration to use private(set),
preserving read access for tests while restricting registry mutations to the
owning model and its reconciliation logic.
In `@Sources/WorkspaceSidebarProcessTitleObservationModel.swift`:
- Line 26: Update the changeObservers property declaration in
WorkspaceSidebarProcessTitleObservationModel to use a private setter while
keeping its getter accessible, so tests can inspect the registry but only the
model can mutate observer membership.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: f5e86a13-35fd-4ac1-b0c2-ffdedfd66423
📒 Files selected for processing (3)
Sources/WorkspaceSidebarAgentRuntimeObservationModel.swiftSources/WorkspaceSidebarProcessTitleObservationModel.swiftcmuxTests/WorkspaceSidebarProcessTitleObservationTests.swift
Ported from upstream manaflow-ai#7954 (6f56acf): "Harden long-uptime sidebar observation lifecycle (manaflow-ai#7929) (manaflow-ai#7954)".
Summary
v0.64.17(9ed29d81a39de3ba44e0654bbcf6bf67ca86d1fb) through current main; the evidence and per-symptom verdict are posted on Main process pegs one CPU core + UI unresponsive after long uptime (AppleEvent quit times out, needs SIGTERM) #7929.AsyncStreamcontinuations cannot accumulate while deferred main-actor cleanup is starved.Root Cause And Scope
Both current-main sidebar observation models register continuations synchronously but remove them through a separate
Task { @MainActor ... }fromonTermination. Under main-actor saturation, terminated continuations remain in the registry and every later publication revisits them, increasing per-event work while cleanup falls further behind.Publication is now the authoritative reconciliation point: it checks each
yieldresult, removes every.terminatedentry after iteration, and preserves the existing unobserved-title replay semantics when no live observer accepted the change.onTerminationremains the prompt cleanup path when no later publication occurs. Registries expose internal read access with private setters so tests can inspect membership via@testablewhile each model remains the sole mutation owner.This lifecycle hazard was introduced in the post-0.64.17 replacement observation models, so this PR does not claim that it caused the original 0.64.17 incident. It prevents the replacement path from developing the same positive-feedback accumulation class.
Testing
0d87ddf4bf— focused run https://github.com/manaflow-ai/cmux/actions/runs/29216298609 executes 11 tests and fails both new burst cases with 2,000 terminated observers retained.fcda70c721— focused run https://github.com/manaflow-ai/cmux/actions/runs/29216298800 executes all 11 suite tests; both 2,000-observer cases pass in about 0.11 seconds.1d5f44342b8bf74652a2c6139340f7ad75a7acbc../scripts/lint-pbxproj-test-wiring.sh: passed, 449 test files checked.git diff --check: passed.python3 scripts/swift_file_length_budget.py: touched files are 82, 155, and 336 lines, below 500. The repository-wide command still reports five pre-existing overages on unchanged origin/main files; no budget TSV was changed.xcodebuildwere intentionally not run under the machine-safety constraints for Main process pegs one CPU core + UI unresponsive after long uptime (AppleEvent quit times out, needs SIGTERM) #7929.Demo Video
loginwindow, and the captured full-display diagnostic was black. No misleading video was produced.Localization Audit
No user-facing strings changed. The touched Swift files contain only internal observer bookkeeping, comments, and test failure text;
Resources/Localizable.xcstringsand web locale catalogs are unaffected.Review Trigger (Copy/Paste as PR comment)
Checklist
🤖 Generated with Claude Code (via cmux HQ dispatch).