Skip to content

Surface artifact tool-call failures instead of empty data - #2088

Open
baggiiiie wants to merge 1 commit into
UsefulSoftwareCo:mainfrom
baggiiiie:fix/artifact-tool-call-failures
Open

baggiiiie wants to merge 1 commit into
UsefulSoftwareCo:mainfrom
baggiiiie:fix/artifact-tool-call-failures

Conversation

@baggiiiie

Copy link
Copy Markdown
Contributor

Summary

when an artifact tool call returns { ok: false, error }, the shell passes it through as query data. generated artifacts then coerce the missing .data to an empty list, so a broken binding looks like a freshly synced empty result.

this change rejects the failed tool result after unwrapping execute-action, so TanStack exposes query.error and the artifact renders its error state.

before

failed artifact tool call appears as empty data

after

failed artifact tool call renders an actionable error

Linked issue

no issue open yet, will open one if preferred

Verification

  • bun run format:check
  • bun run lint
  • bun run typecheck
  • TURBO_TEST_CONCURRENCY=2 bun run test — 39/39 tasks passed
  • e2e — Artifacts · a failed tool call shows an error instead of empty databefore recording · after recording

Checklist

  • Added a changeset (bun run changeset), or this change needs none.
  • Added or updated tests for the new behaviour.
  • No secrets, credentials, or private data in the diff.

…mpty data

An artifact call is a single `return await tools.…`, so a code-mode
`{ ok: false, error }` value is the call's failure, not a value to branch
on. The shell proxy passed it through as query data, which settled the
query as success with no `.data` — every artifact then coerced it to an
empty list, so a deleted or renamed binding read as "0 results, synced
just now" instead of an error.

Detect the failure envelope after unwrapping and throw, so the query
rejects and the component renders ArtifactError.
@baggiiiie

Copy link
Copy Markdown
Contributor Author

CI failure seems to be an issue with wrangler startup race, should be unrelated to this change

This branch has not been deployed

No deployments
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