Skip to content

fix(daemon): match --device in session binding check like device selection - #3159

Merged
thymikee merged 1 commit into
callstack:mainfrom
okwasniewski:oskar/android-avd-selector-display-name
Oct 3, 2026
Merged

thymikee merged 1 commit into
callstack:mainfrom
okwasniewski:oskar/android-avd-selector-display-name

Conversation

@okwasniewski

@okwasniewski okwasniewski commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

From e2e feedback: --device Pixel_7_API_36 selects the emulator displayed as "Pixel 7 API 36", but reusing that selector on a session already bound to it failed with INVALID_ARGS ("Session ... is already bound"). Device selection normalizes names (case, _ vs space, whitespace) while the session binding check compared raw lowercase strings.

Kernel now exports matchesDeviceNameSelector, and both device selection and the session binding conflict check use it, so a name that selected a device keeps matching it.

3 files touched.

Validation

Tested commit: a5d8b72 (on upstream/main 9a245d0).

  • pnpm vitest run src/daemon/__tests__/session-selector.test.ts: 13 passed (AVD-style selector accepted on bound session; a different name still conflicts)
  • pnpm check:affected --run --base upstream/main: all runnable checks passed (959 files / 8688 related tests, daemon wire compat unchanged protocol).
  • Live, Pixel_7_API_36 emulator (pre-rebase head): before, second open --session p7 --device Pixel_7_API_36 returned INVALID_ARGS; after, it succeeds; a different --device is still rejected.

Review in cubic

…ction

AVD selector Pixel_7_API_36 selected device "Pixel 7 API 36" but the
bound-session check compared raw lowercase strings and rejected the
same selector on the next open. Share matchesDeviceNameSelector from
kernel between selection and session binding.
Copilot AI balanced review requested due to automatic review settings October 3, 2026 12:16

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 3 files

Re-trigger cubic

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The focused change preserves device selection behavior and covers the session-binding fix with a regression test.

Review effort: Balanced
Findings: None

What changed in this PR

Makes session binding use the same device-name normalization as device selection, allowing consistent reuse of --device selectors.

Changes:

  • Exports and reuses a shared device-name matcher.
  • Adds regression coverage for underscore-separated AVD names.
File Description
src/​daemon/​session-selector.ts Uses the shared matcher for binding checks.
src/​daemon/​__tests__/​session-selector.test.ts Tests AVD-name selection and session reuse.
packages/​kernel/​src/​device.ts Extracts the matcher without changing selection semantics.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@thymikee

thymikee commented Oct 3, 2026

Copy link
Copy Markdown
Member

This PR is ready at a5d8b72. The repeated-open binding check in src/daemon/session-selector.ts now accepts the same --device spellings that device selection accepts, and I found no problem in the change.

Not blocking: resolveExplicitShardDevices in packages/replay-port/src/daemon-port/session-test-shard-devices.ts still has its own copy of normalizeDeviceName and the name-equality check, so a later change to the kernel matcher will not reach the shard path. A follow-up could call matchesDeviceNameSelector from @agent-device/kernel/device and drop the local copy. Take it or leave it.

There are no conflicts. Both Smoke Tests jobs were still running when I looked, so I cannot attribute a result yet. The diff only touches their route through the repeated-open binding check, and it only accepts more spellings of the same name. I did not run the unit tests locally, and I could not re-run the Pixel_7_API_36 check, which was done on the pre-rebase head. Once both Smoke Tests jobs finish green, this can merge with no code change needed.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Oct 3, 2026
@thymikee
thymikee merged commit d31ff54 into callstack:main Oct 3, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants