Repository navigation
Record that cloud_vm_sessions.attachment_count is cumulative - #15321
Conversation
The column name reads like the number of clients attached right now, but upsertVmSession only ever adds to it and nothing decrements on detach, so it is a lifetime attach counter that never returns to zero. It is exposed verbatim as attachmentCount on GET /api/vm/[id]/sessions, where a reader would reasonably take it for a live viewer count and render a machine as having twelve people on it after one person attached twelve times. Document the semantics at the three places the value is defined, passed and published. No behavior change. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
All contributors have signed the CLA ✍️ ✅ |
|
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 configurationConfiguration used: Repository: manaflow-ai/cmux/.coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthroughComments clarify that ChangesAttachment count documentation
Priority: ⬇️ Low Estimated code review effort: 1 (Trivial) | ~2 minutes Change: Other Suggested reviewers: Merge Risk: ⚪ Minimal · up to This documentation-only change does not indicate a user-facing regression or a remaining merge-blocking risk. 🚥 Pre-merge checks | ✅ 24 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (24 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 |
Three corrections from the review of this PR: Stop saying "not a new value to store" on upsertVmSession's parameter. The insert branch does store it verbatim as the session's first count; only the conflict branch adds. The arithmetic agrees either way, but a reader who checked the code would conclude the comment was wrong. State both branches, and say the count must be positive, since nothing in the type or the SQL stops a negative argument from decrementing. Stop implying a detach handler exists that forgot to decrement. There is no session-detach writer in web/ at all, which is the actual reason the count only grows. Document the fourth hop. Sources/Cloud/VMClientSocketCommands.swift re-exports the value to socket clients as a bare "attachment_count", which is where a consumer is most likely to read it as a live count, so the note belongs on the VMCloudSession property every Swift caller resolves to. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Review subagent findings and how they were resolved, on head Review: the central claim holds. The review traced every writer of the column and confirmed the two branches of one statement in Fixed:
Left:
One naming hazard worth recording for the Cloud sidebar work: |
|
Dogfood build of cmux DEV pr-15321-68f7b3e6.app The link opens this exact commit in the cmux dev menu bar app. The build starts on each push and the page waits until it is ready; a newer push replaces it. It signs in against production, so Cloud or backend changes still need a tagged build with a development backend. |
|
Merging on green under the standing rule for fix PRs (skip team review, dogfood, merge on green). No fleet dogfood evidence on this one, and the reason is structural rather than a skipped step: #8029 turned off Vercel branch previews while keeping |
|
Merge receipt for |
0e298fb ci: wait for the product's canonical root instead of compiling beside it (manaflow-ai#15379) 3088273 ci: UI test runs adopt compile admission's product, skip the re-upload, and report progress (manaflow-ai#15331) b681e7e Keep a pending banner quiet once its pane is focused (manaflow-ai#15357) 03a2f6e Record that cloud_vm_sessions.attachment_count is cumulative (manaflow-ai#15321) 48258b4 fix(iroh-v2): check the team socket cap before opening the session (manaflow-ai#15340) 2638d56 Agent activity reorder follow-ups: group on-top check, search, subtitle (manaflow-ai#15362) 9ed83fd Dogfood journey: record whether a paused Cloud machine is asleep (manaflow-ai#15293) 7171ea8 Add app.tabBarVisibility to hide the pane tab bar when a pane has one tab (manaflow-ai#15294) 8743ec8 test: stop Computer Use onboarding tests waiting out the helper status deadline (manaflow-ai#15329) 6e4f1da ci: drain the snapshot's owned queue by what the machines finished since (manaflow-ai#15374) 9373164 ci: queue a pull request's admission for a root runner when Blacksmith's wait is longer (manaflow-ai#15376) 634a155 test: expect injected pane attention accent (manaflow-ai#15370) cd030e9 Keep a named Cloud machine's prompt name instead of flipping to its slug (manaflow-ai#15288) 24ee0ee Exit 1 when cmux terminal screen wait times out (manaflow-ai#15282) 1b857ac test: cover a live Codex turn owner keeping its turn on SessionStart (manaflow-ai#13588) 56ec600 PR media: prune media of long-closed pull requests (manaflow-ai#15364) 4898cde ci: bound the SwiftPM scratch holder and cache scratch sizes (manaflow-ai#15366) # Conflicts: # .github/workflows/ci-guards.yml # .github/workflows/ci.yml # .github/workflows/test-e2e.yml
Problem
cloud_vm_sessions.attachment_countreads like the number of clients attached to a session right now. It is not.upsertVmSessioninserts it at 1 and then only ever adds to it:Nothing decrements on detach, so the value never returns to zero. It is a lifetime attach counter.
The value is published verbatim as
attachmentCountbyGET /api/vm/[id]/sessionsand decoded straight intoVMCloudSession.attachmentCounton the app side. Nothing renders it today, so there is no user-visible bug to fix. The risk is the next reader: a Cloud sidebar or machine list that shows "attachments" would report a machine as having twelve people on it after one person attached twelve times, and that mistake would look correct in review because the field name says what the renderer assumed.Change
Comments at the three places the value is defined, passed and published, saying it is cumulative and must not be presented as a live viewer count. No behavior change, no schema change, no migration.
Verification
Comments only, so there is nothing to execute that could change. Disclosing what I did not run:
web/has no installed dependencies in this checkout, so I did not runbun x tsc --noEmitorbun run lint:complexitylocally; CI covers both, and a comment cannot affect either.I also did not add a test locking the cumulative semantics. The nearest coverage is in
web/tests/vm-workflows.test.ts, which assertsattachmentCount: 1after a single attach and so would still pass if the+became a plain assignment. A lock test would need a second attach against the DB-backed harness, and there is no local Postgres here to get a red-then-green result from. Worth a follow-up by someone who can run that suite locally.Changelog
none
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by cubic
Documents that
cloud_vm_sessions.attachment_countis a lifetime attach counter, not a live client count.upsertVmSessioninserts it at 1 and only ever adds to it, and there is no detach writer inweb/, so the value never returns to zero.Adds comments at the four places the value is defined, passed, and published (including the Swift socket re-export), clarifying that the insert branch stores the value verbatim while the conflict branch adds to it, and warning readers not to render it as a live viewer count. No behavior change.
Written for commit 68f7b3e. Summary will update on new commits.
Summary by CodeRabbit