Skip to content

fix: include lease scope in Metro bridge calls#408

Merged
thymikee merged 1 commit intomainfrom
codex/metro-bridge-lease-scope
Apr 13, 2026
Merged

fix: include lease scope in Metro bridge calls#408
thymikee merged 1 commit intomainfrom
codex/metro-bridge-lease-scope

Conversation

@thymikee
Copy link
Copy Markdown
Contributor

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.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 13, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://callstackincubator.github.io/agent-device/pr-preview/pr-408/

Built to branch gh-pages at 2026-04-13 15:30 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +130 to +131
const bridgeScope = readCompanionScope(parsed.bridgeScope);
if (!bridgeScope) return null;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@thymikee thymikee force-pushed the codex/metro-bridge-lease-scope branch from a6bc1d3 to f3a02c7 Compare April 13, 2026 15:24
@thymikee thymikee force-pushed the codex/metro-bridge-lease-scope branch from f3a02c7 to 7a0b5d1 Compare April 13, 2026 15:29
@thymikee thymikee merged commit e99bbb5 into main Apr 13, 2026
9 of 10 checks passed
@thymikee thymikee deleted the codex/metro-bridge-lease-scope branch April 13, 2026 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant