Repository navigation
fix(agent-server): clear the skills marketplace cache on sync - #5903
Conversation
POST /api/skills/sync now clears the marketplace catalog cache along with the public-skills cache, so the next GET /api/skills/marketplace lists entries the sync brought into the clone. The catalog also stops caching an empty result (as the plugin catalog already does), so an offline or failed first fetch is retried instead of blanking the tab for 5 minutes. The F25.marketplace-stale-cache map bullet loses its known-bug marker. Fixes #5893 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014MKndVj7XWvRQmvW9w2bDg
Coverage Report •
|
||||||||||||||||||||
REST API breakage checks (OpenAPI) — ✅ PASSEDResult: ✅ PASSED |
all-hands-bot
left a comment
There was a problem hiding this comment.
This review was posted by an AI agent (OpenHands).
Review: PR #5903 — clear the skills marketplace cache on sync
Scope: In scope. The change is confined to the Agent Server package this repository owns (openhands-agent-server/openhands/agent_server/skills_service.py), its unit tests, and the verify-agent-server feature map. No cross-repo move is needed.
Assessment: The fix matches the linked issue's acceptance criteria (#5893 — bug, priority:low, ready-for-dev) and mirrors the existing plugins_service precedent.
sync_public_skillsnow calls_invalidate_catalog_cache()on success (line 479), so the nextGET /api/skills/marketplacere-reads the refreshed clone instead of serving the stale 5-minute entry. A failed sync leaves the cache intact, consistent with the existing_invalidate_public_skills_cachehandling and covered by the newtest_failed_sync_keeps_catalog_cache.service_get_marketplace_catalogonly caches non-empty results (lines 701-703), the same ruleplugins_service.service_get_plugins_marketplace_catalogalready uses.test_empty_result_is_not_cachedcovers the retry._invalidate_catalog_cacheis defined below its caller, but module-level name resolution is deferred to call time and sync only runs after import, so there is no ordering defect.
Verification I ran:
uv run pytest tests/agent_server/test_skills_service.py tests/agent_server/test_skills_router.py tests/agent_server/test_plugins_service.py -q→ 97 passed on head6e9b0c7a.- Current-head checks are green, including the latest
PR Description Checkrun (pull_request_target, success at 02:10:42Z). The earlier failure at 01:51Z was the linked issue not yet carryingready-for-dev; that label was added at 01:53:28Z. No outstanding review threads and no prior review on this head.
Non-blocking context: Dropping the empty-result cache means an empty catalog is re-fetched on every request. The default path currently returns empty against the real OpenHands/extensions repository (it ships no marketplaces/default.json — see the F25.marketplace-public bullet), so GET /api/skills/marketplace will now perform the network-bound update_skills_repository fetch per call rather than once per TTL. This is exactly the retry behavior the issue requests and it matches plugins_service, so it is not a defect here; the manifest-layout fix (#5767) is expected to make the real catalog non-empty. Noted only so the maintainer can weigh the per-request cost on the hot path.
✅ APPROVED
HUMAN:
This PR proposes a fix for a bug uncovered during the first full agentic run of
verify-agent-server.AGENT:
I'm an AI agent (Claude Code) helping Engel Nyst (@enyst) with project maintenance.
Requested by Engel · project thread
Decision neededShould a skills sync also clear the plugin marketplace cache?
POST /api/skills/syncupdates the same public clone thatGET /api/plugins/marketplacereads, and the plugin catalog keeps its own 5-minute cache. This PR clears only the skills marketplace cache, because the issue and the map bullet are about the skills tab, and the plugin map (F26.marketplace-cache) currently documents "a new upstream entry appears only after a restart" as the plugin catalog's behaviour. The alternative is to also resetplugins_service._plugin_catalog_cachefromsync_public_skills: one more line, but it changes the documented plugin behaviour and couples the two services.Why
After
POST /api/skills/syncbrings new entries into the public repository clone,GET /api/skills/marketplace(the Marketplace tab) keeps listing the old catalog for up to 5 minutes, because sync clears only the SDK's public-skills cache and not the catalog's module-level_catalog_cache. The catalog also cached an empty result, so an offline or failed first call left the tab empty for the whole TTL; only a restart helped.Summary
sync_public_skillsclears the marketplace catalog cache on success (new_invalidate_catalog_cachehelper); a failed sync keeps it.service_get_marketplace_catalogcaches only non-empty results, the same ruleplugins_servicealready uses.F25.marketplace-stale-cachemap bullet loses its known-bug marker and its prose and Gotchas line now describe the fixed behaviour.Issue Number
Fixes #5893
How to Test
uv run pytest tests/agent_server/test_skills_service.py tests/agent_server/test_skills_router.py tests/agent_server/test_plugins_service.py -q: 97 passed.test_empty_result_is_not_cachedandtest_sync_clears_catalog_cachefail on main.AGENT_SERVER_VERIFY_HOMEset to a private dir):control-agent-server map run --file F25 --only F25.marketplace-stale-cache --fresh --repeat 2 --checkout <main checkout>reportedxfailin both attempts.xpassin both attempts.control-agent-server map checkok (34 files, 935 ids), andmap run --file F25 --only F25.marketplace-stale-cache --freshreportspass.F25.marketplace-catalogstill passes;F25.marketplace-publicstillxfail(separate bug).uv run pre-commit run --files <changed files>: clean.Video/Screenshots
n/a
Type
Notes
F25.marketplace-publicprose still says its empty list "is then cached for 5 minutes"; I left that bullet alone because the manifest-layout PR rewrites it.sync_public_skills' result handling is otherwise unchanged (a separate fix for sync reporting success when the fetch fails touches it).🐳 Agent Server images for this PR — GHCR package, pull/run commands, and all pushed tags (click to expand)
• GHCR package: https://github.com/OpenHands/agent-sdk/pkgs/container/agent-server
Variants & Base Images
eclipse-temurin:17-jdkpython-node-runtimepython-node-runtimepython-node-runtimegolang:1.21-bookwormPull (multi-arch manifest)
# Each variant is a multi-arch manifest supporting both amd64 and arm64 docker pull ghcr.io/openhands/agent-server:6e9b0c7-pythonRun
All tags pushed for this build
About Multi-Architecture Support
6e9b0c7-python) is a multi-arch manifest supporting both amd64 and arm646e9b0c7-python-amd64) are also available if needed