Repository navigation
test(relay): prove the pending-conn capability header reaches acceptControl - #19274
Conversation
… real upgrade The unit tests cover parseRelayHostCapabilities, the sendHelloAck gating, and the header literal separately, but nothing joined them: a typo in the header name read off the upgrade request passed the entire suite. This drives a real control upgrade carrying the header, leaves an invite connection pending, and asserts the rebound control's ack. Renaming the header the server reads fails it.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthroughRelay black-box tests now import host capability constants. The Merge Risk: ⚪ Minimal · up to This change adds end-to-end coverage that capability-aware relay hosts receive pending-connection details during control rebinding while legacy hosts retain the existing response. No current merge-blocking risk is identified. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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.
✅ No new issues found.
Reviewed changes
openHostControlgains an optionalcapabilitiesargument — spreads theRELAY_HOST_CAPABILITIES_HEADERheader onto the control upgrade when supplied, so a case can advertise capabilities over the wire.- New blackbox case pins the header→
acceptControllink — creates an invite, leaves a phone connection pending, then rebinds the control twice (with and withoutRELAY_HOST_CAPABILITY_PENDING_CONN_DETAILS) and asserts the detailed vs legacypendingConnsack shape.
I traced the full path the test exercises: relay-server.ts:492 reads the header and passes it to sessions.acceptControl, which stores it per-socket in hostCapabilities (host-session-registry.ts:567), and sendHelloAck (host-session-registry.ts:1197) gates the kind/relayDeviceId fields on it. The test closes the exact gap identified in #19266 — a misspelled header name would otherwise leave the whole suite green — and both assertions (toEqual on the exact object shape) would catch that, as the mutation check in the PR description demonstrates. The no-header rebind assertion additionally proves the capability is per-upgrade rather than sticky across rebinds, which is the correct contract.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

ELI5
#19266 taught the relay to send extra detail about a waiting connection, but only to a desktop that asked for it by setting a header. Every piece of that was tested on its own, and nothing tested them joined together. If someone mistyped the header name the relay reads, all the tests still passed and the feature would just quietly stop working. This adds the one test that would catch that.
What Changed
Test-only. One case added to
cloud/apps/relay/src/relay.blackbox.test.ts, plus an optionalcapabilitiesargument on that file's existingopenHostControlhelper so a case can set the upgrade header.The case drives a real control upgrade against a real relay process, creates an invite, connects a phone and never attaches a data socket so the connection stays pending, then rebinds the control twice and asserts the ack:
x-orca-host-capabilities: pending-conn-details—pendingConnsis[{connId, connTicket, kind: 'invite', relayDeviceId: 'capability-device'}][{connId, connTicket}]Why
Follow-up to #19266, from a review finding on that PR:
That is accurate. The finding arrived after #19266 had already merged, so it lands here instead.
This matters more than a normal coverage gap because the failure mode is silent. A mistyped header name does not error. The relay simply never sees any host as capable, always emits the legacy ack, and the desktop half falls back to its observed
conn-openpath. Nothing fails, and the fix for the connection-straddling bug is inert.Linked Issue
N/A. Follow-up to #19266.
Visual Proof
N/A— test-only change.Testing
Mutation-checked, which is the point of the test. Renaming the header the server reads from
RELAY_HOST_CAPABILITIES_HEADERto'x-orca-host-capability'fails it:Reverted, then re-verified on this branch against current
main:npx vitest run src/relay.blackbox.test.ts— 29 passednpx vitest runinapps/relay— 54 files, 535 passed, 95 skippedpnpm typecheckcleanI manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Internal contributor.
Review
Raised by Pullfrog on #19266. Addressed here rather than rebutted.
Agent skill upstream boundary
Notes
No production code changes, so no security, cross-platform, SSH, mobile, performance, or backwards-compatibility impact. The blackbox suite spawns a real relay process and this case adds roughly one second to it.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)