fix(agent): map the SDK's NoOutputGeneratedError to MODEL_OUTPUT_INVALID

Merged
VA
7d ago
+119-5

Split out of #1214 per review feedback: the no-output-error remap is its own change with its own test.

When the model produces nothing to parse (an empty length finish, say), the AI SDK throws NoOutputGeneratedError from the result.output getter. The adapter's error translation did not recognize it, so it fell through to MODEL_PROVIDER_FAILED — an infrastructure verdict for what is really a response that failed the closed grammar. This maps it to MODEL_OUTPUT_INVALID instead: test category, run-retry eligible, and the invocation spends a repair round on it like any other malformed response.

Notes:

  • NoObjectGeneratedError and NoOutputGeneratedError are distinct classes in AI SDK 7.0.107 (both exported); the former is thrown parsing text, the latter by the result.output getter. No rename involved.
  • packages/e2e/tests/unit/no-output-error.test.ts scripts a length finish with empty text through the real adapter: it fails as MODEL_PROVIDER_FAILED without the fix and MODEL_OUTPUT_INVALID with it.