[grid] stop forwarding se:remoteUrl past the Node that consumes it - #17908
Conversation
PR Summary by QodoGrid: stop forwarding "se:remoteUrl" beyond the consuming Node
AI Description
Diagram
High-Level Assessment
Files changed (7)
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can enable the Remediation agent and Qodo fixes findings in a dedicated fix PR More tips ↗ | Customize Qodo ↗ | Qodo docs ↗ |
There was a problem hiding this comment.
Pull request overview
This PR fixes a Grid regression where the client-advertised se:remoteUrl capability was being forwarded past the Selenium Node/factory that consumes it, causing downstream Selenium servers (Dynamic Grid/Relay) to mis-resolve proxied BiDi/CDP/VNC URLs and causing strict drivers (notably IE) to reject session creation due to an unknown extension capability.
Changes:
- Introduces
SessionFactory.stripPerHopCapabilities(...)to remove hop-scoped capabilities (currentlyse:remoteUrl) from outboundNEW_SESSIONrequests sent to downstream servers/drivers. - Applies the stripping consistently across delegating session factories (Relay, Docker, Kubernetes, DriverService) when constructing the outbound
NEW_SESSIONcommand. - Adds unit/regression tests to ensure
se:remoteUrlis stripped from forwarded payloads while remaining available locally for Node-side URL resolution.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| java/src/org/openqa/selenium/grid/node/SessionFactory.java | Adds a centralized helper to strip hop-scoped capabilities (removes se:remoteUrl) before forwarding new-session requests downstream. |
| java/src/org/openqa/selenium/grid/node/relay/RelaySessionFactory.java | Uses the helper when creating the outbound NEW_SESSION request to the relay/Appium endpoint. |
| java/src/org/openqa/selenium/grid/node/docker/DockerSessionFactory.java | Uses the helper when creating the outbound NEW_SESSION request to the containerized driver service. |
| java/src/org/openqa/selenium/grid/node/kubernetes/KubernetesSessionFactory.java | Uses the helper when creating the outbound NEW_SESSION request to the K8s pod driver service. |
| java/src/org/openqa/selenium/grid/node/config/DriverServiceSessionFactory.java | Uses the helper when creating the outbound NEW_SESSION request to local driver services (prevents strict drivers from rejecting se:remoteUrl). |
| java/test/org/openqa/selenium/grid/node/SessionFactoryTest.java | Adds unit coverage for the stripping helper (removal of se:remoteUrl, preservation of other caps, no-op behavior). |
| java/test/org/openqa/selenium/grid/node/relay/RelaySessionFactoryTest.java | Adds a regression test asserting se:remoteUrl is not forwarded to the remote end while remaining present in the Node-local merged capabilities. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
🔗 Related Issues
Regression from #17790
💥 What does this PR do?
standalone-docker,node-docker, Kubernetes, and Relay — where the session starts but the WebSocket never connects, loggingFailed to establish WebSocket endpoint. BiDi then degrades silently, so tests that only request it without using it still pass.se:remoteUrl is an unknown extension capability for IE. Affects any driver that validates extension capabilities, with or without BiDi; Chrome, Firefox, and Edge ignore them, so IE surfaced it.se:remoteUrlnow describes a single hop. It tells a Node how the client reached the Grid, and stops there rather than being forwarded to another Selenium server or a driver binary.🔧 Implementation Notes
se:remoteUrl. Deeper hops talk to targets they already reach by construction — each factory issues its new-session request over that same address — so their auto-detected address was never the problem.se:remoteUrlas if the client had reached it. [grid] honor client-advertised se:remoteUrl for reachable BiDi/CDP/VNC URLs #17790 already stripped the capability from the response; it just needed stripping on the way in too.NEW_SESSIONcommand only, not on the capabilities merged into eachActiveSession.LocalNode.getSession()re-resolves the proxied URLs from the session's own capabilities, so removing it there would makegetSession()disagree withnewSession().stripPerHopCapabilitiesnames the policy rather than exposing a genericremoveCapability, so the capability name and the reason it must not travel live in one place instead of being repeated at four call sites. A generic remover would also sit oddly onSessionFactory, which is about creating sessions, andLocalNodeis not one.RelaySessionFactoryTestbecause Relay is the only delegating factory testable in-process; Docker and Kubernetes need a daemon or cluster. All four share the same helper.🤖 AI assistance
💡 Additional Considerations
se:*options in places it would make sense to ignore them in IEDriverServer, otherwise we must ensure none of them ever get sent to it.setEnvVarsToContainerpropagates Grid process config (SE_NODE_*) into browser containers, so a Grid configured withSE_NODE_GRID_URLreproduces this symptom by another route. Only image settings should propagate.🔄 Types of changes