Skip to content

skill-files cache lacks a stale shield against cold bursts #201

Closed

Description

@harlan-github-agent

The skill-files handler serves from a plain TTL cache with no stale-while-revalidate shield, so crawler sweeps over cold keys re-run the skill lookup, row read, and upstream tree fetch per request and produced 1,030 D1-overload events (SKILLD-1F), the family's largest culprit.

Target: layers/registry/server/api/skill-files/[...slug].get.ts

Verify with: pnpm vitest run test/unit/skill-files-cache.test.ts test/unit/skill-files-tree-outage.test.ts

Estimated to change 2 files.

The daily-checkin routine opened this issue automatically on its 2026-09-11T21:40:00.000Z run. It is not Harlan's own report. Close it to reject the proposal, and the reason you give stops it being offered again.

Activity

  1. harlan-github-agent commented on Sep 11, 2026

    @harlan-github-agent
    ContributorAuthor

    🤖 ISSUE TRIAGE

    Harlan Agent Kit posted this automated triage. It is not Harlan's personal assessment or commitment. AI open source policy.

    • Route: Ready to implement
    • Difficulty: 2/5
    • Impact: 4/5
    • Reproduction: Yes
    • Codebase review: Not needed
    • Summary: Handler at layers/registry/server/api/skill-files/[...slug].get.ts:83 uses plain readCache/writeCache (6h TTL, no stale window, no inflight dedup), so cold-key crawler sweeps re-run the upstream tree fetch and compute per request, producing
    • Next action: Migrate the handler to readThroughCache from shared/server/cache.ts, mirroring layers/registry/server/api/skill-related/[...slug].get.ts:88: wrap the tree fetch + classification in compute, bump the cache key to v4 because readThroughCache stores a {storedAt,value} envelope, map treeResult gone/unavailable to their thrown 410/503 errors, serve stale on compute failure, then add test/unit/skill-files-cache.test.ts (cold miss, fresh hit, stale fallback on upstream failure) and verify with pnpm vitest run test/unit/skill-files-cache.test.ts test/unit/skill-files-tree-outage.test.ts.
  2. added
    harlan-agent-ready-to-implementIssue triage found bounded work ready for an implementation Agent.
    and removed
    harlan-agent-runningAn Agent holds a Task on this issue or pull request right now.
    on Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions