Repository navigation
Description
I'm an AI agent (Claude Code) helping Engel Nyst (@enyst) with project maintenance.
Is there an existing issue for the same bug?
- I have searched existing issues and this is not a duplicate.
Bug Description
POST /api/skills/sync forces a refresh of the cached public skills repository (OpenHands/extensions, or EXTENSIONS_REF). When the repository is already cloned and the fetch from its origin fails (offline, GitHub unreachable, origin moved), the endpoint still answers 200 {"status": "success", "message": "Skills repository synced successfully"}. Nothing was synced: the server keeps serving the stale clone. SyncResponse already has an error status for this case, but it is only reached when there is no clone at all.
Expected Behavior
When the fetch of the public skills repository fails, POST /api/skills/sync answers 200 {"status": "error", ...} with a message saying the sync failed. The existing clone stays on disk and keeps being used by skill loading (offline use is unchanged); only the sync report changes. A successful fetch still reports success, and a pinned tag/commit that is already present locally (no fetch needed) still reports success.
Actual Behavior
200 {"status": "success", "message": "Skills repository synced successfully"}, while the server log shows Failed to fetch updates: ... Using cached version.
Steps to Reproduce
- In a checkout of main:
uv sync, thenSESSION_API_KEY=dev-key OH_PERSISTENCE_DIR=$(mktemp -d) uv run python -m openhands.agent_server --host 127.0.0.1 --port 8000. - Call
curl -s -X POST -H 'X-Session-API-Key: dev-key' http://127.0.0.1:8000/api/skills/synconce while online, so$OH_PERSISTENCE_DIR/cache/skills/public-skillsis cloned (status: success). - Make the origin unreachable, e.g.
git -C "$OH_PERSISTENCE_DIR/cache/skills/public-skills" remote set-url origin /nonexistent/repo(or disconnect the network). - Call the sync again: it answers
{"status": "success", "message": "Skills repository synced successfully"}.
With the verify-agent-server skill (#5621): control-agent-server map run --file F25 --only F25.sync-offline --fresh reports the known-bug bullet as an expected failure while the bug lasts.
Acceptance Criteria
-
POST /api/skills/syncreportsstatus: errorwhen the existing clone of the public skills repository cannot be fetched (or the requested ref cannot be checked out after the fetch). - The stale clone is kept and is still used by skill loading (
load_public_skills, the marketplace and plugin catalog), which keep their current fall-back-to-cache behaviour. - A successful fetch, and a pinned ref already present locally, still report
status: success. - A unit test covers a sync against an existing clone whose origin is unreachable.
- The map bullet
F25.sync-offlinepasses with its# bugmarker removed.
Installation Method
uv sync in a checkout of main
Version
main at 6e7a853
Additional Context
Root cause:
sync_public_skills(openhands-agent-server/openhands/agent_server/skills_service.py:473-479) callsupdate_skills_repositoryand treats any returned path as success.update_skills_repository(openhands-sdk/openhands/sdk/skills/utils.py:590-609) delegates totry_cached_clone_or_update(..., update=True), whose_update_repository(openhands-sdk/openhands/sdk/git/cached_repo.py:371) returns silently after_try_fetch(cached_repo.py:391-398) logsFailed to fetch updates: ... Using cached version.The repository path is then returned as if it were updated.- The router (
openhands-agent-server/openhands/agent_server/skills_router.py:322-326) mapssuccess=Falsetostatus: error, so only the service result needs to change.
The fall-back-to-cache behaviour is right for the other callers of update_skills_repository (loading public skills, the marketplace catalog, the plugins catalog); only the explicit sync should report it.
Found by the first full agentic run of verify-agent-server; tracked in #5653.
OpenHands AI triage
The following comments and acceptance criteria were added by the OpenHands AI agent.
Triage
Confirmed against main (6e7a853). sync_public_skills (openhands-agent-server/openhands/agent_server/skills_service.py:462) treats any non-None path from update_skills_repository as success, but _update_repository (openhands-sdk/openhands/sdk/git/cached_repo.py:371) returns the cached path after _try_fetch swallows a fetch failure, so an explicit sync reports success while the stale clone is served. The router already maps success=False to status: error (skills_router.py:322), and SyncResponse.status is already Literal["success","error"], so the response shape does not change.
Bounded scope: make the explicit sync distinguish "the cached clone was refreshed" from "the cached clone was served stale", and report status: error in the latter case (fetch failure, or the requested ref not checkable after a fetch).
Explicit non-goals: do not change the fall-back-to-cache behaviour of the other update_skills_repository callers (load_public_skills, the marketplace catalog, the plugins catalog); do not change the HTTP status, the SyncResponse schema, or add request parameters; do not add retry/backoff; do not delete or move the stale clone.
Priority stays priority:low: the failure is a misleading status only, the recorded source is an agentic verify run rather than a user or production report, and there is a clear workaround (inspect the server log or the clone).
Acceptance Criteria
-
POST /api/skills/syncanswers HTTP 200 with{"status": "error", ...}and a message stating the sync failed when the public skills clone exists but its origin cannot be fetched. -
POST /api/skills/syncanswersstatus: errorwhen the fetch succeeds but the requested ref (PUBLIC_SKILLS_REF/EXTENSIONS_REF) cannot be checked out. -
POST /api/skills/syncstill answersstatus: successafter a successful fetch, on a first-time clone, and when a pinned tag/commit ref is already present locally so no fetch is needed. - After a failed sync, the existing clone stays on disk and
POST /api/skillswithload_public: true,GET /api/skills/marketplace, and the plugins catalog still serve skills from that stale clone (fall-back-to-cache unchanged). - The response contract is unchanged:
SyncResponsekeepsstatus: Literal["success","error"]plusmessage, the route still returns HTTP 200, and the otherupdate_skills_repositorycallers keep their current silent fall-back behaviour. - A failed sync does not clear the in-memory public-skills cache, while a successful sync still clears it.
- An automated test under
tests/agent_server/covers a sync against an existing clone whose origin is unreachable and asserts the failure result; the existing router test confirms the failure maps tostatus: error. - The verify-agent-server map bullet
F25.sync-offlinepasses with its# bugmarker removed in.agents/skills/verify-agent-server/references/feature-map/F25-skills.md.
Activity
enyst commentedon Oct 14, 2026
I'm an AI agent (Claude Code) helping Engel Nyst (@enyst) with project maintenance.
Fix proposed in #5944.
A maintainer needs to decide what a failed sync means while a stale clone exists. Implemented:
POST /api/skills/syncanswers{"status": "error", "message": "Failed to sync skills repository"}and the stale clone is kept on disk, soload_public_skillsand the marketplace/plugins catalogs keep serving it offline as today. The sync is an explicit refresh request, so its report should say whether the refresh happened, while deleting or hiding the cached copy would make an offline server lose its public skills. Alternatives: (a) a distinct status or ausing_cachedfield onSyncResponse(an API shape change that the TS client would also need), or (b) keepsuccessand only reword the message. The message text itself is unchanged.Mechanism: an opt-in
strictflag ontry_cached_clone_or_update/update_skills_repository, used only by the sync; every other caller keeps the fall-back-to-cache default. A pinned tag/SHA already present locally still skips the fetch and reports success. The map bulletF25.sync-offlineis updated in the same PR (marker removed;xfailx2 on main,xpassx2 on the branch, thenpass).Generated by Claude Code