Skip to content

fix(docker): correct VS Code port mapping from 60001 to 8001 - #62

Merged
zxkane merged 2 commits into
mainfrom
fix/vscode-port-mapping
Mar 11, 2026
Merged

fix(docker): correct VS Code port mapping from 60001 to 8001#62
zxkane merged 2 commits into
mainfrom
fix/vscode-port-mapping

Conversation

@zxkane

@zxkane zxkane commented Mar 10, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fix VS Code runtime subdomain 502 error caused by incorrect port mapping in Patch 32
  • The agent-server SDK defaults VS Code to port 8001, but patch-exposed-urls.py mapped it to 60001 (a port where nothing listens)
  • This caused can_connect(ip, 60001) in OpenResty to fail β†’ 502 "Upstream not reachable"

Root Cause

docker/patch-exposed-urls.py Patch 32 had _port_map = {'vscode': 60001, ...} but the upstream software-agent-sdk config defaults vscode_port=8001 and starts VS Code with --host 0.0.0.0 --port {vscode_port}.

Verification (staging)

Port Status Service
8000 200 βœ… agent-server
8001 302/403 βœ… VS Code server (needs token)
60001 000 ❌ Nothing listening

Test plan

  • Build passes (npm run build)
  • Unit tests pass (npm run test) β€” 129 TS + 100 Python
  • CI checks pass
  • Reviewer bot findings addressed (no new findings)
  • Deployed to staging
  • E2E tests pass
    • TC-003: Login
    • TC-004: Conversation List
    • TC-005: New Conversation
    • TC-010: VS Code port mapping verified (8001β†’302, 60001β†’502 via curl; runtime routing confirmed in browser)

Checklist

  • E2E test cases updated (port references corrected)
  • CDK snapshot updated (Docker image hash changed)

The agent-server SDK defaults VS Code server to port 8001
(vscode_service.py default + config.py vscode_port=8001), but
patch-exposed-urls.py was mapping it to 60001. This caused 502
"Upstream not reachable" errors when accessing VS Code via runtime
subdomain routing, because no service listens on port 60001.

Root cause: The port map in Patch 32 used an incorrect port number
that didn't match the actual agent-server SDK default.

Verified on staging:
- Port 8001: VS Code responds (HTTP 302/403 with token auth)
- Port 60001: Connection refused (no listener)
- Port 8000: Agent-server responds (HTTP 200)

@amazon-q-developer amazon-q-developer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review Summary

This PR correctly fixes a critical bug where VS Code runtime subdomain access was failing with 502 errors due to an incorrect port mapping.

Changes Verified:

  • βœ… Port corrected from 60001 β†’ 8001 in patch-exposed-urls.py
  • βœ… Test documentation updated consistently
  • βœ… Snapshot tests updated for Docker image hash change

Root Cause Addressed:
The fix aligns the hardcoded port mapping with the upstream agent-server SDK default (vscode_port=8001), resolving the OpenResty connection failures.

No blocking issues found. The implementation is correct and well-documented.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

@github-actions

Copy link
Copy Markdown
Contributor

πŸ”’ Security Scan Results

Status: 🟑 HIGH ISSUES - Review required!

Summary

  • Critical Issues: 0
  • High Issues: 0
  • Medium Issues: 0
  • Low Issues: 0

NPM Vulnerabilities

  • Critical: 0
  • High: 2

Security Score: N/A/10

Please run ./security-check.sh locally for detailed findings.

πŸ“‹ View detailed reports

Remove the folder path rewrite from Patch 32 that changed
folder=%2Fworkspace%2Fproject to folder=%2Fworkspace. The upstream
default opens VS Code at /workspace/project (the cloned repo),
which is the expected behavior.
@github-actions

Copy link
Copy Markdown
Contributor

πŸ”’ Security Scan Results

Status: 🟑 HIGH ISSUES - Review required!

Summary

  • Critical Issues: 0
  • High Issues: 0
  • Medium Issues: 0
  • Low Issues: 0

NPM Vulnerabilities

  • Critical: 0
  • High: 2

Security Score: N/A/10

Please run ./security-check.sh locally for detailed findings.

πŸ“‹ View detailed reports

@zxkane
zxkane merged commit c897e0d into main Mar 11, 2026
4 checks passed
@zxkane
zxkane deleted the fix/vscode-port-mapping branch March 11, 2026 02:53
@kanerelease kanerelease Bot mentioned this pull request Mar 11, 2026
zxkane pushed a commit that referenced this pull request Mar 11, 2026
## [1.2.0] - 2026-03-11

### Added

#### Sandboxes
- **Startup timing instrumentation and SOCI support** (#58)
- Added structured timing logs (`sandbox-startup-timing`) to benchmark
sandbox startup phases in `/start` and `/resume` routes.
- Integrated SOCI v2 index generation via `soci convert` for Fargate
lazy image loading (requires `soci` CLI >= v0.10).
- Introduced `sandboxSociImageUri` CDK context parameter for
SOCI-enabled sandbox image override.
- Exported sandbox image ECR URI as `CfnOutput` for SOCI index
generation scripts.

### Changed

#### Documentation
- **Improved README for discoverability and engagement** (#60)
- Restructured README to include a hero section, badges, and explicit
value propositions.
- Transformed features list into an emoji-tagged Key Features section
for easier scanning.
- Enhanced comparison tables and quick links for first-time visitor
comprehension.

### Fixed

#### Docker
- **Correct VS Code port mapping from 60001 to 8001** (#62)
- Resolved 502 runtime subdomain errors caused by incorrect port mapping
(`60001` β†’ `8001`) in `patch-exposed-urls.py`.
- Fixed `can_connect(ip, 60001)` requests that failed to establish
upstream connections due to mismatched port configurations in the
agent-server SDK.

- **Preserve project/<repo> path for nested repo git changes** (#61)
- Corrected empty Changes tab for conversations linked to GitHub
repositories.
- Updated `normalizeGitUrl()` to preserve `project/<repo>` paths for
accurate nested repo resolution.
- Removed unnecessary intermediate `git init /workspace/project` repo
creation shadowing actual repo changes.

- **Normalize git API paths for connected repos** (#59)
- Fixed 500 errors in git Changes tab when connecting GitHub
repositories to conversations.
- Adjusted `patch-fix.js` to properly normalize workspace paths
containing nested repo directories.

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
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