Login fails across multiple dev containers due to incremental port forwarding
What version of the IDE extension are you using?
0.4.76
What subscription do you have?
Plus
Which IDE are you using?
VS Code
What platform is your computer?
Darwin jose-martin.local 25.2.0 Darwin Kernel Version 25.2.0: Tue Nov 18 21:07:05 PST 2025; root:xnu-12377.61.12~1/RELEASE_ARM64_T6020 arm64
What issue are you seeing?
When logging in from multiple VS Code windows connected to different dev containers, the port used for the browser↔extension login flow increments each time (1455, then 1456, 1457, …). Login works only on the first container (port 1455). On subsequent containers, login fails because the extension still appears to rely on the original port, while VS Code forwards a different one.
It looks like the extension doesn’t release/close the forwarded port after a successful login, so the next login attempt in another container gets assigned the next port number and the flow breaks. As a workaround, I have to manually close the forwarded port (e.g., 1455) in the first container’s VS Code window before attempting login in the second container.
What steps can reproduce the bug?
- Open VS Code window A and connect to dev container A.
- Start the login flow from the extension (Codex/ChatGPT sidebar) in container A.
- Observe that VS Code forwards port 1455 and complete the login successfully.
- Open a second VS Code window B and connect to dev container B.
- Start the login flow from the extension in container B.
- Observe that VS Code forwards port 1456 (or the next incremental port).
- Attempt to complete the login in container B → it fails.
- (Workaround) Go back to window A, close the forwarded port 1455 manually in VS Code, then retry the login in window B → it works.
What is the expected behavior?
- The login flow should work consistently across multiple containers/windows.
- The extension should either:
- properly close/release the forwarded port after login succeeds, or
- use the currently forwarded port assigned by VS Code for that container/window, rather than relying on a previously used one.
- Users should not need to manually close forwarded ports for login to work.
Additional information
This happens specifically when logging in from different VS Code windows connected to different containers.