Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

temporal-spring-ai: a provider 429 fails the chat activity on the first attempt

未关闭
#3,121 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
38/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
java, spring
领域
backend

调研方向

Start with ActivityChatModel.java:111-114 and the reported ProviderRateLimitRetryTest cases; the issue does not give the test's file path. Compare the activity's retry behavior with Spring AI's default handling of 429 and its inner retries. The issue describes possible approaches but leaves the policy to the team; done should address the reported 429 and 503 cases, including the Retry-After and insufficient_quota distinction.

由索引模型根据 Issue 内容生成。

描述

Expected Behavior

A rate-limited LLM call (HTTP 429) through ActivityChatModel is retried by Temporal with backoff. sdk-python's OpenAI Agents integration already treats 429 as retryable and passes the provider's retry delay through (temporalio/sdk-python#1796).

Actual Behavior

The activity fails on attempt 1 with RETRY_STATE_NON_RETRYABLE_FAILURE. Spring AI's default error handlers, both the plain builder default and the Boot auto-configured one, turn every 4xx, 429 included, into NonTransientAiException (RetryUtils in Spring AI 1.1.0), and ActivityChatModel puts that type in doNotRetry by default (ActivityChatModel.java:111-114).

A related interaction on 5xx: Spring AI's own RetryTemplate (10 attempts, backoff up to 3 minutes) runs inside the activity, so a persistent 503 can send up to 30 requests across Temporal's 3 attempts. The activity has a 2-minute start-to-close and no heartbeat, so a timed-out attempt can keep calling the provider while later attempts run. sdk-python turned off Botocore's inner retries for its default Strands Bedrock model for a similar reason (temporalio/sdk-python#1797).

Steps to Reproduce the Problem

  1. Point a real OpenAiChatModel at a local stub that returns 429 with Retry-After: 7, register it with ChatModelActivityImpl, and call it from a workflow through ActivityChatModel.forDefault().
  2. The stub sees one request; the workflow gets ActivityFailure caused by ApplicationFailure of type NonTransientAiException, attempt 1.
  3. With a 503 stub and Spring AI's backoff shortened to milliseconds, the stub sees 30 requests.

I have this as a test (ProviderRateLimitRetryTest, five cases, including Boot-equivalent defaults and spring.ai.retry.on-http-codes=429). For a fix I'd rather not parse exception messages, but Spring AI's handlers throw NonTransientAiException with only a message, so the status survives only in the message and the headers are gone by the time the activity sees it. The OpenAI path could instead use a response error handler, scoped to the client Temporal calls, that keeps status, headers and the error body; the activity can then retry rate limits with Retry-After as the next delay and leave insufficient_quota 429s non-retryable, since backoff won't fix a billing limit. Whether the module should also turn off Spring AI's inner retry for calls it wraps seems like your team's call; I'll follow whichever direction you prefer.

Specifications

  • Version: sdk-java main (be01e60a), Spring AI 1.1.0
  • Platform: JDK 21, macOS
主要语言
Java
星标
433
派生
257
平均合并
2 天 22 小时
30 天内合并 PR
22

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

temporalio/sdk-java 的其他 Issue

查看 temporalio/sdk-java 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。