Skip to content

Commit 73d51f2

Browse files
nicohrubecclaude
andauthored
test(openai): Use multi-message scenario in no-truncation test (#20194)
let's expand the no-truncation scenario here to use multiple input messages to ensure no message popping is applied to align this with other scenarios Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 31fc5d9 commit 73d51f2

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

dev-packages/node-integration-tests/suites/tracing/openai/scenario-no-truncation.mjs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,15 @@ async function run() {
6060
apiKey: 'mock-api-key',
6161
});
6262

63-
// Chat completion with long content (would normally be truncated)
63+
// Multiple messages with long content (would normally be truncated and popped to last message only)
6464
const longContent = 'A'.repeat(50_000);
6565
await client.chat.completions.create({
6666
model: 'gpt-4',
67-
messages: [{ role: 'user', content: longContent }],
67+
messages: [
68+
{ role: 'user', content: longContent },
69+
{ role: 'assistant', content: 'Some reply' },
70+
{ role: 'user', content: 'Follow-up question' },
71+
],
6872
});
6973

7074
// Responses API with long string input (would normally be truncated)

dev-packages/node-integration-tests/suites/tracing/openai/test.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,11 +350,15 @@ describe('OpenAI integration', () => {
350350
const EXPECTED_TRANSACTION_NO_TRUNCATION = {
351351
transaction: 'main',
352352
spans: expect.arrayContaining([
353-
// Chat completion with long content should not be truncated
353+
// Multiple messages should all be preserved (no popping to last message only)
354354
expect.objectContaining({
355355
data: expect.objectContaining({
356-
[GEN_AI_INPUT_MESSAGES_ATTRIBUTE]: JSON.stringify([{ role: 'user', content: longContent }]),
357-
[GEN_AI_INPUT_MESSAGES_ORIGINAL_LENGTH_ATTRIBUTE]: 1,
356+
[GEN_AI_INPUT_MESSAGES_ATTRIBUTE]: JSON.stringify([
357+
{ role: 'user', content: longContent },
358+
{ role: 'assistant', content: 'Some reply' },
359+
{ role: 'user', content: 'Follow-up question' },
360+
]),
361+
[GEN_AI_INPUT_MESSAGES_ORIGINAL_LENGTH_ATTRIBUTE]: 3,
358362
}),
359363
}),
360364
// Responses API long string input should not be truncated or wrapped in quotes

0 commit comments

Comments
 (0)