[
https://issues.apache.org/jira/browse/CAMEL-26584?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Work on CAMEL-26584 started by Andrea Cosentino.
------------------------------------------------
> camel-aws-bedrock - clear the retrieve token on the last page
> -------------------------------------------------------------
>
> Key: CAMEL-26584
> URL: https://issues.apache.org/jira/browse/CAMEL-26584
> Project: Camel
> Issue Type: Bug
> Components: camel-aws2
> Reporter: Andrea Cosentino
> Assignee: Andrea Cosentino
> Priority: Major
>
> `components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/agentruntime/BedrockAgentRuntimeProducer.java:273`
> ```java
> if (ObjectHelper.isNotEmpty(response.nextToken())) {
> message.setHeader(BedrockAgentRuntimeConstants.NEXT_TOKEN,
> response.nextToken());
> }
> ```
> The request reads the same header at 261; getMessageForResponse returns the
> existing exchange message at 681. When a request supplies a token and the
> final response omits it, the old token remains. Routes that loop while the
> header exists can fetch the final page repeatedly. Remove the header on a
> terminal response. Tests cover input and output tokens separately, not the
> terminal transition.
> History: unchanged token handling since CAMEL-23466 / 5cc87cb60862.
> [AWS Retrieve
> contract](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_Retrieve.html)
> defines a returned token for additional results.
> Expected behavior: the operation honors its documented contract, including
> exceptional and terminal paths. Add regression tests for the triggering case
> described above.
> Audited against upstream main 3658e02a7f9d. AI-generated by Codex on behalf
> of oscerd (JIRA acosentino).
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)