Repository navigation
Fix aggregate memory attribution across workspaces - #9086
Conversation
Bugbot is paused — on-demand spend limit reachedBugbot uses usage-based billing for this team and has hit its on-demand spend limit. A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue. |
📝 WalkthroughWalkthroughMemory diagnostics now model ownership explicitly, classify groups as common, multiple, partial, or unattributed, and propagate localized attribution through task-manager and CLI output. New tests cover multi-workspace groups and common-owner resolution. ChangesMemory attribution
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related issues
Possibly related PRs
Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (2 errors, 1 warning)
✅ Passed checks (22 passed)
✨ Finishing Touches 💡 1📝 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 |
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 6
🤖 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 `@cmuxTests/CMUXCLIMemoryAttributionTests.swift`:
- Around line 29-30: Update the assertions in CMUXCLIMemoryAttributionTests to
verify the expected group-level label, and reject any output containing the
workspace workspace: attribution prefix rather than only workspace:1. Ensure
regressions selecting either workspace are rejected while preserving the
existing two-workspace assertion.
- Around line 2-5: Move
testMemoryCommandLabelsMultiWorkspaceGroupWithoutSingleOwner from
CMUXCLIMemoryAttributionTests.swift into the existing
CMUXCLIErrorOutputRegressionTests suite file. Remove the separate extension file
and keep the suite’s imports and test declarations centralized so Swift Testing
discovers the test through the single suite definition.
- Around line 14-18: Make the memory attribution label assertion deterministic
by configuring the CLI’s locale-related environment variables to English in the
test setup near the CMUX_ environment cleanup, or derive the expected label from
the English localization source. Ensure the assertion remains independent of the
host process locale.
In `@Sources/CmuxTaskManagerMemoryGroupAttribution.swift`:
- Line 10: Change the initializer parameter in the payload initializer to a
non-optional [String: Any]. Update its call site in CmuxTaskManagerMemoryGroup
to pass payload["group_attribution"] as? [String: Any] ?? [:], preserving the
existing handling of missing or empty attribution data.
In `@Sources/CmuxTopMemoryDiagnosticGroupAccumulator.swift`:
- Around line 5-37: Update the attributions aggregation to key its dictionary by
attribution.owner rather than the full CmuxTopProcessAttribution, while
retaining one representative attribution for each owner when producing payloads.
Ensure processes with different reason values but the same
workspace/pane/surface owner accumulate into one bucket, preserving the existing
RSS, process count, and PID aggregation behavior in AttributionAccumulator.
In `@Sources/CmuxTopProcessOwner.swift`:
- Around line 43-137: Update CmuxTopProcessOwner construction or commonOwner to
normalize and compare workspace identifiers across ID and ref representations,
so a workspaceID-only owner merges with a workspaceRef-only owner when they
identify the same physical workspace. Preserve the existing grouping behavior
for genuinely different or missing workspace identities, and ensure the
normalized workspaceID/workspaceRef values are carried into the returned owner.
🪄 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 Plus
Run ID: 7d5cc070-ffe1-4f13-b97c-5a9f4f4f3c0d
📒 Files selected for processing (16)
CLI/CMUXCLI+Memory.swiftCLI/CMUXCLI+MemoryAttribution.swiftResources/Localizable.xcstringsSources/CmuxTaskManagerMemoryAttribution.swiftSources/CmuxTaskManagerMemoryGroup.swiftSources/CmuxTaskManagerMemoryGroupAttribution.swiftSources/CmuxTopMemoryDiagnosticGroupAccumulator.swiftSources/CmuxTopMemoryDiagnostics.swiftSources/CmuxTopProcessAttribution.swiftSources/CmuxTopProcessOwner.swiftSources/TaskManagerSnapshot.swiftSources/TaskManagerTypes.swiftSources/TerminalControllerTopSupport.swiftcmux.xcodeproj/project.pbxprojcmuxTests/CMUXCLIMemoryAttributionTests.swiftcmuxTests/CmuxTopMemoryAttributionTests.swift
💤 Files with no reviewable changes (1)
- Sources/TaskManagerTypes.swift
|
Addressing the remaining CodeRabbit summary items:
All six inline findings were separately fixed or answered and their threads are resolved. Full CI run 30407620070 is green, including unit shards, Swift packages, build/lag, universal Release, and final ci-status. |
Summary
cmux memoryand Task Manager without targeting one arbitrary workspacetop_attributionin the socket payload for backward-compatible diagnostic detailRegression coverage
ab3bbb2a7fadds the failing producer, Task Manager, and bundled CLI behavior tests921d783eb7implements the fixValidation
xcrun swiftc -parsefor all changed Swift sources and testsxcrun swiftc -typecheck Sources/CmuxTopProcessOwner.swift Sources/CmuxTopProcessAttribution.swift./scripts/lint-pbxproj-test-wiring.sh./scripts/check-pbxproj.shjq empty Resources/Localizable.xcstringsscripts/swift_file_length_budget.pyand.github/swift-file-length-budget.tsvare absent from the base revision; every new Swift file is under 150 lines and every modified existing Swift file is shorter than its baselineCloses #9069
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by cubic
Fixes memory attribution for command groups by aggregating across all members, not just the largest process. Multi‑workspace groups now show “multiple owners” or “N workspaces” in
cmux memoryand Task Manager; single‑owner groups show the common workspace/pane/surface. Addresses #9069.Bug Fixes
group_attribution; kepttop_attributionfor compatibility.memory.attribution.*strings to render “multiple owners”, “%lld workspaces”, and “partially attributed”; falls back totop_attributionif needed.Refactors
CmuxTopProcessOwnerandCmuxTopProcessAttributionwith common‑owner logic and specificity; extractedCmuxTopMemoryDiagnosticGroupAccumulatorand exposed its initializer.CmuxTaskManagerMemoryGroup,CmuxTaskManagerMemoryGroupAttribution, andCmuxTaskManagerMemoryAttributiondecoders; moved CLI attribution code toCMUXCLI+MemoryAttribution.swift.Written for commit b34c4c3. Summary will update on new commits.
Summary by CodeRabbit
New Features
Bug Fixes
Tests