Repository navigation
Re-land #16397: initialize Cloud VM account pools (migration applied first) - #16572
Conversation
Reverts #16405. #16397 was reverted because its migration 20261001000000_coderouter_vm_pool_initialization was never applied to staging or production, so every Cloud VM create failed. This re-land merges only after that migration is applied to staging and production. Co-Authored-By: austinywang <austinywang@users.noreply.github.com> 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. Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: Repository: manaflow-ai/cmux/.coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (4)
✨ 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 |
There was a problem hiding this comment.
1 issue found across 4 files
You’re at about 91% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="web/services/coderouter/repository.ts">
<violation number="1" location="web/services/coderouter/repository.ts:475">
P1: These grant queries reread `vm.coderouter_pool_id` after the marker statement, so a concurrent same-team pool reassignment can mark the default pool initialized but grant every shared account to the VM’s new custom pool. Use the pool ID returned by the marker for both inserts, or lock and revalidate the VM’s pool.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
|
||
| await tx.execute(sql` | ||
| insert into coderouter_pool_accounts (team_id, pool_id, account_id, granted_by_user_id) | ||
| select vm.owner_team_id, vm.coderouter_pool_id, account.id, account.created_by |
There was a problem hiding this comment.
P1: These grant queries reread vm.coderouter_pool_id after the marker statement, so a concurrent same-team pool reassignment can mark the default pool initialized but grant every shared account to the VM’s new custom pool. Use the pool ID returned by the marker for both inserts, or lock and revalidate the VM’s pool.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At web/services/coderouter/repository.ts, line 475:
<comment>These grant queries reread `vm.coderouter_pool_id` after the marker statement, so a concurrent same-team pool reassignment can mark the default pool initialized but grant every shared account to the VM’s new custom pool. Use the pool ID returned by the marker for both inserts, or lock and revalidate the VM’s pool.</comment>
<file context>
@@ -449,6 +450,47 @@ export async function issueVmAuthorizationToken(
+
+ await tx.execute(sql`
+ insert into coderouter_pool_accounts (team_id, pool_id, account_id, granted_by_user_id)
+ select vm.owner_team_id, vm.coderouter_pool_id, account.id, account.created_by
+ from cloud_vms vm
+ join coderouter_accounts account on account.team_id = vm.owner_team_id
</file context>
|
Merge receipt for |
0bfd027 test(cloud): fix the Cloud header and moved-panel focus tests that never ran (manaflow-ai#16539) c5c4345 localization: accept numbered placeholders in any order (manaflow-ai#16376) 456edeb fix(settings): replace custom sidebar mockups with real previews (manaflow-ai#16569) 98dc3ab Prototype: cmux Cloud as a remote MCP server (manaflow-ai#16568) 6c22525 test(remote): isolate tmux stale-surface fixture (manaflow-ai#16566) 3ec9918 Re-land "fix(coderouter): initialize Cloud VM account pools (manaflow-ai#16397)" (manaflow-ai#16572) 2b895a5 Fix browser paste routing with terminal text box beta (manaflow-ai#6380) (manaflow-ai#16560) 2bd3455 localization: check Swift defaultValue literals against their catalog en value (manaflow-ai#16396) c43086e test(cli): expect --mark-read to mark every listed inbox message (manaflow-ai#16537) fcda4f0 test(feed): wait for zero-wait Codex permission acceptance before checking attention (manaflow-ai#16536) 7d57a03 fix(remote): evict stale persistent SSH bridge leases (manaflow-ai#16558) d630cb8 docs: add protected-folder diagnostics for tmux sessions (manaflow-ai#12219) 7dceaac test: create cwd fixtures that new terminals now resolve on disk (manaflow-ai#16538) 28cc575 docs: cover surface resume binding CLI contract (manaflow-ai#16473) 5c7dca1 Fix idle zsh PR probes triggering chpwd hooks (manaflow-ai#16553) # Conflicts: # .github/workflows/ci-guards.yml
Re-lands #16397 (austinywang), which #16405 reverted after a production outage: every Cloud VM create failed with
model_plane_unavailablefrom 2026-10-01 08:44 to 15:47 UTC (30 of 30), because migration20261001000000_coderouter_vm_pool_initializationwas never applied.The code and migration are unchanged from #16397. The difference is ordering:
staging, thenmain(production), withbun run cloud-vm:migrate -- <target>. Verified read-only first: it is the only pending migration on both branches, and the runner selects pending migrations by name, so its earlier folder timestamp does not cause a skip.coderouter_pool_initializationsexists in production.Verification:
bun scripts/db-migrate.mjstwice on a fresh Postgres 16 (the CI path), then everycoderouter-*db-behaviorsuite: 73 pass, 0 fail, including #16397's own regression test.bun test tests/coderouter-*: 553 pass, 0 fail. Typecheck clean.🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by cubic
Re-lands Cloud VM account pool initialization, which the previous revert removed after a production outage: Cloud VM creates failed with
model_plane_unavailablebecause the migration had not been applied. This re-land is identical but merges only after the migration is applied to staging and production.coderouter_pool_initializationsto mark pools that already received their initial snapshot of the team's shared accounts.Written for commit 45c9eec. Summary will update on new commits.
Summary by CodeRabbit