Skip to content

fix(docker): preserve project/<repo> path for nested repo git changes - #61

Merged
zxkane merged 4 commits into
mainfrom
fix/git-changes-nested-repo
Mar 10, 2026
Merged

fix(docker): preserve project/<repo> path for nested repo git changes#61
zxkane merged 4 commits into
mainfrom
fix/git-changes-nested-repo

Conversation

@zxkane

@zxkane zxkane commented Mar 10, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fix Changes tab showing empty for conversations with connected GitHub repos
  • normalizeGitUrl() now preserves project/<repo> path so the agent-server resolves to the correct nested git repository at /workspace/project/<repo>/
  • Remove unnecessary git init /workspace/project from sandbox entrypoint that created an intermediate git repo shadowing the cloned repo's changes

Root cause: When a repo (e.g., zxkane/openhands-infra) is connected, it's cloned to /workspace/project/openhands-infra/. Previously, git API paths were normalized to . (workspace root), which queried the outer /workspace repo instead of the nested cloned repo β€” making file modifications invisible in the Changes tab.

Test plan

  • Build passes (npm run build)
  • Unit tests pass (npm run test:ts β€” relevant tests)
  • Regression tests pass (node docker/test_patch_fix_git_paths.js β€” 19 cases)
  • CI checks pass
  • Reviewer bot findings addressed (no new findings)
  • Deployed to staging
  • E2E tests pass (run ./test/select-e2e-tests.sh for required tests)
    • TC-003: Login
    • TC-004: Conversation List
    • TC-005: New Conversation
    • TC-031: Changes Tab With GitHub Repo

Checklist

  • Regression tests updated (19 test cases in docker/test_patch_fix_git_paths.js)
  • E2E test cases updated (TC-031 in test/E2E_TEST_CASES.md)
  • Snapshot updated (test/__snapshots__/stacks.test.ts.snap)

…r nested repos

When a GitHub repo is connected to a conversation, it gets cloned to
/workspace/project/<repo>/. Previously, normalizeGitUrl() normalized
paths to "." (workspace root), which caused the Changes tab to show
the outer /workspace repo instead of the cloned repo β€” making file
modifications inside the connected repo invisible.

Changes:
- Update normalizeGitUrl() to preserve "project/<repo>" in the path
  so the agent-server resolves to the correct nested git repository
- Remove unnecessary "git init /workspace/project" from sandbox
  entrypoint to avoid creating an intermediate git repo that shadows
  the cloned repo's changes
- Update regression tests (19 cases) with new expected paths
- Update TC-031 E2E test case with new acceptance criteria

@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.

The changes correctly address the root cause of the Changes tab showing empty for nested repos. The fix preserves the project/<repo> path so the agent-server resolves to the correct cloned repo at /workspace/project/<repo>/ instead of the outer /workspace repo.

Key Changes:

  • normalizeGitUrl() now correctly preserves project/<repo> path for all URL formats
  • Removed unnecessary git init /workspace/project that shadowed the cloned repo
  • Comprehensive test coverage (19 test cases)

The implementation is solid with no blocking defects identified. The path transformation logic correctly handles URL-encoded, non-encoded, and bare repo name formats.


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

When no repo is connected, clicking a dotfile like .gitignore in the
Changes tab sends /workspace/project/.gitignore to the diff API. The
previous regex treated .gitignore as a repo name, producing
project/.gitignore which resolved to /mnt/efs/project/.gitignore
(doesn't exist).

Fix: repo names never start with "." β€” exclude dotfiles from the
repo-name capture group so they fall through to the workspace-root
handler, producing ./.gitignore instead.

Also fix missing `ws` parameter in non-encoded workspace root callback
that caused double-slash in the output path.
@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

Container asset hash changed due to patch-fix.js update.
@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

Add acceptance criteria #7-9 and a dedicated regression test section
for the no-repo dotfile diff scenario where clicking .gitignore
previously returned "Internal Server Error: File does not exist:
/mnt/efs/project/.gitignore".
@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 6ebd893 into main Mar 10, 2026
4 checks passed
@zxkane
zxkane deleted the fix/git-changes-nested-repo branch March 10, 2026 13:50
@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