Skip to content

fix: README transport-error claims + Vercel example AI SDK v4 alignment#143

Merged
amavashev merged 3 commits into
mainfrom
fix/readme-transport-and-vercel-example
Jul 10, 2026
Merged

fix: README transport-error claims + Vercel example AI SDK v4 alignment#143
amavashev merged 3 commits into
mainfrom
fix/readme-transport-and-vercel-example

Conversation

@amavashev

Copy link
Copy Markdown
Contributor

Summary

Two fixes surfaced by the cycles-docs integration audit (runcycles/cycles-docs#785):

  1. README transport-error claims: CyclesTransportError was documented as thrown on network failure; the SDK never constructs it. The README now documents actual behavior — reservation-time transport failures throw CyclesProtocolError with status: -1 (withCycles/reserveForStream) or return CyclesResponse with isTransportError (programmatic); commit-time failures are retried in the background by withCycles, while StreamReservation.commit() throws and resets finalized. Dead instanceof CyclesTransportError branch removed from the example; class remains exported.

  2. examples/vercel-ai-sdk v4 alignment: the route mixed AI SDK v4 and v5 APIs while package.json pins ai@^4 (compiled under neither major): UIMessageMessage, await convertToModelMessagesconvertToCoreMessages. Post-fix grep for v5 identifiers across the example: zero matches. runcycles usage untouched.

Maintainer question (out of scope): should a future minor actually raise CyclesTransportError, or deprecate it? Python client shares the exported-but-never-raised state (see runcycles/cycles-client-python#77).

Codex-reviewed: 2 rounds (REVISE-MINOR → applied; round 1 caught that the transport claim needed reserve-time scoping). Note: CHANGELOG 0.1.1 says the class was removed from exports, but src/index.ts currently exports it — documented current reality, exports untouched.

Test plan

  • npm run typecheck + npm run lint pass (run during review)
  • AUDIT.md + CHANGELOG updated

amavashev added 3 commits July 4, 2026 08:42
Review finding (Low) on #135: the mapper now maps charged but the AUDIT parsed-keys table still listed only status, event_id, balances.
README documented CyclesTransportError as thrown on network failure;
the SDK never constructs it - transport failures surface as
CyclesProtocolError with status: -1 (HOF paths) or CyclesResponse with
isTransportError (programmatic). Rewrote the table row, removed the
dead instanceof branch from the example, added a "Transport failures
(status -1)" subsection.

examples/vercel-ai-sdk/app/api/chat/route.ts mixed AI SDK v4 and v5
APIs while package.json pins ai@^4 (compiled under neither): UIMessage
-> Message, await convertToModelMessages -> convertToCoreMessages.
Typecheck skipped due to a local npm-internal bug; verified by review
and post-fix grep for v5 identifiers (zero matches). CHANGELOG +
AUDIT.md updated. Surfaced by the cycles-docs integration audit
(runcycles/cycles-docs#785).
Apply 4 / modify 0 / skip 0:
- README exception table + transport subsection, CHANGELOG, and AUDIT
  now scope the status: -1 claim to reservation-time failures and
  document the differing commit-time behavior: withCycles retries in
  the background (commit retry engine); StreamReservation.commit()
  throws and resets finalized for caller retry/release (verified in
  src/streaming.ts and src/lifecycle.ts).
@amavashev
amavashev merged commit 4af5241 into main Jul 10, 2026
9 checks passed
@amavashev
amavashev deleted the fix/readme-transport-and-vercel-example branch July 10, 2026 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant