fix: include lease scope in Metro bridge calls#408
Conversation
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a6bc1d313a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
src/client-metro-companion.ts
Outdated
| const bridgeScope = readCompanionScope(parsed.bridgeScope); | ||
| if (!bridgeScope) return null; |
There was a problem hiding this comment.
Terminate legacy companion before rejecting stale state
Returning null when bridgeScope is absent makes legacy companion state files (written before this commit) look like “no process exists,” so ensureMetroCompanion skips stopCompanionProcess and spawns a second worker for the same profile. Because workers only self-terminate when the state file is removed, the old unscope-aware worker can keep running alongside the new one, creating duplicate registration/retry traffic and possible bridge contention until disconnect cleanup happens.
Useful? React with 👍 / 👎.
a6bc1d3 to
f3a02c7
Compare
f3a02c7 to
7a0b5d1
Compare
Summary
Include the active tenant/run/lease scope in Metro cloud bridge request bodies.
Require bridge scope for proxy-backed Metro prepare and companion worker registration, invalidating old companion state that lacks scope.
Update CLI/public Metro plumbing and tests for the scoped bridge contract.
Touched-file count: 17. Scope stayed within the Metro remote bridge/connection path.
Validation
pnpm format
pnpm vitest run src/tests/client-metro.test.ts src/tests/client-metro-auto-companion.test.ts src/tests/client-metro-companion-worker.test.ts src/tests/client-metro-companion.test.ts src/tests/remote-connection.test.ts src/tests/cli-client-commands.test.ts src/tests/metro-public.test.ts
node --test test/integration/smoke-open-remote-config.test.ts
pnpm check:quick
pnpm build
Known gaps: no direct/expo/resolve/probe Metro endpoint call sites exist in this repo to update.