Skip to content

fix(sync): surface error context on sync run failures#140

Open
Vswaroop04 wants to merge 1 commit into
withoneai:mainfrom
Vswaroop04:fix/sync-run-error-context
Open

fix(sync): surface error context on sync run failures#140
Vswaroop04 wants to merge 1 commit into
withoneai:mainfrom
Vswaroop04:fix/sync-run-error-context

Conversation

@Vswaroop04
Copy link
Copy Markdown

Was looking around the codebase and noticed that when sync run fails, the result comes back as { status: "failed" } with just a flat error string — no HTTP status, no retry timing, nothing an agent or script can key off programmatically. This means a 429 rate-limit looks identical to a 401 auth failure, which makes automated retry logic a guessing game.

The fix is minimal and follows the patterns already in the codebase. The runner's catch block already attaches _recordsSynced and _pagesProcessed to thrown errors so callers can report progress; I added _httpStatus and _retryAfter alongside those, pulling the values directly off ApiError (which already carries them from the Retry-After header parser). The syncRunCommand catch in index.ts then builds a structured error object from those fields rather than a bare string. A new SyncRunError interface in types.ts gives callers a typed surface to match on — distinguishing 429 from 401 from a network failure without parsing the message.

The human-readable output is also updated to print the HTTP status and retry hint when present, which helps during manual debugging.

Closes #139.

…ai#139)

When sync run fails, the result now includes a structured error object
with message, httpStatus, and retryAfter — rather than an opaque
status: "failed" with no diagnostic context. This lets agents and
operators distinguish a 429 rate-limit from a 401 auth failure from a
network error without parsing the message string.

The runner attaches _httpStatus and _retryAfter from ApiError before
re-throwing so the command layer can forward them. SyncRunError is
introduced in types.ts so callers have a typed surface to match on.
Human-readable output also prints the HTTP status and retry hint when
present.
@paulkr
Copy link
Copy Markdown
Member

paulkr commented May 28, 2026

@Vswaroop04 - Could you update the package.json version here?

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.

sync run: failed status comes back with no error info — agents can't tell rate-limit from auth from network

2 participants