Skip to content

feat(sdk): map failures to a structured evlog error catalog - #127

Merged
HugoRCD merged 4 commits into
mainfrom
feat/evlog-error-catalog
Sep 1, 2026
Merged

feat(sdk): map failures to a structured evlog error catalog#127
HugoRCD merged 4 commits into
mainfrom
feat/evlog-error-catalog

Conversation

@HugoRCD

@HugoRCD HugoRCD commented Sep 1, 2026

Copy link
Copy Markdown
Member

Summary

Raw failures made models hallucinate: an expired VERCEL_OIDC_TOKEN surfaced as a bare "Not authorized" (read as "the repo is private"), and GitHub's 404-for-private-repos masking looked like a missing resource. This PR maps every classifiable failure to a structured evlog catalog error with a stable code, a why (technical cause), and a fix (actionable remedy).

  • New github_tools catalog (src/core/errors.ts, exported as githubToolsErrors): TOKEN_REQUIRED, OIDC_TOKEN_EXPIRED, CONNECT_NOT_AUTHORIZED, CONNECT_USER_NOT_CONNECTED, CONNECT_INSTALLATION_REQUIRED, SUBJECT_CONTEXT_REQUIRED, plus GitHub API codes by status: UNAUTHORIZED (401), FORBIDDEN (403), RATE_LIMITED (403/429 with reset info), NOT_FOUND (404 — explicitly names the private-repo masking), VALIDATION_FAILED (422). Unmapped statuses pass through; the original Octokit error stays as cause, request coordinates in internal (never model-facing).
  • Root-cause fix for the pinned OIDC token: resolveConnectOptions decodes the JWT exp claim (zero dependencies) and throws OIDC_TOKEN_EXPIRED with the exact expiry time before any doomed Connect request. @vercel/connect errors are mapped in the token provider.
  • eve: runGithubToolStep returns { error: { code, message, why, fix } } for catalog errors (via EvlogError.isEvlogError, copy-safe across duplicated installs); plain string otherwise. The extension's requireToolContext throws SUBJECT_CONTEXT_REQUIRED.
  • enrichGithubRateLimitError removed (superseded by the catalog mapping; its suffix logic lives on in formatRateLimitSuffix).
  • Docs: new Errors guide, README section, API reference, SKILL, eve-extension and Vercel Connect pages updated. Changeset: minor for both packages.

Test plan

  • New unit tests: status mapping incl. rate-limit vs plain 403 (core/errors.test.ts), OIDC expiry + the three Connect error mappings (connect/token.test.ts), structured vs plain error payloads (eve/steps.test.ts)
  • pnpm build && pnpm lint && pnpm typecheck && pnpm test exit 0 (117 SDK tests)

Classifiable failures (GitHub API by status, Connect, OIDC, missing token)
now carry a stable code plus why/fix fields so models recover instead of
hallucinating causes. An expired VERCEL_OIDC_TOKEN throws before any
request with the exact expiry time, and eve tool failures return
{ error: { code, message, why, fix } }.
@vercel

vercel Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated
github-tools-docs Ready Ready Preview, v0 Sep 1, 2026 10:07am UTC
1 Skipped Deployment
Project Deployment Actions Updated
github-tools-test-agent Skipped Skipped v0 Sep 1, 2026 10:07am UTC

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Thank you for following the naming conventions! 🙏

The docs URL helps the model fetch the troubleshooting page when why/fix
are not enough. Align the Errors guide page with other guides (header
links, footer).
@vercel
vercel Bot temporarily deployed to Preview – github-tools-test-agent September 1, 2026 10:05 Inactive
@HugoRCD
HugoRCD merged commit d6a0ef3 into main Sep 1, 2026
12 of 13 checks passed
@HugoRCD
HugoRCD deleted the feat/evlog-error-catalog branch September 1, 2026 10:06
@github-actions github-actions Bot mentioned this pull request Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant