Skip to content

Add sync-openapi-spec skill#50

Merged
hongyi-chen merged 2 commits intomainfrom
sync-openapi-spec/add-skill
May 9, 2026
Merged

Add sync-openapi-spec skill#50
hongyi-chen merged 2 commits intomainfrom
sync-openapi-spec/add-skill

Conversation

@hongyi-chen
Copy link
Copy Markdown
Collaborator

@hongyi-chen hongyi-chen commented May 8, 2026

What this changes

Adds a new skill at .agents/skills/sync-openapi-spec/ that keeps developers/agent-api-openapi.yaml (the file rendered by Scalar at docs.warp.dev/api) in sync with the canonical OpenAPI spec at warp-server/public_api/openapi.yaml.

Why

developers/agent-api-openapi.yaml is a hand-curated subset of the canonical spec, with no tooling to detect drift today. The header comment on src/pages/api.astro already calls it out as "synced from the upstream Oz Agent API source... Re-sync that file when the API changes," but there's been no skill, script, or workflow to actually do the re-sync — so it has drifted from the source.

A quick --mode diff run against develop of warp-server confirms real drift today: 3 paths whose operations have moved on, 3 schemas added in source that are missing from docs (e.g. AgentRunMode, SecretRef, SessionSharingConfig), and 11 schemas in the docs file that aren't in the source subset anymore (mostly harness-support artifacts).

What's in this PR

  • SKILL.md — workflow doc (modeled on sync-error-docs/SKILL.md): prereqs, diff/triage/apply/validate/PR steps, troubleshooting.
  • scripts/sync_openapi.py — Python 3 / pyyaml-based diff & apply tool with three modes (diff, apply, self-test). Keeps the agent and schedules tags, drops memory_stores/harness-support and a small list of internal agent paths (followups, handoff, fork, redirect), and prunes components.schemas to only schemas reachable via transitive $ref walking. Preserves x-internal: true operations under public paths to match the file's existing behavior.
  • references/sync-policy.md — rationale for each exclusion and instructions for adding/removing exclusions when new endpoints land.

This PR ships only the skill. It does not modify developers/agent-api-openapi.yaml. Running the skill end-to-end and updating that file is a deliberate follow-up so reviewers can vet the policy first.

Validation

  • python3 .agents/skills/sync-openapi-spec/scripts/sync_openapi.py --mode self-testself-test: OK
  • --mode diff against the live source/target produces the drift report quoted in the "Why" section
  • --mode apply against a temp file produces a parseable YAML with 24 paths / 76 schemas / tags [agent, schedules] (matches the existing docs file's path set exactly)

Conversation: https://staging.warp.dev/conversation/176cd75e-155b-466f-8c14-871b799b7271
Run: https://oz.staging.warp.dev/runs/019e09f3-7262-7aa6-86ff-5b8f6f78da68
Plans:

This PR was generated with Oz.

Adds a new skill at .agents/skills/sync-openapi-spec/ that compares
warp-server/public_api/openapi.yaml against developers/agent-api-openapi.yaml
(the file the Scalar API reference at docs.warp.dev/api renders from) and
regenerates the docs subset deterministically.

The skill is documented in SKILL.md, with the exclusion policy (which tags
and paths are kept vs dropped) recorded in references/sync-policy.md and
encoded in scripts/sync_openapi.py as EXCLUDED_TAGS / EXCLUDED_PATHS. The
script supports --mode {diff,apply,self-test}.

This PR ships only the skill itself. Running the skill (and updating
developers/agent-api-openapi.yaml) is intentionally a follow-up, so reviewers
can vet the policy before any changes land in the public API reference.

Co-Authored-By: Oz <oz-agent@warp.dev>
@cla-bot cla-bot Bot added the cla-signed label May 8, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented May 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment May 9, 2026 0:05am

Request Review

Audit-driven follow-up:

- Add _validate_output() that walks the regenerated spec and fails if
  any $ref points at a missing component. Apply mode now exits with
  code 3 and refuses to overwrite the target on validation failure.
- Self-test asserts no unresolved refs after transform.
- Fix SKILL.md Step 5 wording: npm run build does not catch dangling
  $refs (Astro just YAML-parses the file). The new validator covers
  that case; npm run build remains a belt-and-braces integration check.
- Update troubleshooting entry to match the new behavior.

Co-Authored-By: Oz <oz-agent@warp.dev>
@hongyi-chen hongyi-chen marked this pull request as ready for review May 9, 2026 00:04
@hongyi-chen hongyi-chen merged commit 8f81081 into main May 9, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants