Skip to content

fix(web): re-read the viewed skill file on a skills/get fetch (#2516) - #2694

Merged
cliffhall merged 1 commit into
v2/mainfrom
v2/fix/2516-skill-fetch-stale-cache
Oct 12, 2026
Merged

cliffhall merged 1 commit into
v2/mainfrom
v2/fix/2516-skill-fetch-stale-cache

Conversation

@cliffhall

Copy link
Copy Markdown
Member

Closes #2516

Problem

The Skills screen read the selected skill's SKILL.md exactly once per manifest. The automatic read is guarded by autoReadKey === manifestKey, which exists so that StrictMode effect replays don't send a duplicate request. Fetch with skills/get sent only skills/get and compared the entry against the listing; it never re-read the file in the viewer. So if the server changed the file, the viewer kept showing the first resources/read response until the listing changed or the server was reconnected. That is the "stale response" in the report. No response cache was involved: core's readResource caches nothing, and ttlMs is not consulted on this path.

Fix

fetchEntry in SkillsScreen.tsx now also re-reads the file the viewer is showing, through the existing showResource path. That is SKILL.md by default, or the supporting file the reader opened. The re-read goes out right after skills/get, so the Protocol tab shows the two in the order the click implies. It reuses showResource's manifest key and attempt stamp, so a stale or superseded result is still dropped. It also keeps the rule that a re-read never overwrites a verification's own SKILL.md bytes.

Out of scope

The report lists three adjacent items. They are not part of this fix:

  1. The Messages tab not showing a rejected skills/get response.
  2. No way to call resources/directory/read. The Directory section already does this when the server declares directoryRead: true.
  3. An error with no details after a successful fetch.

Tests

Two new cases in SkillsScreen.test.tsx:

  • The fetch re-reads SKILL.md, and the viewer shows the server's new content.
  • The fetch re-reads the supporting file the viewer is on, not SKILL.md.

npm run local:gate passes.

Screenshots

Captured at 1280×900 against test-servers/configs/skills-http.json. The fixture serves static content, so these show the traffic rather than changed content: after the click, a fresh resources/read follows skills/get.

Before clicking Fetch. One resources/read, from the selection:
skills-before-fetch

After clicking Fetch with skills/get. skills/get, then a new resources/read of SKILL.md:
skills-after-fetch-rereads-file

🤖 Generated with Claude Code

The Skills screen read SKILL.md once per manifest, so a server that changed
the file after selection was never re-asked: the viewer kept the first
resources/read until a reconnect. Fetch with skills/get now also re-reads
the file the viewer is showing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: cliffhall <cliff@futurescale.com>
@cliffhall cliffhall added the v2 Issues and PRs for v2 label Oct 12, 2026
@cliffhall cliffhall linked an issue Oct 12, 2026 that may be closed by this pull request
2 tasks done
@cliffhall
cliffhall requested a balanced review from Copilot October 12, 2026 18:31

Copilot AI 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.

🟢 Approval recommended

The refresh behavior is correctly attempt-stamped, preserves verification-owned content, and has focused regression coverage.

0 open findings

What changed in this PR

Refreshes the currently viewed skill resource whenever skills/get is fetched, preventing stale viewer content.

Changes:

  • Re-reads the active SKILL.md or supporting file after skills/get.
  • Adds tests for both viewer states.
File Description
SkillsScreen.tsx Refreshes the currently viewed resource on fetch.
SkillsScreen.test.tsx Verifies entry and supporting-file refreshes.

🧠 Review effort: Balanced


💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@cliffhall

Copy link
Copy Markdown
Member Author

Copilot review loop closed: round 1 was clean (0 open findings, no inline or suppressed comments), so no further round was requested.

@cliffhall
cliffhall merged commit 17d1607 into v2/main Oct 12, 2026
8 checks passed
@cliffhall
cliffhall deleted the v2/fix/2516-skill-fetch-stale-cache branch October 12, 2026 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v2 Issues and PRs for v2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Skill/get (resources/read) caches response (for example with TTL=10)

2 participants