Skip to content

fix(agent-server): clear the skills marketplace cache on sync - #5903

Merged
enyst merged 1 commit into
mainfrom
claude/umbrella-bug-fixes-tgz9ai-marketplace-stale-cache
Oct 14, 2026
Merged

enyst merged 1 commit into
mainfrom
claude/umbrella-bug-fixes-tgz9ai-marketplace-stale-cache

Conversation

@enyst

@enyst enyst commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

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 needed

Should a skills sync also clear the plugin marketplace cache? POST /api/skills/sync updates the same public clone that GET /api/plugins/marketplace reads, 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 reset plugins_service._plugin_catalog_cache from sync_public_skills: one more line, but it changes the documented plugin behaviour and couples the two services.

Why

After POST /api/skills/sync brings 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_skills clears the marketplace catalog cache on success (new _invalidate_catalog_cache helper); a failed sync keeps it.
  • service_get_marketplace_catalog caches only non-empty results, the same rule plugins_service already uses.
  • Unit tests for both; the F25.marketplace-stale-cache map 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_cached and test_sync_clears_catalog_cache fail on main.
  • Map proof (AGENT_SERVER_VERIFY_HOME set to a private dir):
    • main (6e7a853): control-agent-server map run --file F25 --only F25.marketplace-stale-cache --fresh --repeat 2 --checkout <main checkout> reported xfail in both attempts.
    • this branch (launching this worktree): the same command reported xpass in both attempts.
    • after dropping the marker: control-agent-server map check ok (34 files, 935 ids), and map run --file F25 --only F25.marketplace-stale-cache --fresh reports pass. F25.marketplace-catalog still passes; F25.marketplace-public still xfail (separate bug).
  • uv run pre-commit run --files <changed files>: clean.

Video/Screenshots

n/a

Type

  • Bug fix
  • Feature
  • Refactor
  • Breaking change
  • Docs / chore

Notes


🐳 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

Variant Architectures Base Image Docs / Tags
java amd64, arm64 eclipse-temurin:17-jdk Link
python-slim amd64, arm64 python-node-runtime Link
python-minimal amd64, arm64 python-node-runtime Link
python amd64, arm64 python-node-runtime 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:6e9b0c7-python

Run

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

All tags pushed for this build

ghcr.io/openhands/agent-server:6e9b0c7-golang-amd64
ghcr.io/openhands/agent-server:6e9b0c7a4d45539b87d1335322682744d79e342b-golang-amd64
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-marketplace-stale-cache-golang-amd64
ghcr.io/openhands/agent-server:6e9b0c7-golang_tag_1.21-bookworm-amd64
ghcr.io/openhands/agent-server:6e9b0c7-golang-arm64
ghcr.io/openhands/agent-server:6e9b0c7a4d45539b87d1335322682744d79e342b-golang-arm64
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-marketplace-stale-cache-golang-arm64
ghcr.io/openhands/agent-server:6e9b0c7-golang_tag_1.21-bookworm-arm64
ghcr.io/openhands/agent-server:6e9b0c7-java-amd64
ghcr.io/openhands/agent-server:6e9b0c7a4d45539b87d1335322682744d79e342b-java-amd64
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-marketplace-stale-cache-java-amd64
ghcr.io/openhands/agent-server:6e9b0c7-eclipse-temurin_tag_17-jdk-amd64
ghcr.io/openhands/agent-server:6e9b0c7-java-arm64
ghcr.io/openhands/agent-server:6e9b0c7a4d45539b87d1335322682744d79e342b-java-arm64
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-marketplace-stale-cache-java-arm64
ghcr.io/openhands/agent-server:6e9b0c7-eclipse-temurin_tag_17-jdk-arm64
ghcr.io/openhands/agent-server:6e9b0c7-python-amd64
ghcr.io/openhands/agent-server:6e9b0c7a4d45539b87d1335322682744d79e342b-python-amd64
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-marketplace-stale-cache-python-amd64
ghcr.io/openhands/agent-server:6e9b0c7-python-node-runtime-amd64
ghcr.io/openhands/agent-server:6e9b0c7-python-arm64
ghcr.io/openhands/agent-server:6e9b0c7a4d45539b87d1335322682744d79e342b-python-arm64
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-marketplace-stale-cache-python-arm64
ghcr.io/openhands/agent-server:6e9b0c7-python-node-runtime-arm64
ghcr.io/openhands/agent-server:6e9b0c7-python-minimal-amd64
ghcr.io/openhands/agent-server:6e9b0c7a4d45539b87d1335322682744d79e342b-python-minimal-amd64
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-marketplace-stale-cache-python-minimal-amd64
ghcr.io/openhands/agent-server:6e9b0c7-python-node-runtime-minimal-amd64
ghcr.io/openhands/agent-server:6e9b0c7-python-minimal-arm64
ghcr.io/openhands/agent-server:6e9b0c7a4d45539b87d1335322682744d79e342b-python-minimal-arm64
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-marketplace-stale-cache-python-minimal-arm64
ghcr.io/openhands/agent-server:6e9b0c7-python-node-runtime-minimal-arm64
ghcr.io/openhands/agent-server:6e9b0c7-python-slim-amd64
ghcr.io/openhands/agent-server:6e9b0c7a4d45539b87d1335322682744d79e342b-python-slim-amd64
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-marketplace-stale-cache-python-slim-amd64
ghcr.io/openhands/agent-server:6e9b0c7-python-node-runtime-slim-amd64
ghcr.io/openhands/agent-server:6e9b0c7-python-slim-arm64
ghcr.io/openhands/agent-server:6e9b0c7a4d45539b87d1335322682744d79e342b-python-slim-arm64
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-marketplace-stale-cache-python-slim-arm64
ghcr.io/openhands/agent-server:6e9b0c7-python-node-runtime-slim-arm64
ghcr.io/openhands/agent-server:6e9b0c7-golang
ghcr.io/openhands/agent-server:6e9b0c7a4d45539b87d1335322682744d79e342b-golang
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-marketplace-stale-cache-golang
ghcr.io/openhands/agent-server:6e9b0c7-golang_tag_1.21-bookworm
ghcr.io/openhands/agent-server:6e9b0c7-java
ghcr.io/openhands/agent-server:6e9b0c7a4d45539b87d1335322682744d79e342b-java
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-marketplace-stale-cache-java
ghcr.io/openhands/agent-server:6e9b0c7-eclipse-temurin_tag_17-jdk
ghcr.io/openhands/agent-server:6e9b0c7-python-minimal
ghcr.io/openhands/agent-server:6e9b0c7a4d45539b87d1335322682744d79e342b-python-minimal
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-marketplace-stale-cache-python-minimal
ghcr.io/openhands/agent-server:6e9b0c7-python-node-runtime-minimal
ghcr.io/openhands/agent-server:6e9b0c7-python-slim
ghcr.io/openhands/agent-server:6e9b0c7a4d45539b87d1335322682744d79e342b-python-slim
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-marketplace-stale-cache-python-slim
ghcr.io/openhands/agent-server:6e9b0c7-python-node-runtime-slim
ghcr.io/openhands/agent-server:6e9b0c7-python
ghcr.io/openhands/agent-server:6e9b0c7a4d45539b87d1335322682744d79e342b-python
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-marketplace-stale-cache-python
ghcr.io/openhands/agent-server:6e9b0c7-python-node-runtime

About Multi-Architecture Support

  • Each variant tag (e.g., 6e9b0c7-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., 6e9b0c7-python-amd64) are also available if needed

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
@github-actions

Copy link
Copy Markdown
Contributor

Coverage

Coverage Report •
FileStmtsMissCoverMissing
openhands-agent-server/openhands/agent_server
   skills_service.py2407270%172, 175–178, 181–183, 186–187, 190–194, 197–201, 203, 207–208, 210, 221–222, 302, 309–310, 315, 337–338, 406–407, 522, 545, 562, 579, 596, 613, 630, 726–727, 731–733, 735–738, 740–742, 744–747, 750–752, 757, 759–760, 765–769, 771–773, 779
TOTAL497421982560% 

@github-actions

Copy link
Copy Markdown
Contributor

REST API breakage checks (OpenAPI) — ✅ PASSED

Result: ✅ PASSED

Action log

@enyst
enyst marked this pull request as ready for review October 14, 2026 01:47
@enyst
enyst marked this pull request as draft October 14, 2026 01:59
@enyst
enyst marked this pull request as ready for review October 14, 2026 01:59
@enyst
enyst requested a review from all-hands-bot October 14, 2026 02:11

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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_skills now calls _invalidate_catalog_cache() on success (line 479), so the next GET /api/skills/marketplace re-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_cache handling and covered by the new test_failed_sync_keeps_catalog_cache.
  • service_get_marketplace_catalog only caches non-empty results (lines 701-703), the same rule plugins_service.service_get_plugins_marketplace_catalog already uses. test_empty_result_is_not_cached covers the retry.
  • _invalidate_catalog_cache is 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 head 6e9b0c7a.
  • Current-head checks are green, including the latest PR Description Check run (pull_request_target, success at 02:10:42Z). The earlier failure at 01:51Z was the linked issue not yet carrying ready-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

@enyst
enyst merged commit 923ff2d into main Oct 14, 2026
61 of 63 checks passed
@enyst
enyst deleted the claude/umbrella-bug-fixes-tgz9ai-marketplace-stale-cache branch October 14, 2026 20:14
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.

[Bug]: GET /api/skills/marketplace keeps serving its cached catalog (including an empty one) after POST /api/skills/sync

3 participants