Skip to content

fix: use query parameters for git API endpoints to preserve path slashes#2249

Merged
chuckbutkus merged 5 commits intomainfrom
fix/git-api-use-query-params
Mar 2, 2026
Merged

fix: use query parameters for git API endpoints to preserve path slashes#2249
chuckbutkus merged 5 commits intomainfrom
fix/git-api-use-query-params

Conversation

@chuckbutkus
Copy link
Copy Markdown
Contributor

@chuckbutkus chuckbutkus commented Mar 1, 2026

Summary

Change git/changes and git/diff endpoints from path parameters to query parameters to fix URL path normalization issues with Traefik/Gateway API.

When paths like /workspace/project were URL-encoded in path segments (%2Fworkspace%2Fproject), Traefik would decode them and normalize the resulting double slashes, causing the leading slash to be lost.

Using query parameters avoids this issue as they are passed through without path normalization.

Checklist

  • If the PR is changing/adding functionality, are there tests to reflect this?
  • If there is an example, have you run the example to make sure that it works?
  • If there are instructions on how to run the code, have you followed the instructions and made sure that it works?
  • If the feature is significant enough to require documentation, is there a PR open on the OpenHands/docs repository with the same branch name?
  • Is the github CI passing?

Agent Server images for this PR

GHCR package: https://github.com/OpenHands/agent-sdk/pkgs/container/agent-server

Variants & Base Images

Variant Architectures Base Image Docs / Tags
java amd64, arm64 eclipse-temurin:17-jdk Link
python amd64, arm64 nikolaik/python-nodejs:python3.12-nodejs22 Link
golang amd64, arm64 golang:1.21-bookworm Link

Pull (multi-arch manifest)

# Each variant is a multi-arch manifest supporting both amd64 and arm64
docker pull ghcr.io/openhands/agent-server:9dda7a0-python

Run

docker run -it --rm \
  -p 8000:8000 \
  --name agent-server-9dda7a0-python \
  ghcr.io/openhands/agent-server:9dda7a0-python

All tags pushed for this build

ghcr.io/openhands/agent-server:9dda7a0-golang-amd64
ghcr.io/openhands/agent-server:9dda7a0-golang_tag_1.21-bookworm-amd64
ghcr.io/openhands/agent-server:9dda7a0-golang-arm64
ghcr.io/openhands/agent-server:9dda7a0-golang_tag_1.21-bookworm-arm64
ghcr.io/openhands/agent-server:9dda7a0-java-amd64
ghcr.io/openhands/agent-server:9dda7a0-eclipse-temurin_tag_17-jdk-amd64
ghcr.io/openhands/agent-server:9dda7a0-java-arm64
ghcr.io/openhands/agent-server:9dda7a0-eclipse-temurin_tag_17-jdk-arm64
ghcr.io/openhands/agent-server:9dda7a0-python-amd64
ghcr.io/openhands/agent-server:9dda7a0-nikolaik_s_python-nodejs_tag_python3.12-nodejs22-amd64
ghcr.io/openhands/agent-server:9dda7a0-python-arm64
ghcr.io/openhands/agent-server:9dda7a0-nikolaik_s_python-nodejs_tag_python3.12-nodejs22-arm64
ghcr.io/openhands/agent-server:9dda7a0-golang
ghcr.io/openhands/agent-server:9dda7a0-java
ghcr.io/openhands/agent-server:9dda7a0-python

About Multi-Architecture Support

  • Each variant tag (e.g., 9dda7a0-python) is a multi-arch manifest supporting both amd64 and arm64
  • Docker automatically pulls the correct architecture for your platform
  • Individual architecture tags (e.g., 9dda7a0-python-amd64) are also available if needed

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 1, 2026

API breakage checks (Griffe)

Result: Failed

Log excerpt (first 1000 characters)

============================================================
Checking openhands-sdk (openhands.sdk)
============================================================
Comparing openhands-sdk 1.11.5 against 1.11.4
::notice title=openhands-sdk API::Ignoring Field metadata-only change (non-breaking): load_public_skills
::notice title=openhands-sdk API::Ignoring Field metadata-only change (non-breaking): temperature
::warning file=openhands-sdk/openhands/sdk/llm/llm.py,line=196,title=LLM.top_p::Attribute value was changed: `Field(default=1.0, ge=0, le=1)` -> `Field(default=None, ge=0, le=1, description='Nucleus sampling parameter. Defaults to None (uses provider default). Set to a value between 0 and 1 to control diversity of outputs.')`
::error title=SemVer::Breaking changes detected (1); require at least minor version bump from 1.11.x, but new is 1.11.5

============================================================
Checking openhands-workspace (openhands.workspace)
============================

Action log

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 1, 2026

Agent server REST API breakage checks (OpenAPI)

Result: Passed

Action log

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 1, 2026

Coverage

Coverage Report •
FileStmtsMissCoverMissing
TOTAL19121869154% 
report-only-changed-files is enabled. No files were changed during this commit :)

Add support for both query parameters (preferred) and path parameters
(legacy/backwards compatible) for git/changes and git/diff endpoints.

Query parameter method (?path=/workspace/project) is preferred as it
avoids URL path normalization issues with Traefik/Gateway API where
encoded slashes (%2F) in path segments would be decoded and normalized,
causing leading slashes to be lost.

Path parameter method (/changes/workspace/project) is maintained for
backwards compatibility with existing clients.

Co-authored-by: openhands <openhands@all-hands.dev>
@chuckbutkus chuckbutkus force-pushed the fix/git-api-use-query-params branch from 1709bef to 663f4b5 Compare March 1, 2026 06:06
@chuckbutkus chuckbutkus marked this pull request as ready for review March 2, 2026 02:40
Copy link
Copy Markdown
Collaborator

@all-hands-bot all-hands-bot left a comment

Choose a reason for hiding this comment

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

Taste Rating: 🟢 Good taste

Clean, pragmatic solution to a real Traefik path normalization issue. The refactoring into helper functions is solid, backward compatibility is maintained, and test coverage is comprehensive.

Eval Risk Flag 🚩

While the implementation is sound, this PR touches git tool endpoints that agents use during coding tasks. Per review policy, flagging for lightweight eval verification before merge, even though:

  • Changes are fully backward compatible (old path-based endpoints unchanged)
  • New query param endpoints are additive, fixing cases that were previously broken
  • Risk profile is low since existing behavior is preserved

Technical Notes

The solution correctly addresses the core issue: query parameters avoid Traefiks URL path normalization, so absolute paths like /workspace/project no longer get mangled. The test coverage includes this critical use case.

Recommendation: Run lightweight evals to verify git operations still work correctly, then merge. Code quality is not a concern.

Copy link
Copy Markdown
Collaborator

@tofarr tofarr left a comment

Choose a reason for hiding this comment

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

🍰

@chuckbutkus chuckbutkus merged commit 97ab053 into main Mar 2, 2026
30 of 31 checks passed
@chuckbutkus chuckbutkus deleted the fix/git-api-use-query-params branch March 2, 2026 21:42
zparnold added a commit to zparnold/software-agent-sdk that referenced this pull request Mar 5, 2026
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.

5 participants