Skip to content

perf(artifact-delivery): spend GitHub quota once per Skill and commit - #493

Merged
harlan-zw merged 5 commits into
mainfrom
perf/resolve-cache
Oct 6, 2026
Merged

harlan-zw merged 5 commits into
mainfrom
perf/resolve-cache

Conversation

@harlan-zw

@harlan-zw harlan-zw commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

🔗 Linked issue

Related to #481, #484

❓ Type of change

  • 📖 Documentation
  • 🐞 Bug fix
  • 👌 Enhancement
  • ✨ New feature
  • 🧹 Chore
  • ⚠️ Breaking change

📚 Description

A spent GitHub quota is the only run failure production has shown: 15 RATE_LIMITED Resolutions in 14 days. Launch traffic will repeat the same Skills, so a run should spend GitHub quota only when nothing it needs was read before.

  • Commit and tree reads by SHA come from KV. Their answers never change. Keys name the Repository ID and the SHA, and only the public client gets the cache. A KV failure is reported and reads GitHub instead.
  • A checks-only policy bump re-checks stored bytes. BYTE_COMPATIBLE_POLICY_VERSIONS lists earlier policies that packed the same bytes. A ready build under one of them is read back from R2 and checked under the current checks. It must also pass every rule a GitHub load applies today. fix(artifact-delivery): run a named Skill by its registry identity #481 changed only checks, yet its bump reloaded every Skill from GitHub. The set holds 2026-10-07.1 and 2026-08-20.1: fix(artifact-delivery): run Skills that ship media or doc keys #487 leaves large media out only of folders those policies refused. A stored build that left a file out loads from GitHub, because R2 holds only the files it packed. A check version change under the current policy takes the re-check path too.
  • A second first run waits for the first build. It looks in D1 for an earlier running build of the same Repository, commit and folder. If one exists, the build goes back on the queue as a new message 2 seconds later, then reuses the finished build. A build waits for at most 90 seconds from its creation, and never waits for a build that has not changed state in 90 seconds.

Architecture after this change: KV in front of commit and tree reads, R2 read back for a re-check, and a D1 lookup that lets a second run wait

GitHub requests per run, measured on the same fake Repository with the real source client. Each fresh build includes one tarball request.

Run Before After
First run, pinned to a commit 7 7
Repeat run, pinned 0 0
First run, on a branch 8 8
Repeat run, on a branch 3 2
First run of another Skill at a built commit 7 4
First run after a checks-only policy bump 7 0
Second of two concurrent first runs, pinned 7 0
Second of two concurrent first runs, on a branch 8 3

🤖 AI disclosure: Harlan Agent Kit modified this description. My AI open-source policy.

A spent GitHub quota is the only run failure production has shown, and
launch traffic repeats the same Skills.

- Commit and tree reads by SHA never change, so KV keeps them.
- A ready build whose policy packed the same bytes is checked again from
  R2. #481 changed only checks, yet its bump reloaded every Skill.
- A first run waits for an earlier build of the same Repository, commit
  and folder, then reuses it. The wait goes back as a new queue message,
  so it spends no retry.
@harlan-zw harlan-zw added the harlan-agent-review Pull request triage requires an adversarial Review. Adding this label manually always forces one. label Oct 6, 2026
@harlan-github-agent harlan-github-agent Bot added harlan-agent-review-required Pull request triage requires an adversarial Review for this head commit. and removed harlan-agent-review Pull request triage requires an adversarial Review. Adding this label manually always forces one. labels Oct 6, 2026
@harlan-zw harlan-zw added the harlan-agent-review-required Pull request triage requires an adversarial Review for this head commit. label Oct 6, 2026
…eft out

#487 leaves large media out of a folder. R2 holds only the packed files, so a stored build that left a file out loads from GitHub. Every folder 2026-10-07.1 accepted packs the same files, so that policy joins the byte-compatible set.
# Conflicts:
#	layers/artifact-delivery/server/utils/github-source.ts
@harlan-github-agent harlan-github-agent Bot added the harlan-agent-running An Agent holds a Task on this issue or pull request right now. label Oct 6, 2026
# Conflicts:
#	layers/artifact-delivery/server/utils/github-source.ts
#	layers/artifact-delivery/server/utils/queue.ts
@harlan-zw harlan-zw added the harlan-agent-review Pull request triage requires an adversarial Review. Adding this label manually always forces one. label Oct 6, 2026
@harlan-github-agent harlan-github-agent Bot removed the harlan-agent-review Pull request triage requires an adversarial Review. Adding this label manually always forces one. label Oct 6, 2026
@harlan-zw
harlan-zw merged commit a221945 into main Oct 6, 2026
1 of 6 checks passed
@harlan-github-agent harlan-github-agent Bot added harlan-agent-running An Agent holds a Task on this issue or pull request right now. and removed harlan-agent-running An Agent holds a Task on this issue or pull request right now. labels Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

harlan-agent-review-required Pull request triage requires an adversarial Review for this head commit.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant